0007-Add-VbDisplayInfo-struct-in-context.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From 312caab05a956769150d186fa170f89ca3a945e6 Mon Sep 17 00:00:00 2001
  2. From: Hal Emmerich <hal@halemmerich.com>
  3. Date: Wed, 11 Dec 2019 21:33:42 -0600
  4. Subject: [PATCH] Add VbDisplayInfo struct in context
  5. Allows for access of the debug info from the context struct, useful for VbDisplayScreen
  6. ---
  7. firmware/2lib/include/2api.h | 11 +++++++++++
  8. firmware/lib/vboot_ui.c | 12 ++++++++++++
  9. 2 files changed, 23 insertions(+)
  10. diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
  11. index 97b5cca6..fdcc3a1e 100644
  12. --- a/firmware/2lib/include/2api.h
  13. +++ b/firmware/2lib/include/2api.h
  14. @@ -166,6 +166,15 @@ enum vb2_context_flags {
  15. VB2_CONTEXT_SW_WP_ENABLED = (1 << 18),
  16. };
  17. +/* Information on display context */
  18. +typedef struct VbDisplayInfo {
  19. + uint32_t allow_usb;
  20. + uint32_t allow_legacy;
  21. + uint32_t use_usb;
  22. + uint32_t use_legacy;
  23. + uint32_t signed_only;
  24. +} VbDisplayInfo;
  25. +
  26. /*
  27. * Context for firmware verification. Pass this to all vboot APIs.
  28. *
  29. @@ -176,6 +185,8 @@ struct vb2_context {
  30. * Fields which must be initialized by caller.
  31. */
  32. + VbDisplayInfo info;
  33. +
  34. /*
  35. * Flags; see vb2_context_flags. Some flags may only be set by caller
  36. * prior to calling vboot functions.
  37. diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c
  38. index 5f891013..d248eb3e 100644
  39. --- a/firmware/lib/vboot_ui.c
  40. +++ b/firmware/lib/vboot_ui.c
  41. @@ -177,6 +177,9 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx)
  42. /* Check if the default is to boot using disk, usb, or legacy */
  43. uint32_t default_boot = vb2_nv_get(ctx, VB2_NV_DEV_DEFAULT_BOOT);
  44. + /* Check if unsigned booting is allowed */
  45. + uint32_t signed_only = vb2_nv_get(ctx, VB2_NV_DEV_BOOT_SIGNED_ONLY);
  46. +
  47. if(default_boot == VB2_DEV_DEFAULT_BOOT_USB)
  48. use_usb = 1;
  49. if(default_boot == VB2_DEV_DEFAULT_BOOT_LEGACY)
  50. @@ -207,6 +210,15 @@ VbError_t vb2_developer_ui(struct vb2_context *ctx)
  51. }
  52. }
  53. + if (ctx->flags & FWMP_DEV_ENABLE_OFFICIAL_ONLY)
  54. + signed_only = 1;
  55. +
  56. + ctx->info.allow_usb = allow_usb;
  57. + ctx->info.allow_legacy = allow_legacy;
  58. + ctx->info.use_usb = use_usb;
  59. + ctx->info.use_legacy = use_legacy;
  60. + ctx->info.signed_only = signed_only;
  61. +
  62. /* If dev mode is disabled, only allow TONORM */
  63. while (disable_dev_boot) {
  64. VB2_DEBUG("dev_disable_boot is set\n");
  65. --
  66. 2.20.1