[PATCH] disk: part_efi: update partition table entries after write

Gary Bisson gary.bisson at boundarydevices.com
Tue Jan 26 14:56:23 CET 2021


Fixes fastboot issues when switching from mbr to gpt partition tables.

Signed-off-by: Gary Bisson <gary.bisson at boundarydevices.com>
---
Hi,

I hesitated calling this a RFC as I'm not sure everyone will like the
idea.

Basically the issue encountered was the following:
- Device with its storage flashed with a MBR partition table
- Run fastboot to flash a new OS (and new partition table)
- After flashing a GPT partition table, U-Boot couldn't find any of the
  partition names from the GPT
  -> reason is that the partition table entries aren't updated
  -> so U-Boot still believes it's a MBR table inside and so its parsing
  fails

This commit adds an update of the table entries inside the
write_mbr_and_gpt_partitions() function. At first I thought maybe this
should be added in fastboot file (fb_mmc.c) but couldn't think of a good
reason why this shouldn't happened in part_efi directly.

Let me know if you have any questions.

Regards,
Gary
---
 disk/part_efi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 2f922662e6e..7a24e33d189 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -867,6 +867,9 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
 		return 1;
 	}
 
+	/* Update the partition table entries*/
+	part_init(dev_desc);
+
 	return 0;
 }
 #endif
-- 
2.29.2



More information about the U-Boot mailing list