aboutsummaryrefslogtreecommitdiff
path: root/cmd/part.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-15cmd: part: list all 128 GPT partitionsHeinrich Schuchardt1-2/+2
A GPT partition table typically has 128 entries. If a partition table contains a partition 128 'part list' should be able to list it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-07-23cmd: part: Correct error handlingAnders Dellien1-1/+1
As 'part_get_info_by_name' now returns more status codes than just -1 to indicate failure, we need to update the return value check. Signed-off-by: Anders Dellien <anders.dellien@arm.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2020-07-07cmd: part: Add subcommand to list supported partition tablesNiel Fourie1-2/+25
Add a subcommand "types" to the part command, which lists the supported partition table types. Signed-off-by: Niel Fourie <lusus@denx.de> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-18command: Remove the cmd_tbl_t typedefSimon Glass1-7/+8
We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18part: Drop disk_partition_t typedefSimon Glass1-3/+3
We should not be using typedefs and these make it harder to use forward declarations (to reduce header file inclusions). Drop the typedef. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-10-04cmd: part: number: return hexadecimal valueRoman Stratiienko1-1/+1
At this point we are using part number sub-command to retrieve UUID of the partition using it's name. e.g.: part number mmc $mmcdev system_a system_a_index part uuid mmc $mmcdev:${system_a_index} system_a_uuid Since 'part uuid' sub-command expects partition index in hex format and 'part number' returns decimal value, 'part uuid' command will provide wrong UUID or fail. Fixes: be683756f62034 ("cmd: part: Add 'number' sub-command") Cc: Dirk Behme <dirk.behme@de.bosch.com> Reported-by: Pontus Fuchs <pontus.fuchs@se.bosch.com> Signed-off-by: Roman Stratiienko <roman.stratiienko@globallogic.com> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
2019-08-11env: Move env_set() to env.hSimon Glass1-0/+1
Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24cmd: part: Add 'number' sub-commandRuslan Trofymenko1-1/+15
This sub-command serves for getting the partition index from partition name. Also it can be used to test the existence of specified partition. Use case: For example, in most CI environments 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} Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com> Reviewed-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
2018-09-10cmd: part: use MAX_SEARCH_PARTITIONS for part searchKever Yang1-1/+1
Use Macro instead of hard code. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-03-13cmd: part: Extract common code to separate functionSam Protsenko1-38/+23
Refactor the code for "part start" and "part size" commands to avoid code duplication. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-03-13cmd: part: Allow passing partition name to start and sizeSam Protsenko1-11/+25
Allow passing the partition name to "part start" and "part size" commands, so we can avoid magic numbers in the environment. Consider one real use-case: in include/environment/ti/boot.h we have commands like these: setenv boot_part 9 part start mmc ${mmcdev} ${boot_part} boot_start part size mmc ${mmcdev} ${boot_part} boot_size mmc read ${loadaddr} ${boot_start} ${boot_size} Now suppose that we have changed the partition table and boot_part now is 10. We will need to fix commands above. And anyone who relies on these boot commands, will need to change them accordingly, too (this was an actual case in our lab while testing Linux boot on Android environment). By providing the option to pass partition name instead, we fix mentioned issue, by eliminating the necessity to use magic numbers. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2017-08-16env: Rename setenv() to env_set()Simon Glass1-4/+4
We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-01-28cmd, disk: convert CONFIG_PARTITION_UUIDS, CMD_PART and CMD_GPTPatrick Delaunay1-4/+0
We convert CONFIG_PARTITION_UUIDS to Kconfig first. But in order to cleanly update all of the config files we must also update CMD_PART and CMD_GPT to also be in Kconfig in order to avoid complex logic elsewhere to update all of the config files. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay73@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2016-03-14dm: part: Rename some partition functionsSimon Glass1-4/+4
Rename three partition functions so that they start with part_. This makes it clear what they relate to. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: blk: Rename get_device_and_partition()Simon Glass1-1/+1
Rename this function to blk_get_device_part_str(). This is a better name because it makes it clear that the function returns a block device and parses a string. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: blk: Rename get_device() to blk_get_device_by_str()Simon Glass1-3/+3
The current name is too generic. The function returns a block device based on a provided string. Rename it to aid searching and make its purpose clearer. Also add a few comments. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14dm: Drop the block_dev_desc_t typedefSimon Glass1-4/+4
Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long and causes 80-column violations, rename it to struct blk_desc. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>
2016-01-25Remove the cmd_ prefix from command filesSimon Glass1-0/+216
Now that they are in their own directory, we can remove this prefix. This makes it easier to find a file since the prefix does not get in the way. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Stefan Roese <sr@denx.de> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>