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

Patrick Delaunay patrick.delaunay73 at gmail.com
Tue Nov 22 14:24:39 CET 2016


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

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.

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 ?

- 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

the current level is tested manually on sandbox with :

> make O=sandbox
> sandbox/u-boot -d sandbox/arch/sandbox/dts/test.dtb

=> sf probe
SF: Detected M25P16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB

=> setenv nor_part "name=part1,size=64KiB;name=part2,size=128KiB;\
   name=boot,type=linux,bootable,size=512KiB"
=> gpt write nor 0 $nor_part
Writing GPT: success!

=> part list nor 0
Part	Start LBA	End LBA		Name
	Attributes
	Type GUID
	Partition GUID
  1	0x00000080	0x000000ff	"part1"
	attrs:	0x0000000000000000
	type:	ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
	type:	data
	guid:	d117f98e-6f2c-0040-00b2-331a19f91cb2
  2	0x00000100	0x000001ff	"part2"
	attrs:	0x0000000000000000
	type:	ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
	type:	data
	guid:	25718777-d0ad-0000-8060-02cb591c9737
  3	0x00000200	0x000005ff	"boot"
	attrs:	0x0000000000000004
	type:	0fc63daf-8483-4772-8e79-3d69d8477de4
	type:	linux
	guid:	8a4bb8b4-e304-0040-0036-aff5c9c495b1

=> setenv mtdids "nor0=nor0"
=> setenv mtdparts "mtdparts="
=> mtdparts gpt nor0
=> mtdparts
device nor0 <nor0>, # parts = 3
 #: name		size		offset		mask_flags
 0: part1               0x00010000	0x00010000	0
 1: part2               0x00020000	0x00020000	0
 2: boot                0x00080000	0x00040000	0

active partition: nor0,0 - (part1) 0x00010000 @ 0x00010000

defaults:
mtdids  : none
mtdparts: none

=> part list nor 0 -bootable nor_boot_part
=> printenv nor_boot_part
nor_boot_part=3



Patrick Delaunay (3):
  add support of GPT partitioning over MTD
  uuid: remove dependency with io.h
  sandbox: GPT over MTD test

 Kconfig                   |  12 ++
 cmd/gpt.c                 |  98 +++++++--
 cmd/mtdparts.c            | 103 ++++++++-
 cmd/part.c                |  48 ++++-
 configs/sandbox_defconfig |   2 +
 disk/part_efi.c           | 526 +++++++++++++++++++++++++++++++++++++++++-----
 doc/README.gpt.mtd        | 189 +++++++++++++++++
 include/configs/sandbox.h |   7 +
 include/part.h            |  13 +-
 include/uuid.h            |   1 +
 lib/uuid.c                |  46 +++-
 11 files changed, 959 insertions(+), 86 deletions(-)
 create mode 100644 doc/README.gpt.mtd

-- 
1.9.1



More information about the U-Boot mailing list