1 // SPDX-License-Identifier: GPL-2.0+
3 * cmd_gpt.c -- GPT (GUID Partition Table) handling command
8 * Copyright (C) 2012 Samsung Electronics
24 #include <linux/ctype.h>
27 #include <linux/compat.h>
28 #include <linux/err.h>
29 #include <linux/sizes.h>
32 static LIST_HEAD(disk_partitions);
35 * extract_env(): Expand env name from string format '&{env_name}'
36 * and return pointer to the env (if the env is set)
38 * @param str - pointer to string
39 * @param env - pointer to pointer to extracted env
41 * Return: - zero on successful expand and env is set
43 static int extract_env(const char *str, char **env)
47 #ifdef CONFIG_RANDOM_UUID
48 char uuid_str[UUID_STR_LEN + 1];
51 if (!str || strlen(str) < 4)
54 if (!((strncmp(str, "${", 2) == 0) && (str[strlen(str) - 1] == '}')))
61 memset(s + strlen(s) - 1, '\0', 1);
62 memmove(s, s + 2, strlen(s) - 1);
66 #ifdef CONFIG_RANDOM_UUID
67 debug("%s unset. ", str);
68 gen_rand_uuid_str(uuid_str, UUID_STR_FORMAT_GUID);
73 debug("Set to random.\n");
76 debug("Can't get random UUID.\n");
79 debug("%s unset.\n", str);
82 debug("%s get from environment.\n", str);
93 * extract_val(): Extract value from a key=value pair list (comma separated).
94 * Only value for the given key is returend.
95 * Function allocates memory for the value, remember to free!
97 * @param str - pointer to string with key=values pairs
98 * @param key - pointer to the key to search for
100 * Return: - pointer to allocated string with the value
102 static char *extract_val(const char *str, const char *key)
108 strcopy = strdup(str);
120 if (strcmp(k, key) == 0) {
132 * found_key(): Found key without value in parameter list (comma separated).
134 * @param str - pointer to string with key
135 * @param key - pointer to the key to search for
137 * Return: - true on found key
139 static bool found_key(const char *str, const char *key)
145 strcopy = strdup(str);
154 if (strcmp(k, key) == 0) {
165 static int calc_parts_list_len(int numparts)
167 int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk=");
171 /* per-partition additions; numparts starts at 1, so this should be correct */
172 partlistlen += numparts * (strlen("name=,") + PART_NAME_LEN + 1);
173 /* see part.h for definition of struct disk_partition */
174 partlistlen += numparts * (strlen("start=MiB,") + sizeof(lbaint_t) + 1);
175 partlistlen += numparts * (strlen("size=MiB,") + sizeof(lbaint_t) + 1);
176 partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1);
177 /* for the terminating null */
179 debug("Length of partitions_list is %d for %d partitions\n", partlistlen,
184 #ifdef CONFIG_CMD_GPT_RENAME
185 static void del_gpt_info(void)
187 struct list_head *pos = &disk_partitions;
188 struct disk_part *curr;
189 while (!list_empty(pos)) {
190 curr = list_entry(pos->next, struct disk_part, list);
196 static struct disk_part *allocate_disk_part(struct disk_partition *info,
199 struct disk_part *newpart;
200 newpart = calloc(1, sizeof(struct disk_part));
202 return ERR_PTR(-ENOMEM);
204 newpart->gpt_part_info.start = info->start;
205 newpart->gpt_part_info.size = info->size;
206 newpart->gpt_part_info.blksz = info->blksz;
207 strncpy((char *)newpart->gpt_part_info.name, (const char *)info->name,
209 newpart->gpt_part_info.name[PART_NAME_LEN - 1] = '\0';
210 strncpy((char *)newpart->gpt_part_info.type, (const char *)info->type,
212 newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0';
213 newpart->gpt_part_info.bootable = info->bootable;
214 if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) {
215 strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info),
218 newpart->partnum = partnum;
223 static void prettyprint_part_size(char *sizestr, lbaint_t partsize,
226 unsigned long long partbytes, partmegabytes;
228 partbytes = partsize * blksize;
229 partmegabytes = lldiv(partbytes, SZ_1M);
230 snprintf(sizestr, 16, "%lluMiB", partmegabytes);
233 static void print_gpt_info(void)
235 struct list_head *pos;
236 struct disk_part *curr;
237 char partstartstr[16];
238 char partsizestr[16];
240 list_for_each(pos, &disk_partitions) {
241 curr = list_entry(pos, struct disk_part, list);
242 prettyprint_part_size(partstartstr, curr->gpt_part_info.start,
243 curr->gpt_part_info.blksz);
244 prettyprint_part_size(partsizestr, curr->gpt_part_info.size,
245 curr->gpt_part_info.blksz);
247 printf("Partition %d:\n", curr->partnum);
248 printf("Start %s, size %s\n", partstartstr, partsizestr);
249 printf("Block size %lu, name %s\n", curr->gpt_part_info.blksz,
250 curr->gpt_part_info.name);
251 printf("Type %s, bootable %d\n", curr->gpt_part_info.type,
252 curr->gpt_part_info.bootable & PART_BOOTABLE);
253 #ifdef CONFIG_PARTITION_UUIDS
254 printf("UUID %s\n", curr->gpt_part_info.uuid);
261 * create the string that upstream 'gpt write' command will accept as an
264 * From doc/README.gpt, Format of partitions layout:
265 * "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
266 * name=kernel,size=60MiB,uuid=...;"
267 * The fields 'name' and 'size' are mandatory for every partition.
268 * The field 'start' is optional. The fields 'uuid' and 'uuid_disk'
269 * are optional if CONFIG_RANDOM_UUID is enabled.
271 static int create_gpt_partitions_list(int numparts, const char *guid,
272 char *partitions_list)
274 struct list_head *pos;
275 struct disk_part *curr;
276 char partstr[PART_NAME_LEN + 1];
278 if (!partitions_list)
281 strcpy(partitions_list, "uuid_disk=");
282 strncat(partitions_list, guid, UUID_STR_LEN + 1);
283 strcat(partitions_list, ";");
285 list_for_each(pos, &disk_partitions) {
286 curr = list_entry(pos, struct disk_part, list);
287 strcat(partitions_list, "name=");
288 strncat(partitions_list, (const char *)curr->gpt_part_info.name,
290 sprintf(partstr, ",start=0x%llx",
291 (unsigned long long)curr->gpt_part_info.start *
292 curr->gpt_part_info.blksz);
293 /* one extra byte for NULL */
294 strncat(partitions_list, partstr, PART_NAME_LEN + 1);
295 sprintf(partstr, ",size=0x%llx",
296 (unsigned long long)curr->gpt_part_info.size *
297 curr->gpt_part_info.blksz);
298 strncat(partitions_list, partstr, PART_NAME_LEN + 1);
300 strcat(partitions_list, ",uuid=");
301 strncat(partitions_list, curr->gpt_part_info.uuid,
303 strcat(partitions_list, ";");
309 * read partition info into disk_partitions list where
310 * it can be printed or modified
312 static int get_gpt_info(struct blk_desc *dev_desc)
314 /* start partition numbering at 1, as U-Boot does */
315 int valid_parts = 0, p, ret;
316 struct disk_partition info;
317 struct disk_part *new_disk_part;
320 * Always re-read partition info from device, in case
323 INIT_LIST_HEAD(&disk_partitions);
325 for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
326 ret = part_get_info(dev_desc, p, &info);
330 /* Add 1 here because counter is zero-based but p1 is
331 the first partition */
332 new_disk_part = allocate_disk_part(&info, valid_parts+1);
333 if (IS_ERR(new_disk_part))
336 list_add_tail(&new_disk_part->list, &disk_partitions);
339 if (valid_parts == 0) {
340 printf("** No valid partitions found **\n");
345 if (valid_parts >= 1)
350 /* a wrapper to test get_gpt_info */
351 static int do_get_gpt_info(struct blk_desc *dev_desc, char * const namestr)
355 numparts = get_gpt_info(dev_desc);
359 char disk_guid[UUID_STR_LEN + 1];
360 char *partitions_list;
364 ret = get_disk_guid(dev_desc, disk_guid);
368 partlistlen = calc_parts_list_len(numparts);
369 partitions_list = malloc(partlistlen);
370 if (!partitions_list) {
374 memset(partitions_list, '\0', partlistlen);
376 ret = create_gpt_partitions_list(numparts, disk_guid,
379 printf("Error: Could not create partition list string!\n");
381 env_set(namestr, partitions_list);
383 free(partitions_list);
395 * set_gpt_info(): Fill partition information from string
396 * function allocates memory, remember to free!
398 * @param dev_desc - pointer block device descriptor
399 * @param str_part - pointer to string with partition information
400 * @param str_disk_guid - pointer to pointer to allocated string with disk guid
401 * @param partitions - pointer to pointer to allocated partitions array
402 * @param parts_count - number of partitions
404 * Return: - zero on success, otherwise error
407 static int set_gpt_info(struct blk_desc *dev_desc,
408 const char *str_part,
409 char **str_disk_guid,
410 struct disk_partition **partitions,
417 struct disk_partition *parts;
419 uint64_t size_ll, start_ll;
421 int max_str_part = calc_parts_list_len(MAX_SEARCH_PARTITIONS);
423 debug("%s: lba num: 0x%x %d\n", __func__,
424 (unsigned int)dev_desc->lba, (unsigned int)dev_desc->lba);
426 if (str_part == NULL)
429 str = strdup(str_part);
433 /* extract disk guid */
435 val = extract_val(str, "uuid_disk");
437 #ifdef CONFIG_RANDOM_UUID
438 *str_disk_guid = malloc(UUID_STR_LEN + 1);
439 if (*str_disk_guid == NULL)
441 gen_rand_uuid_str(*str_disk_guid, UUID_STR_FORMAT_STD);
447 val = strsep(&val, ";");
448 if (extract_env(val, &p))
450 *str_disk_guid = strdup(p);
452 /* Move s to first partition */
456 printf("Error: is the partitions string NULL-terminated?\n");
459 if (strnlen(s, max_str_part) == 0)
462 i = strnlen(s, max_str_part) - 1;
466 /* calculate expected number of partitions */
474 /* allocate memory for partitions */
475 parts = calloc(sizeof(struct disk_partition), p_count);
479 /* retrieve partitions data from string */
480 for (i = 0; i < p_count; i++) {
481 tok = strsep(&s, ";");
487 val = extract_val(tok, "uuid");
489 /* 'uuid' is optional if random uuid's are enabled */
490 #ifdef CONFIG_RANDOM_UUID
491 gen_rand_uuid_str(parts[i].uuid, UUID_STR_FORMAT_STD);
497 if (extract_env(val, &p))
499 if (strnlen(p, max_str_part) >= sizeof(parts[i].uuid)) {
500 printf("Wrong uuid format for partition %d\n", i);
504 strncpy((char *)parts[i].uuid, p, max_str_part);
507 #ifdef CONFIG_PARTITION_TYPE_GUID
509 val = extract_val(tok, "type");
511 /* 'type' is optional */
512 if (extract_env(val, &p))
514 if (strnlen(p, max_str_part) >= sizeof(parts[i].type_guid)) {
515 printf("Wrong type guid format for partition %d\n",
520 strncpy((char *)parts[i].type_guid, p, max_str_part);
525 val = extract_val(tok, "name");
526 if (!val) { /* name is mandatory */
530 if (extract_env(val, &p))
532 if (strnlen(p, max_str_part) >= sizeof(parts[i].name)) {
536 strncpy((char *)parts[i].name, p, max_str_part);
540 val = extract_val(tok, "size");
541 if (!val) { /* 'size' is mandatory */
545 if (extract_env(val, &p))
547 if ((strcmp(p, "-") == 0)) {
548 /* Let part efi module to auto extend the size */
551 size_ll = ustrtoull(p, &p, 0);
552 parts[i].size = lldiv(size_ll, dev_desc->blksz);
558 val = extract_val(tok, "start");
559 if (val) { /* start address is optional */
560 if (extract_env(val, &p))
562 start_ll = ustrtoull(p, &p, 0);
563 parts[i].start = lldiv(start_ll, dev_desc->blksz);
567 offset += parts[i].size + parts[i].start;
570 if (found_key(tok, "bootable"))
571 parts[i].bootable = PART_BOOTABLE;
574 *parts_count = p_count;
581 free(*str_disk_guid);
587 static int gpt_repair(struct blk_desc *blk_dev_desc)
591 ret = gpt_repair_headers(blk_dev_desc);
596 static int gpt_default(struct blk_desc *blk_dev_desc, const char *str_part)
601 struct disk_partition *partitions = NULL;
603 /* fill partitions */
604 ret = set_gpt_info(blk_dev_desc, str_part,
605 &str_disk_guid, &partitions, &part_count);
608 printf("No partition list provided\n");
610 printf("Missing disk guid\n");
611 if ((ret == -3) || (ret == -4))
612 printf("Partition list incomplete\n");
616 /* save partitions layout to disk */
617 ret = gpt_restore(blk_dev_desc, str_disk_guid, partitions, part_count);
624 static int gpt_verify(struct blk_desc *blk_dev_desc, const char *str_part)
626 ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1,
627 blk_dev_desc->blksz);
628 struct disk_partition *partitions = NULL;
629 gpt_entry *gpt_pte = NULL;
634 /* fill partitions */
635 ret = set_gpt_info(blk_dev_desc, str_part,
636 &str_disk_guid, &partitions, &part_count);
639 printf("No partition list provided - only basic check\n");
640 ret = gpt_verify_headers(blk_dev_desc, gpt_head,
645 printf("Missing disk guid\n");
646 if ((ret == -3) || (ret == -4))
647 printf("Partition list incomplete\n");
651 /* Check partition layout with provided pattern */
652 ret = gpt_verify_partitions(blk_dev_desc, partitions, part_count,
662 * gpt_enumerate() - Enumerate partition names into environment variable.
664 * Enumerate partition names. Partition names are stored in gpt_partition_list
665 * environment variable. Each partition name is delimited by space.
667 * @desc: block device descriptor
669 * @Return: '0' on success and -ve error on failure
671 static int gpt_enumerate(struct blk_desc *desc)
673 struct part_driver *first_drv, *part_drv;
674 int str_len = 0, tmp_len;
675 char part_list[2048];
680 n_drvs = part_driver_get_count();
682 printf("Failed to get partition driver count\n");
686 first_drv = part_driver_get_first();
687 for (part_drv = first_drv; part_drv != first_drv + n_drvs; part_drv++) {
688 struct disk_partition pinfo;
692 if (part_drv->test(desc))
695 for (i = 1; i < part_drv->max_entries; i++) {
696 ret = part_drv->get_info(desc, i, &pinfo);
700 ptr = &part_list[str_len];
701 tmp_len = strlen((const char *)pinfo.name);
705 if (str_len > sizeof(part_list)) {
706 printf("Error insufficient memory\n");
709 strcpy(ptr, (const char *)pinfo.name);
710 /* One byte for space(" ") delimiter */
714 part_list[strlen(part_list) - 1] = 0;
717 debug("setenv gpt_partition_list %s\n", part_list);
719 return env_set("gpt_partition_list", part_list);
723 * gpt_setenv_part_variables() - setup partition environmental variables
725 * Setup the gpt_partition_name, gpt_partition_entry, gpt_partition_addr
726 * and gpt_partition_size environment variables.
728 * @pinfo: pointer to disk partition
729 * @i: partition entry
731 * @Return: '0' on success and -ENOENT on failure
733 static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i)
737 ret = env_set_hex("gpt_partition_addr", pinfo->start);
741 ret = env_set_hex("gpt_partition_size", pinfo->size);
745 ret = env_set_hex("gpt_partition_entry", i);
749 ret = env_set("gpt_partition_name", (const char *)pinfo->name);
760 * gpt_setenv() - Dynamically setup environment variables.
762 * Dynamically setup environment variables for name, index, offset and size
763 * for partition in GPT table after running "gpt setenv" for a partition name.
765 * @desc: block device descriptor
766 * @name: partition name
768 * @Return: '0' on success and -ve err on failure
770 static int gpt_setenv(struct blk_desc *desc, const char *name)
772 struct part_driver *first_drv, *part_drv;
776 n_drvs = part_driver_get_count();
778 printf("Failed to get partition driver count\n");
782 first_drv = part_driver_get_first();
783 for (part_drv = first_drv; part_drv != first_drv + n_drvs; part_drv++) {
784 struct disk_partition pinfo;
787 for (i = 1; i < part_drv->max_entries; i++) {
788 ret = part_drv->get_info(desc, i, &pinfo);
792 if (!strcmp(name, (const char *)pinfo.name)) {
793 /* match found, setup environment variables */
794 ret = gpt_setenv_part_variables(&pinfo, i);
807 static int do_disk_guid(struct blk_desc *dev_desc, char * const namestr)
810 char disk_guid[UUID_STR_LEN + 1];
812 ret = get_disk_guid(dev_desc, disk_guid);
814 return CMD_RET_FAILURE;
817 env_set(namestr, disk_guid);
819 printf("%s\n", disk_guid);
824 #ifdef CONFIG_CMD_GPT_RENAME
825 static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm,
826 char *name1, char *name2)
828 struct list_head *pos;
829 struct disk_part *curr;
830 struct disk_partition *new_partitions = NULL;
831 char disk_guid[UUID_STR_LEN + 1];
832 char *partitions_list, *str_disk_guid = NULL;
834 int partlistlen, ret, numparts = 0, partnum, i = 1, ctr1 = 0, ctr2 = 0;
836 if ((subcomm == NULL) || (name1 == NULL) || (name2 == NULL) ||
837 (strcmp(subcomm, "swap") && (strcmp(subcomm, "rename"))))
840 ret = get_disk_guid(dev_desc, disk_guid);
844 * Allocates disk_partitions, requiring matching call to del_gpt_info()
847 numparts = get_gpt_info(dev_desc);
849 return numparts ? numparts : -ENODEV;
851 partlistlen = calc_parts_list_len(numparts);
852 partitions_list = malloc(partlistlen);
853 if (!partitions_list) {
857 memset(partitions_list, '\0', partlistlen);
859 ret = create_gpt_partitions_list(numparts, disk_guid, partitions_list);
861 free(partitions_list);
865 * Uncomment the following line to print a string that 'gpt write'
866 * or 'gpt verify' will accept as input.
868 debug("OLD partitions_list is %s with %u chars\n", partitions_list,
869 (unsigned)strlen(partitions_list));
871 /* set_gpt_info allocates new_partitions and str_disk_guid */
872 ret = set_gpt_info(dev_desc, partitions_list, &str_disk_guid,
873 &new_partitions, &part_count);
877 if (!strcmp(subcomm, "swap")) {
878 if ((strlen(name1) > PART_NAME_LEN) || (strlen(name2) > PART_NAME_LEN)) {
879 printf("Names longer than %d characters are truncated.\n", PART_NAME_LEN);
883 list_for_each(pos, &disk_partitions) {
884 curr = list_entry(pos, struct disk_part, list);
885 if (!strcmp((char *)curr->gpt_part_info.name, name1)) {
886 strcpy((char *)curr->gpt_part_info.name, name2);
888 } else if (!strcmp((char *)curr->gpt_part_info.name, name2)) {
889 strcpy((char *)curr->gpt_part_info.name, name1);
893 if ((ctr1 + ctr2 < 2) || (ctr1 != ctr2)) {
894 printf("Cannot swap partition names except in pairs.\n");
898 } else { /* rename */
899 if (strlen(name2) > PART_NAME_LEN) {
900 printf("Names longer than %d characters are truncated.\n", PART_NAME_LEN);
904 partnum = (int)simple_strtol(name1, NULL, 10);
905 if ((partnum < 0) || (partnum > numparts)) {
906 printf("Illegal partition number %s\n", name1);
910 ret = part_get_info(dev_desc, partnum, new_partitions);
914 /* U-Boot partition numbering starts at 1 */
915 list_for_each(pos, &disk_partitions) {
916 curr = list_entry(pos, struct disk_part, list);
918 strcpy((char *)curr->gpt_part_info.name, name2);
925 ret = create_gpt_partitions_list(numparts, disk_guid, partitions_list);
928 debug("NEW partitions_list is %s with %u chars\n", partitions_list,
929 (unsigned)strlen(partitions_list));
931 ret = set_gpt_info(dev_desc, partitions_list, &str_disk_guid,
932 &new_partitions, &part_count);
934 * Even though valid pointers are here passed into set_gpt_info(),
935 * it mallocs again, and there's no way to tell which failed.
940 debug("Writing new partition table\n");
941 ret = gpt_restore(dev_desc, disk_guid, new_partitions, numparts);
943 printf("Writing new partition table failed\n");
947 debug("Reading back new partition table\n");
949 * Empty the existing disk_partitions list, as otherwise the memory in
950 * the original list is unreachable.
953 numparts = get_gpt_info(dev_desc);
955 ret = numparts ? numparts : -ENODEV;
958 printf("new partition table with %d partitions is:\n", numparts);
962 #ifdef CONFIG_RANDOM_UUID
965 free(new_partitions);
966 free(partitions_list);
972 * do_gpt(): Perform GPT operations
974 * @param cmdtp - command name
979 * Return: zero on success; otherwise error
981 static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
983 int ret = CMD_RET_SUCCESS;
986 struct blk_desc *blk_dev_desc = NULL;
988 #ifndef CONFIG_CMD_GPT_RENAME
989 if (argc < 4 || argc > 5)
991 if (argc < 4 || argc > 6)
993 return CMD_RET_USAGE;
995 dev = (int)dectoul(argv[3], &ep);
996 if (!ep || ep[0] != '\0') {
997 printf("'%s' is not a number\n", argv[3]);
998 return CMD_RET_USAGE;
1000 blk_dev_desc = blk_get_dev(argv[2], dev);
1001 if (!blk_dev_desc) {
1002 printf("%s: %s dev %d NOT available\n",
1003 __func__, argv[2], dev);
1004 return CMD_RET_FAILURE;
1007 if (strcmp(argv[1], "repair") == 0) {
1008 printf("Repairing GPT: ");
1009 ret = gpt_repair(blk_dev_desc);
1010 } else if ((strcmp(argv[1], "write") == 0) && (argc == 5)) {
1011 printf("Writing GPT: ");
1012 ret = gpt_default(blk_dev_desc, argv[4]);
1013 } else if ((strcmp(argv[1], "verify") == 0)) {
1014 ret = gpt_verify(blk_dev_desc, argv[4]);
1015 printf("Verify GPT: ");
1016 } else if ((strcmp(argv[1], "setenv") == 0)) {
1017 ret = gpt_setenv(blk_dev_desc, argv[4]);
1018 } else if ((strcmp(argv[1], "enumerate") == 0)) {
1019 ret = gpt_enumerate(blk_dev_desc);
1020 } else if (strcmp(argv[1], "guid") == 0) {
1021 ret = do_disk_guid(blk_dev_desc, argv[4]);
1022 #ifdef CONFIG_CMD_GPT_RENAME
1023 } else if (strcmp(argv[1], "read") == 0) {
1024 ret = do_get_gpt_info(blk_dev_desc, (argc == 5) ? argv[4] : NULL);
1025 } else if ((strcmp(argv[1], "swap") == 0) ||
1026 (strcmp(argv[1], "rename") == 0)) {
1027 ret = do_rename_gpt_parts(blk_dev_desc, argv[1], argv[4], argv[5]);
1030 return CMD_RET_USAGE;
1035 return CMD_RET_FAILURE;
1038 printf("success!\n");
1039 return CMD_RET_SUCCESS;
1042 U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
1043 "GUID Partition Table",
1044 "<command> <interface> <dev> <partitions_list>\n"
1045 " - GUID partition table restoration and validity check\n"
1046 " Restore or verify GPT information on a device connected\n"
1049 " gpt repair mmc 0\n"
1050 " - repair the GPT on the device\n"
1051 " gpt write mmc 0 $partitions\n"
1052 " - write the GPT to device\n"
1053 " gpt verify mmc 0 $partitions\n"
1054 " - verify the GPT on device against $partitions\n"
1055 " gpt setenv mmc 0 $name\n"
1056 " - setup environment variables for partition $name:\n"
1057 " gpt_partition_addr, gpt_partition_size,\n"
1058 " gpt_partition_name, gpt_partition_entry\n"
1059 " gpt enumerate mmc 0\n"
1060 " - store list of partitions to gpt_partition_list environment variable\n"
1061 " gpt guid <interface> <dev>\n"
1062 " - print disk GUID\n"
1063 " gpt guid <interface> <dev> <varname>\n"
1064 " - set environment variable to disk GUID\n"
1067 " gpt guid mmc 0 varname\n"
1068 #ifdef CONFIG_CMD_GPT_RENAME
1069 "gpt partition renaming commands:\n"
1070 " gpt read <interface> <dev> [<varname>]\n"
1071 " - read GPT into a data structure for manipulation\n"
1072 " - read GPT partitions into environment variable\n"
1073 " gpt swap <interface> <dev> <name1> <name2>\n"
1074 " - change all partitions named name1 to name2\n"
1076 " gpt rename <interface> <dev> <part> <name>\n"
1077 " - rename the specified partition\n"
1079 " gpt swap mmc 0 foo bar\n"
1080 " gpt rename mmc 0 3 foo\n"