
Hi Marek,
On Tue, 22 Dec 2020 at 07:09, Marek Szyprowski m.szyprowski@samsung.com wrote:
Add a 'mbr' command to let user create or verify MBR partition layout based on the provided text description. The partition layout is altearnatively read from 'mbr_parts' environment variable. This can be used in scripts to help system image flashing tools to ensure proper partition layout.
The syntax of the text description of the partition list is similar to the one used by the 'gpt' command. Supported parameters are: name (currently ignored), start (partition start offset in bytes), size (in bytes or '-' to expand it to the whole free area), bootable (boolean flag) and id (MBR partition system ID). If one wants to create more than 4 partitions, an 'Extended' primary partition (with 0x05 ID) has to be explicitely provided as a one of the first 4 entries.
Here is the example how to create a 6 partitions (3 on the 'extended volume'), some of the predefined sizes:
setenv mbr_parts 'name=boot,start=4M,size=128M,bootable,id=0x0e;
name=rootfs,size=3072M,id=0x83; name=system-data,size=512M,id=0x83; name=[ext],size=-,id=0x05; name=user,size=-,id=0x83; name=modules,size=100M,id=0x83; name=ramdisk,size=8M,id=0x83'
mbr write mmc 0
Signed-off-by: Marek Szyprowski m.szyprowski@samsung.com
cmd/Kconfig | 8 ++ cmd/Makefile | 1 + cmd/mbr.c | 314 ++++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + doc/usage/mbr.rst | 93 +++++++++++++ 5 files changed, 417 insertions(+) create mode 100644 cmd/mbr.c create mode 100644 doc/usage/mbr.rst
This looks good - is it possible to write a test for it?
Perhaps a test for str_to_partitions() and the other functions there would be a good start?
Regards, Simon