mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* erroneous behavior for iMX+GPT
@ 2019-10-07 14:15 Middelschulte, Leif
  2019-10-14 12:25 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Middelschulte, Leif @ 2019-10-07 14:15 UTC (permalink / raw)
  To: barebox

Hi,

setting up GPT on an iMX6, I noticed a small bug subject to CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE that leads to unparsed GPTs.

Background: The iMX supports the mmc user partition as bootmedia source too.

Problem: The (additional) filetype check[0] fails, if the given buffer contains multiple, subsequent file(type)s. The buffer might contain the beginning of a disk that contains i.e. a Barebox image
*and* a partition table. The function file_detect_type returns a single (first recognized) type[1]. In my case, it returns the Barebox image type.

There is a comment about this additional check noting it will be mandatory as it will be "[..] added to the EFI Spec. per Intel after v1.02.". Anybody can elaborate on that?
That feedback could help to understand why file_detect_partition_table is insufficient in this case.


[0] https://git.pengutronix.de/cgit/barebox/tree/common/partitions/efi.c#n372
[1] https://git.pengutronix.de/cgit/barebox/tree/common/filetype.c#n352

-- 
Kind Regards,

Leif Middelschulte
Software Development Engineer

KLS Martin GmbH + Co. KG,
A Company of the KLS Martin Group
Am Flughafen 18
79108 Freiburg, Germany

Phone +49 (761) 557 997-543
Fax   +49 (761) 557 997-520 
Web   leif.middelschulte@klsmartin.com
      www.klsmartin.com

Commercial Register: Freiburg im Breisgau HRA 4044
Managing directors: Michael Martin, Karl Leibinger, Christian Leibinger
General partner: KLS Martin Verwaltungsgesellschaft mbH
Commercial register: Stuttgart HRB 451316
Tax ID number: DE 237467280
 
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this
e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: erroneous behavior for iMX+GPT
  2019-10-07 14:15 erroneous behavior for iMX+GPT Middelschulte, Leif
@ 2019-10-14 12:25 ` Sascha Hauer
  2019-10-14 12:30   ` Middelschulte, Leif
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2019-10-14 12:25 UTC (permalink / raw)
  To: Middelschulte, Leif; +Cc: barebox

Hi Leif,

On Mon, Oct 07, 2019 at 02:15:39PM +0000, Middelschulte, Leif wrote:
> Hi,
> 
> setting up GPT on an iMX6, I noticed a small bug subject to
> CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE that leads to unparsed GPTs.
> 
> Background: The iMX supports the mmc user partition as bootmedia
> source too.
> 
> Problem: The (additional) filetype check[0] fails, if the given buffer
> contains multiple, subsequent file(type)s. The buffer might contain
> the beginning of a disk that contains i.e. a Barebox image *and* a
> partition table. The function file_detect_type returns a single (first
> recognized) type[1]. In my case, it returns the Barebox image type.

Looks like the file_detect_type() there should be replaced with
file_detect_partition_table().

> 
> There is a comment about this additional check noting it will be
> mandatory as it will be "[..] added to the EFI Spec. per Intel after
> v1.02.". Anybody can elaborate on that?
> That feedback could help to understand why file_detect_partition_table
> is insufficient in this case.

What makes you think that file_detect_partition_table() is insufficient?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: erroneous behavior for iMX+GPT
  2019-10-14 12:25 ` Sascha Hauer
@ 2019-10-14 12:30   ` Middelschulte, Leif
  2019-10-14 12:45     ` s.hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Middelschulte, Leif @ 2019-10-14 12:30 UTC (permalink / raw)
  To: s.hauer; +Cc: barebox

Hi Sascha,

Am Montag, den 14.10.2019, 14:25 +0200 schrieb Sascha Hauer:
> Hi Leif,
> 
> On Mon, Oct 07, 2019 at 02:15:39PM +0000, Middelschulte, Leif wrote:
> > Hi,
> > 
> > setting up GPT on an iMX6, I noticed a small bug subject to
> > CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE that leads to unparsed GPTs.
> > 
> > Background: The iMX supports the mmc user partition as bootmedia
> > source too.
> > 
> > Problem: The (additional) filetype check[0] fails, if the given buffer
> > contains multiple, subsequent file(type)s. The buffer might contain
> > the beginning of a disk that contains i.e. a Barebox image *and* a
> > partition table. The function file_detect_type returns a single (first
> > recognized) type[1]. In my case, it returns the Barebox image type.
> 
> Looks like the file_detect_type() there should be replaced with
> file_detect_partition_table().
> 
> > 
> > There is a comment about this additional check noting it will be
> > mandatory as it will be "[..] added to the EFI Spec. per Intel after
> > v1.02.". Anybody can elaborate on that?
> > That feedback could help to understand why file_detect_partition_table
> > is insufficient in this case.
> 
> What makes you think that file_detect_partition_table() is insufficient?
Nothing makes *me* think it's insufficient. Yet the author explicitly added this *additional* check and did *not* use the suggested alternative function.

That's why I asked. I'm not familiar with the spec. Maybe it is mandates such a treatment?
> 
> Sascha
> 

Leif
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: erroneous behavior for iMX+GPT
  2019-10-14 12:30   ` Middelschulte, Leif
