Skip to content

RFC GPT over MTD

Patrick Delaunay u-boot 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest8 patches 0 repliesNew
  2. v1 RFC3 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- split serie to reduce patches size
(seperate disk part and cmd impact and add precursor patch)
- split large function

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8uuid: add function for GUID string parsinginclude/uuid.h lib/uuid.c+34 -01 reply
2/8disk: part: refactor to prepare GPT over MTDdisk/part_efi.c+65 -501 reply
3/8disk: part: add support of GPT partitioning over MTDKconfig disk/part_efi.c doc/README.gpt.mtd +1 more+657 -21 reply
4/8cmd: gpt: update command to support GPT over MTDcmd/gpt.c+82 -161 reply
5/8cmd: part: update command to support GPT over MTDcmd/part.c+39 -91 reply
6/8cmd: mtdparts: update command to support GPT over MTDcmd/mtdparts.c+119 -21 reply
7/8uuid: remove dependency with io.hlib/uuid.c+6 -70 replies
8/8sandbox: GPT over MTD testconfigs/sandbox_defconfig include/configs/sandbox.h+9 -01 reply

Reviews trailers per patch

4 of 8 patches have a Reviewed-by or Acked-by.

PatchSimon Glass
1/8R-b
2/8
3/8
4/8
5/8R-b
6/8R-b
7/8
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [U-Boot] [RFC PATCH v2 0/8] GPT over MTD

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:
- full support for modified command
today I limit the support for the command used by DISTRO macro:
+ gpt write
+ part list
- DISTRO macro update for automatic boot on GPT bootable partition found in MTD devices

the current level is tested manually on sandbox with :

Quoted 2 lines

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

test filtering feature (can be used to mask some partitions to linux according the GUID)
1/ only add MTD for some guid = linux
2/ then add MTD for some guid = data

=> mtdparts delall
=> setenv mtdparts "mtdparts="
=> setenv mtdids "nor0=nor0"
=> mtdparts gpt nor0 linux
=> mtdparts

device nor0 <nor0>, # parts = 1
#: name size offset mask_flags
0: boot 0x00080000 0x00040000 0

active partition: nor0,0 - (boot) 0x00080000 @ 0x00040000

defaults:
mtdids : none
mtdparts: none

=> mtdparts gpt nor0 data
=> 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,2 - (boot) 0x00080000 @ 0x00040000

defaults:
mtdids : none
mtdparts: none

Changes in v2:
- split serie to reduce patches size
(seperate disk part and cmd impact and add precursor patch)
- split large function

Patrick Delaunay (8):
uuid: add function for GUID string parsing
disk: part: refactor to prepare GPT over MTD
disk: part: add support of GPT partitioning over MTD
cmd: gpt: update command to support GPT over MTD
cmd: part: update command to support GPT over MTD
cmd: mtdparts: update command to support GPT over MTD
uuid: remove dependency with io.h
sandbox: GPT over MTD test

 Kconfig                   |  12 +
 cmd/gpt.c                 |  98 ++++++--
 cmd/mtdparts.c            | 121 +++++++++-
 cmd/part.c                |  48 +++-
 configs/sandbox_defconfig |   2 +
 disk/part_efi.c           | 560 +++++++++++++++++++++++++++++++++++++++++-----
 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, 1011 insertions(+), 86 deletions(-)
 create mode 100644 doc/README.gpt.mtd
Signature · 1 line
1.9.1