2 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
4 * made from cmd_ext2, which was:
7 * esd gmbh <www.esd-electronics.com>
8 * Reinhard Arlt <reinhard.arlt@esd-electronics.com>
10 * made from cmd_reiserfs by
12 * (C) Copyright 2003 - 2004
13 * Sysgo Real-Time Solutions, AG <www.elinos.com>
14 * Pavel Bartusek <pba@sysgo.com>
16 * SPDX-License-Identifier: GPL-2.0+
25 #ifndef CONFIG_PARTITION_UUIDS
26 #error CONFIG_PARTITION_UUIDS must be enabled for CONFIG_CMD_PART to be enabled
29 int do_part_uuid(int argc, char * const argv[])
32 block_dev_desc_t *dev_desc;
33 disk_partition_t info;
40 part = get_device_and_partition(argv[0], argv[1], &dev_desc, &info, 0);
45 setenv(argv[2], info.uuid);
47 printf("%s\n", info.uuid);
52 int do_part_list(int argc, char * const argv[])
55 block_dev_desc_t *desc;
60 ret = get_device(argv[0], argv[1], &desc);
69 int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
74 if (!strcmp(argv[1], "uuid"))
75 return do_part_uuid(argc - 2, argv + 2);
76 else if (!strcmp(argv[1], "list"))
77 return do_part_list(argc - 2, argv + 2);
84 "disk partition related commands",
85 "uuid <interface> <dev>:<part>\n"
86 " - print partition UUID\n"
87 "part uuid <interface> <dev>:<part> <varname>\n"
88 " - set environment variable to partition UUID\n"
89 "part list <interface> <dev>\n"
90 " - print a device's partition table"