@ 2019-10-14 12:45     ` s.hauer
  2019-10-14 13:02       ` Middelschulte, Leif
  0 siblings, 1 reply; 5+ messages in thread
From: s.hauer @ 2019-10-14 12:45 UTC (permalink / raw)
  To: Middelschulte, Leif; +Cc: barebox

On Mon, Oct 14, 2019 at 12:30:27PM +0000, Middelschulte, Leif wrote:
> Hi Sascha,
> 
> Am Montag, den 14.10.2019, 14:25 +0200 schrieb Sascha Hauer:
> > Hi Leif,
> > 
> > On Mon, Oct 07, 2019 at 02:15:39PM +0000, Middelschulte, Leif wrote:
> > > Hi,
> > > 
> > > setting up GPT on an iMX6, I noticed a small bug subject to
> > > CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE that leads to unparsed GPTs.
> > > 
> > > Background: The iMX supports the mmc user partition as bootmedia
> > > source too.
> > > 
> > > Problem: The (additional) filetype check[0] fails, if the given buffer
> > > contains multiple, subsequent file(type)s. The buffer might contain
> > > the beginning of a disk that contains i.e. a Barebox image *and* a
> > > partition table. The function file_detect_type returns a single (first
> > > recognized) type[1]. In my case, it returns the Barebox image type.
> > 
> > Looks like the file_detect_type() there should be replaced with
> > file_detect_partition_table().
> > 
> > > 
> > > There is a comment about this additional check noting it will be
> > > mandatory as it will be "[..] added to the EFI Spec. per Intel after
> > > v1.02.". Anybody can elaborate on that?
> > > That feedback could help to understand why file_detect_partition_table
> > > is insufficient in this case.
> > 
> > What makes you think that file_detect_partition_table() is insufficient?
> Nothing makes *me* think it's insufficient. Yet the author explicitly
> added this *additional* check and did *not* use the suggested
> alternative function.

Perhaps because file_detect_partition_table() didn't exist as the efi
partition parser was added to barebox. Also I would think that
Jean-Christophe (the original author) didn't encounter these
ambiguities. It's probably very i.MX specific that a GPT is where the
barebox header is.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: erroneous behavior for iMX+GPT
  2019-10-14 12:45     ` s.hauer
@ 2019-10-14 13:02       ` Middelschulte, Leif
  0 siblings, 0 replies; 5+ messages in thread
From: Middelschulte, Leif @ 2019-10-14 13:02 UTC (permalink / raw)
  To: s.hauer; +Cc: barebox

Am Montag, den 14.10.2019, 14:45 +0200 schrieb s.hauer@pengutronix.de:
> On Mon, Oct 14, 2019 at 12:30:27PM +0000, Middelschulte, Leif wrote:
> > Hi Sascha,
> > 
> > Am Montag, den 14.10.2019, 14:25 +0200 schrieb Sascha Hauer:
> > > Hi Leif,
> > > 
> > > On Mon, Oct 07, 2019 at 02:15:39PM +0000, Middelschulte, Leif wrote:
> > > > Hi,
> > > > 
> > > > setting up GPT on an iMX6, I noticed a small bug subject to
> > > > CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE that leads to unparsed GPTs.
> > > > 
> > > > Background: The iMX supports the mmc user partition as bootmedia
> > > > source too.
> > > > 
> > > > Problem: The (additional) filetype check[0] fails, if the given buffer
> > > > contains multiple, subsequent file(type)s. The buffer might contain
> > > > the beginning of a disk that contains i.e. a Barebox image *and* a
> > > > partition table. The function file_detect_type returns a single (first
> > > > recognized) type[1]. In my case, it returns the Barebox image type.
> > > 
> > > Looks like the file_detect_type() there should be replaced with
> > > file_detect_partition_table().
> > > 
> > > > 
> > > > There is a comment about this additional check noting it will be
> > > > mandatory as it will be "[..] added to the EFI Spec. per Intel after
> > > > v1.02.". Anybody can elaborate on that?
> > > > That feedback could help to understand why file_detect_partition_table
> > > > is insufficient in this case.
> > > 
> > > What makes you think that file_detect_partition_table() is insufficient?
> > Nothing makes *me* think it's insufficient. Yet the author explicitly
> > added this *additional* check and did *not* use the suggested
> > alternative function.
> 
> Perhaps because file_detect_partition_table() didn't exist as the efi
> partition parser was added to barebox. Also I would think that
> Jean-Christophe (the original author) didn't encounter these
> ambiguities. It's probably very i.MX specific that a GPT is where the
> barebox header is.
Fair enough. I've created a pull request[0] on GitHub that contains the suggested fix.

[0] https://github.com/saschahauer/barebox/pull/6
> 
> Sascha
> 

Leif
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-10-14 13:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 14:15 erroneous behavior for iMX+GPT Middelschulte, Leif
2019-10-14 12:25 ` Sascha Hauer
2019-10-14 12:30   ` Middelschulte, Leif
2019-10-14 12:45     ` s.hauer
2019-10-14 13:02       ` Middelschulte, Leif

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox