[U-Boot] [PATCH v5 00/16] GPT over MTD
Patrick Delaunay
patrick.delaunay at st.com
Thu Apr 13 09:52:38 UTC 2017
I have a request to support GPT over MTD to have the MTD informations
without U-Boot environment(CONFIG_ENV_IS_NOWHERE is a other requirement
of my project to manage several board configuration with
the same defconfig; boot from NAND or NOR or SDCARD).
The current idea is to use the GPT header format to save the partitioning
information directly in flash device (NOR or NAND), then the U-Boot MTD
variables are rebuild from these GPT partitions and can be used by DISTRO
command to search bootable binary.
This information are directly used by BootRom to locate and load
the first bootstage.
The added code is under a new CONFIG : CONFIG_EFI_PARTITION_MTD
and in the new file "disk/part_efi_mtd.c"
For implementation details, see doc/README.gpt.mtd
TODO: full support for modified command (if needed)
today I limit the support for the command expected
used by DISTRO macro:
+ gpt write
+ part list
PLANNED: DISTRO macro update for automatic boot on GPT bootable partition
found in MTD devices
=> as it is needed for my project, I will propose an other patch when
this on will be accepted
the current level is tested manually on sandbox with :
> make O=sandbox sandbox_defconfig
> make O=sandbox
> dd if=/dev/zero of=spi.bin bs=1M count=4
> 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 v5:
- rebase of the top of latest u-boot master
- solve warning and error
(dont' include linux/mtd/mtd.h in part.h)
Changes in v4:
- change RFC to PATCH
- update cover letter
- rebase on v2017.03
Changes in v3:
- solve issue in compute partition_entry_lba update :
missing / lba_size
- rework and split patches for unrelated change after review
from Cristophe Kerello and Simon Glass
- rebase on v2017.03-rc1
Changes in v2:
- split serie to reduce patches size
(separate disk part and cmd impact and add precursor patch)
- split large function
Patrick Delaunay (16):
uuid: add a function for GUID string parsing
disk: part: refactor part_print_efi to prepare GPT over MTD
disk: part: refactor part_get_info_efi to prepare GPT over MTD
disk: part: prepare_backup_gpt_header rework
disk: part: compute partition_entry_lba
disk: part: efi: export internal function
disk: part: add support of GPT partitioning over MTD
cmd: gpt: remove blk_desc parameter in static function
cmd: gpt: use error number in set_gpt_info
cmd: gpt: add print_gpt_info_err
cmd: gpt: update write command to support GPT over MTD
cmd: part: update command to support GPT over MTD
cmd: mtdparts: move PART_ADD_DESC_MAXLEN
cmd: mtdparts: update command to support GPT over MTD
uuid: remove dependency with io.h
sandbox: GPT over MTD test
cmd/gpt.c | 128 +++++++++----
cmd/mtdparts.c | 144 ++++++++++++++-
cmd/part.c | 49 ++++-
configs/sandbox_defconfig | 3 +
disk/Kconfig | 17 ++
disk/Makefile | 1 +
disk/part_efi.c | 140 +++++++-------
disk/part_efi_int.h | 36 ++++
disk/part_efi_mtd.c | 457 ++++++++++++++++++++++++++++++++++++++++++++++
doc/README.gpt.mtd | 189 +++++++++++++++++++
include/configs/sandbox.h | 6 +
include/part.h | 15 +-
include/uuid.h | 1 +
lib/uuid.c | 48 ++++-
14 files changed, 1111 insertions(+), 123 deletions(-)
create mode 100644 disk/part_efi_int.h
create mode 100644 disk/part_efi_mtd.c
create mode 100644 doc/README.gpt.mtd
--
1.9.1
More information about the U-Boot
mailing list