0005-Proper-firmware-index-report-for-read-only-boot-path.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From dce70fb042d91ba74359a6dfb519f31d77e2c328 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 5/7] 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. Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
  8. ---
  9. src/vboot/crossystem/fdt.c | 2 +-
  10. src/vboot/firmware_id.c | 6 +++++-
  11. src/vboot/firmware_id.h | 1 +
  12. 3 files changed, 7 insertions(+), 2 deletions(-)
  13. diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c
  14. index ca39dac..a79b192 100644
  15. --- a/src/vboot/crossystem/fdt.c
  16. +++ b/src/vboot/crossystem/fdt.c
  17. @@ -73,7 +73,7 @@ static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *tree)
  18. nvstorage_flash_get_blob_size());
  19. }
  20. - int fw_index = vdat->firmware_index;
  21. + int fw_index = get_active_fw_index(vdat);
  22. const char *fwid;
  23. int fwid_size;
  24. diff --git a/src/vboot/firmware_id.c b/src/vboot/firmware_id.c
  25. index 3662921..955bc84 100644
  26. --- a/src/vboot/firmware_id.c
  27. +++ b/src/vboot/firmware_id.c
  28. @@ -36,6 +36,7 @@ static struct fwid {
  29. } fw_fmap_ops[] = {
  30. {VDAT_RW_A, "RW_FWID_A", NULL, 0, "RW A: ID NOT FOUND"},
  31. {VDAT_RW_B, "RW_FWID_B", NULL, 0, "RW B: ID NOT FOUND"},
  32. + {VDAT_RO, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"},
  33. {VDAT_RECOVERY, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"},
  34. };
  35. @@ -130,10 +131,13 @@ static VbSharedDataHeader *get_vdat(void)
  36. return NULL;
  37. }
  38. -static inline int get_active_fw_index(VbSharedDataHeader *vdat)
  39. +int get_active_fw_index(VbSharedDataHeader *vdat)
  40. {
  41. int fw_index = VDAT_UNKNOWN;
  42. + if (lib_sysinfo.vboot_handoff == NULL)
  43. + return VDAT_RO;
  44. +
  45. if (vdat)
  46. fw_index = vdat->firmware_index;
  47. diff --git a/src/vboot/firmware_id.h b/src/vboot/firmware_id.h
  48. index fb6f206..090e9d1 100644
  49. --- a/src/vboot/firmware_id.h
  50. +++ b/src/vboot/firmware_id.h
  51. @@ -49,6 +49,7 @@ int get_rwb_fw_size(void);
  52. * Get firmware details for currently active fw type. It looks up vdat,
  53. * identifies fw_index and returns appropriate id and size for that index.
  54. */
  55. +int get_active_fw_index(VbSharedDataHeader *vdat);
  56. const char *get_active_fw_id(void);
  57. int get_active_fw_size(void);
  58. --
  59. 1.9.1