disk: part_dos: update partition table entries after write
PATCH 1/1 disk: part_dos: update partition table entries after write
Fixes issues when switching from GPT to MBR partition tables.
---
Hi,
Sending this patch as a follow-up to the other one [1] doing the same thing for GPT write.
Let me know if you have any questions.
Regards,
Gary
[1] https://lists.denx.de/pipermail/u-boot/2021-January/438764.html
--- disk/part_dos.c | 3 +++ 1 file changed, 3 insertions(+)
disk/part_dos.c +3 -0
@@ -499,6 +499,9 @@ int write_mbr_sector(struct blk_desc *dev_desc, void *buf)return 1 ; } +/* Update the partition table entries*/ +part_init (dev_desc); +return 0 ; }
Signature · 1 line
2.29.2
PATCH 1/1 disk: part_dos: update partition table entries after write
Quoted 1 line · Gary Bisson
Fixes issues when switching from GPT to MBR partition tables.
This does not catch all cases of changing the MBR. See function write_mbr_partitions() with writes both the MBR and EBRs (if applicable).
Android devices typically have more than 4 partitions. Why does fastboot not update the extended boot records?
Best regards
Heinrich
Quoted 33 lines
Signed-off-by Gary Bisson <[email protected]>---
Hi,Sending this patch as a follow-up to the other one [1] doing the same thing for GPT write.
Let me know if you have any questions.
Regards,
Gary[1] https://lists.denx.de/pipermail/u-boot/2021-January/438764.html
--- disk/part_dos.c | 3 +++ 1 file changed, 3 insertions(+)disk/part_dos.c +3
-0@@ -499,6 +499,9 @@ int write_mbr_sector(struct blk_desc *dev_desc, void *buf)return 1 ; } +/* Update the partition table entries*/ +part_init (dev_desc); +return 0 ; }
PATCH 1/1 disk: part_dos: update partition table entries after write
Hi Heinrich,
Quoted 5 lines · Heinrich Schuchardt
Quoted 1 line · Gary Bisson
Fixes issues when switching from GPT to MBR partition tables.
This does not catch all cases of changing the MBR. See function
write_mbr_partitions()with writes both the MBR and EBRs (if applicable).
Good catch! That's correct, I missed it for 2 reasons:
1- I focused on the fastboot code which indeed only calls write_mbr_sector()
2- I did that work on 2020.10 U-Boot which didn't include write_mbr_partitions().
Quoted 2 lines
Android devices typically have more than 4 partitions. Why does fastboot not update the extended boot records?
Fastboot is not only used for Android, we generally use it to flash our Linux images as well. I guess the code just hasn't been updated to handle EBR although I'd say that most people use GPT, especially Android users.
Anyway, I'll submit a v2 that take care of write_mbr_partitions().
Regards,
Gary
PATCH v2 1/1 disk: part_dos: update partition table entries after write
In reply to Gary BissonFixes issues when switching from GPT to MBR partition tables.
---
Changes for v2:
- added part_init() inside write_mbr_partitions(), as suggested by Heinrich
--- disk/part_dos.c | 6 ++++++ 1 file changed, 6 insertions(+)
disk/part_dos.c +6 -0
@@ -423,6 +423,9 @@ int write_mbr_partitions(struct blk_desc *dev, ext_part_sect = next_ebr; } +/* Update the partition table entries*/ +part_init (dev_desc); +return 0 ; }
@@ -499,6 +502,9 @@ int write_mbr_sector(struct blk_desc *dev_desc, void *buf)return 1 ; } +/* Update the partition table entries*/ +part_init (dev_desc); +return 0 ; }
Signature · 1 line
2.29.2
PATCH v2 1/1 disk: part_dos: update partition table entries after write
Hi,
Quoted 3 lines · Gary Bisson
Fixes issues when switching from GPT to MBR partition tables.
Signed-off-by Gary Bisson <[email protected]>
Quoted 23 lines
---
Changes for v2:
- addedpart_init()insidewrite_mbr_partitions(), as suggested by Heinrich--- disk/part_dos.c | 6 ++++++ 1 file changed, 6 insertions(+)disk/part_dos.c +3
-0@@ -423,6 +423,9 @@ int write_mbr_partitions(struct blk_desc *dev, ext_part_sect = next_ebr; } +/* Update the partition table entries*/ +part_init (dev_desc); +return 0 ; }
disk/part_dos.c int write_mbr_sector(struct blk_desc *dev_desc, void *buf) · line 510
Quoted 9 lines
disk/part_dos.c +3
-0@@ -499,6 +502,9 @@ int write_mbr_sector(struct blk_desc *dev_desc, void *buf)return 1 ; } +/* Update the partition table entries*/ +part_init (dev_desc); +return 0 ; }
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
PATCH v2 1/1 disk: part_dos: update partition table entries after write
In reply to Gary BissonQuoted 4 lines · Gary Bisson
Fixes issues when switching from GPT to MBR partition tables.
Signed-off-by Gary Bisson <[email protected]>Acked-by Marek Szyprowski <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210202/bc4983e7/attachment.sig>
This breaks the build if CONFIG_CMD_MBR is enabled. Christian Melki sent a patch but it didn't get picked up?
Quoted 12 lines · Tom Rini
Quoted 4 lines · Gary Bisson
Fixes issues when switching from GPT to MBR partition tables.
Signed-off-by Gary Bisson <[email protected]>Acked-by Marek Szyprowski <[email protected]>Applied to u-boot/master, thanks!
--
Tom
Quoted 2 lines · Da Xue
This breaks the build if
CONFIG_CMD_MBRis enabled. Christian Melki sent a patch but it didn't get picked up?
Ah. The commit message wasn't clear that it was reproducible problem so it was on my list to look at / confirm at some point. I'll take a look sooner now, thanks.
Signature · 1 line
Tom