0002-Proper-firmware-index-report-for-read-only-boot-path.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From fc2f65e964fb9636db35749579c47dde15599f57 Mon Sep 17 00:00:00 2001
  2. From: Paul Kocialkowski <contact@paulk.fr>
  3. Date: Mon, 10 Aug 2015 20:24:50 +0200
  4. Subject: [PATCH 2/4] Proper firmware index report for read-only boot path
  5. When booting from a read-only boot path, the active firmware to report is RO.
  6. This is detected with the lack of a vboot handoff pointer.
  7. Change-Id: I3b1b5823b4dde7bc4185abe2e29f5d056ef9f09c
  8. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
  9. ---
  10. src/vboot/crossystem/fdt.c | 2 +-
  11. src/vboot/firmware_id.c | 6 +++++-
  12. src/vboot/firmware_id.h | 1 +
  13. 3 files changed, 7 insertions(+), 2 deletions(-)
  14. diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c
  15. index 5cba178..45cad88 100644
  16. --- a/src/vboot/crossystem/fdt.c
  17. +++ b/src/vboot/crossystem/fdt.c
  18. @@ -68,7 +68,7 @@ static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *tree)
  19. nvstorage_flash_get_blob_size());
  20. }
  21. - int fw_index = vdat->firmware_index;
  22. + int fw_index = get_active_fw_index(vdat);
  23. const char *fwid;
  24. int fwid_size;
  25. diff --git a/src/vboot/firmware_id.c b/src/vboot/firmware_id.c
  26. index 82acf91..d625251 100644
  27. --- a/src/vboot/firmware_id.c
  28. +++ b/src/vboot/firmware_id.c
  29. @@ -31,6 +31,7 @@ static struct fwid {
  30. } fw_fmap_ops[] = {
  31. {VDAT_RW_A, "RW_FWID_A", NULL, 0, "RW A: ID NOT FOUND"},
  32. {VDAT_RW_B, "RW_FWID_B", NULL, 0, "RW B: ID NOT FOUND"},
  33. + {VDAT_RO, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"},
  34. {VDAT_RECOVERY, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"},
  35. };
  36. @@ -125,10 +126,13 @@ static VbSharedDataHeader *get_vdat(void)
  37. return NULL;
  38. }
  39. -static inline int get_active_fw_index(VbSharedDataHeader *vdat)
  40. +int get_active_fw_index(VbSharedDataHeader *vdat)
  41. {
  42. int fw_index = VDAT_UNKNOWN;
  43. + if (lib_sysinfo.vboot_handoff == NULL)
  44. + return VDAT_RO;
  45. +
  46. if (vdat)
  47. fw_index = vdat->firmware_index;
  48. diff --git a/src/vboot/firmware_id.h b/src/vboot/firmware_id.h
  49. index 181b2a1..71be302 100644
  50. --- a/src/vboot/firmware_id.h
  51. +++ b/src/vboot/firmware_id.h
  52. @@ -44,6 +44,7 @@ int get_rwb_fw_size(void);
  53. * Get firmware details for currently active fw type. It looks up vdat,
  54. * identifies fw_index and returns appropriate id and size for that index.
  55. */
  56. +int get_active_fw_index(VbSharedDataHeader *vdat);
  57. const char *get_active_fw_id(void);
  58. int get_active_fw_size(void);
  59. --
  60. 2.10.2