All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] disk: part_dos: update partition table entries after write
@ 2021-01-27 20:19 Gary Bisson
  2021-01-27 20:56 ` Heinrich Schuchardt
  2021-01-28  8:10 ` [PATCH v2] " Gary Bisson
  0 siblings, 2 replies; 8+ messages in thread
From: Gary Bisson @ 2021-01-27 20:19 UTC (permalink / raw)
  To: u-boot

Fixes issues when switching from GPT to MBR partition tables.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
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(+)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index f431925745..470886f4bb 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -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;
 }
 
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] disk: part_dos: update partition table entries after write
  2021-01-27 20:19 [PATCH] disk: part_dos: update partition table entries after write Gary Bisson
@ 2021-01-27 20:56 ` Heinrich Schuchardt
  2021-01-28  8:01   ` Gary Bisson
  2021-01-28  8:10 ` [PATCH v2] " Gary Bisson
  1 sibling, 1 reply; 8+ messages in thread
From: Heinrich Schuchardt @ 2021-01-27 20:56 UTC (permalink / raw)
  To: u-boot

On 1/27/21 9:19 PM, Gary Bisson wrote:
> 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

>
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
> 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(+)
>
> diff --git a/disk/part_dos.c b/disk/part_dos.c
> index f431925745..470886f4bb 100644
> --- a/disk/part_dos.c
> +++ b/disk/part_dos.c
> @@ -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;
>   }
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] disk: part_dos: update partition table entries after write
  2021-01-27 20:56 ` Heinrich Schuchardt
@ 2021-01-28  8:01   ` Gary Bisson
  0 siblings, 0 replies; 8+ messages in thread
From: Gary Bisson @ 2021-01-28  8:01 UTC (permalink / raw)
  To: u-boot

Hi Heinrich,

On Wed, Jan 27, 2021 at 09:56:13PM +0100, Heinrich Schuchardt wrote:
> On 1/27/21 9:19 PM, Gary Bisson wrote:
> > 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().

> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] disk: part_dos: update partition table entries after write
  2021-01-27 20:19 [PATCH] disk: part_dos: update partition table entries after write Gary Bisson
  2021-01-27 20:56 ` Heinrich Schuchardt
@ 2021-01-28  8:10 ` Gary Bisson
  2021-01-28  8:18   ` Marek Szyprowski
  2021-02-02 14:31   ` Tom Rini
  1 sibling, 2 replies; 8+ messages in thread
From: Gary Bisson @ 2021-01-28  8:10 UTC (permalink / raw)
  To: u-boot

Fixes issues when switching from GPT to MBR partition tables.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
Changes for v2:
- added part_init() inside write_mbr_partitions(), as suggested by
  Heinrich
---
 disk/part_dos.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index f431925745c..60addc6e00d 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -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;
 }
 
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2] disk: part_dos: update partition table entries after write
  2021-01-28  8:10 ` [PATCH v2] " Gary Bisson
@ 2021-01-28  8:18   ` Marek Szyprowski
  2021-02-02 14:31   ` Tom Rini
  1 sibling, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2021-01-28  8:18 UTC (permalink / raw)
  To: u-boot

Hi,

On 28.01.2021 09:10, Gary Bisson wrote:
> Fixes issues when switching from GPT to MBR partition tables.
>
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> Changes for v2:
> - added part_init() inside write_mbr_partitions(), as suggested by
>    Heinrich
> ---
>   disk/part_dos.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/disk/part_dos.c b/disk/part_dos.c
> index f431925745c..60addc6e00d 100644
> --- a/disk/part_dos.c
> +++ b/disk/part_dos.c
> @@ -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;
>   }
>   

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] disk: part_dos: update partition table entries after write
  2021-01-28  8:10 ` [PATCH v2] " Gary Bisson
  2021-01-28  8:18   ` Marek Szyprowski
@ 2021-02-02 14:31   ` Tom Rini
  2021-06-22  2:48     ` Da Xue
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Rini @ 2021-02-02 14:31 UTC (permalink / raw)
  To: u-boot

On Thu, Jan 28, 2021 at 09:10:07AM +0100, Gary Bisson wrote:

> Fixes issues when switching from GPT to MBR partition tables.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] disk: part_dos: update partition table entries after write
  2021-02-02 14:31   ` Tom Rini
@ 2021-06-22  2:48     ` Da Xue
  2021-06-22 14:10       ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Da Xue @ 2021-06-22  2:48 UTC (permalink / raw)
  To: Tom Rini
  Cc: Gary Bisson, U-Boot Mailing List, Heinrich Schuchardt,
	Simon Glass, m.szyprowski

This breaks the build if CONFIG_CMD_MBR is enabled. Christian Melki sent a
patch but it didn't get picked up?

On Tue, Feb 2, 2021 at 9:32 AM Tom Rini <trini@konsulko.com> wrote:

> On Thu, Jan 28, 2021 at 09:10:07AM +0100, Gary Bisson wrote:
>
> > Fixes issues when switching from GPT to MBR partition tables.
> >
> > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> > Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
>
> Applied to u-boot/master, thanks!
>
> --
> Tom
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] disk: part_dos: update partition table entries after write
  2021-06-22  2:48     ` Da Xue
@ 2021-06-22 14:10       ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2021-06-22 14:10 UTC (permalink / raw)
  To: Da Xue
  Cc: Gary Bisson, U-Boot Mailing List, Heinrich Schuchardt,
	Simon Glass, m.szyprowski

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

On Mon, Jun 21, 2021 at 10:48:17PM -0400, Da Xue wrote:

> This breaks the build if CONFIG_CMD_MBR is 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.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-22 14:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 20:19 [PATCH] disk: part_dos: update partition table entries after write Gary Bisson
2021-01-27 20:56 ` Heinrich Schuchardt
2021-01-28  8:01   ` Gary Bisson
2021-01-28  8:10 ` [PATCH v2] " Gary Bisson
2021-01-28  8:18   ` Marek Szyprowski
2021-02-02 14:31   ` Tom Rini
2021-06-22  2:48     ` Da Xue
2021-06-22 14:10       ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.