[U-Boot] [PATCH v4 0/2] Extend 'part' cmd and C API to get part info

Igor Opaniuk igor.opaniuk at gmail.com
Fri Jun 14 13:04:52 UTC 2019


This patch-series extends `part` cmd and disk/part C API for getting
partition info by it's name:

1. part "number" sub-command serves for getting the partition index from
partition name. Also it can be used to test the existence of specified
partition.

2. Introduces part_get_info_by_dev_and_name_or_num() function which
allows us to get partition info from its number or name. Partition of
interest is specified by string like "device_num:partition_number" or
"device_num#partition_name".

Initially these patches were a part of
"android: implement A/B boot process" [1] patch-series, but then
due to multiple requests decided to send it separately, while the
work on A/B series is still in progress.


Use case:

For example, in Linaro Lab this U-Boot command for automatic testing
of Linux rootfs is used:

    => setenv bootpart 1:f

where 0xf is "userdata" partition. But the number of "userdata"
partition can be changed any time, when partition table is changed.

So it would be nice to get rid of that 0xf magic number and use
partition name instead, like this:

    => part number mmc 1 userdata part_num
    => setenv bootpart 1:${part_num}


[1] https://patchwork.ozlabs.org/cover/1044152/

Ruslan Trofymenko (2):
  cmd: part: Add 'number' sub-command
  disk: part: Extend API to get partition info

 cmd/part.c     | 16 +++++++++++-
 disk/part.c    | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/part.h | 21 ++++++++++++++++
 3 files changed, 104 insertions(+), 1 deletion(-)

--
2.17.1



More information about the U-Boot mailing list