[U-Boot] [Resend RFC PATCH v1 0/3] GPT over MTD

Patrick DELAUNAY patrick.delaunay at st.com
Thu Nov 24 15:14:22 CET 2016


Hi Ladislav,

> 
> Hi,
> 
> On Tue, Nov 22, 2016 at 02:24:39PM +0100, Patrick Delaunay wrote:
> >
> > I have a request to support GPT over MTD to be able to have dynamic
> > MTD informations without u-Boot
> environment(CONFIG_ENV_IS_NOWHERE is a
> > other requirement of my project).
> 
> I'm just curious, could you provide some reasoning, why this is a
> requirement?

One platform requirement is to boot from any supported device (NOR, NAND, eMMC, ...) with the same boot chain (including SPL and U-Boot) WITHOUT recompilation and only by changing the hardware boot configuration (OTP).

So I can't use environment (CONFIG_ENV_IS_NOWHERE), because I don't know which device is expected for tests (boot from NAND,  eMMC, NOR).
PS: I agree that in final client board, the u-boot will be optimized and u-boot env could be used.

For  block device(eMMC), it is not an issue
	-  first boot stage uses the GPT header in block device,  to found, load and execute SPL and U-Boot.
                -  U-Boot Generic Distro feature is used in U-Boot to load kernel (found extlinux.conf in bootable partition)

For Flash Device, the offset for SPL and U-Boot can't be determined easily by first boot stage.
It is why GPT is re-used to save MTD partition offset without hardcoded part in first boot stage or in SPL (and without U-Boot env).
=> partition offsets are determined dynamically

So it should be easier to have the same behavior, based on GPT, for every boot device, block or flash.
And the same tools (programmer) or command in U-Boot will use to update/read every device, based on GPT header. 

> > The idea is to use the GPT header to save partitioning information
> > directly in flash device (NOR or NAND), then the MTD variables are
> > rebuild from these GPT partitions and can be used by DISTRO to search
> bootable binary.
> 
> Ok, so you stored partitioning information on flash... That seems to be some
> kind of limited environment saved :-)

Yes I use standard GPT to save partitioning information, to save offset of MTD partition in flash device.
So it is limited environment :-) but limited to partition offset and it can be discovered dynamically by first boot stage.

> > I make a first prototyping for this request but I want ask you if this
> > feature is acceptable for u-boot and if this patches, after some
> > update and cleanups, would be merged in u-boot mainline.
> > Do you see already some blocking points ?
> 
> Is there any reason why you cannot use UBI?

UBIFS will be used in U-Boot not in previous boot stage
Kernel and device tree will be found in a UBIFS volume

> > - added code is under a new CONFIG : CONFIG_EFI_PARTITION_MTD
> > - for implementation details, see doc/README.gpt.mtd
> >
> > TODO:
> > - split patch between core impact (disk/part_efi.c)
> >   and command update
> > - full support for modified command
> >   (today I limit the support for the command used by DISTRO macro)
> > - DISTRO macro update for automatic boot on GPT bootable partition
> >   found in MTD devices
> 
> Best regards,
> 	ladis

Best regards
	Patrick


More information about the U-Boot mailing list