aboutsummaryrefslogtreecommitdiff
path: root/cmd/gpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gpt.c')
-rw-r--r--cmd/gpt.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 42e289c8724..9cc72934388 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -173,6 +173,9 @@ static int calc_parts_list_len(int numparts)
/* see part.h for definition of struct disk_partition */
partlistlen += numparts * (strlen("start=MiB,") + sizeof(lbaint_t) + 1);
partlistlen += numparts * (strlen("size=MiB,") + sizeof(lbaint_t) + 1);
+#ifdef CONFIG_PARTITION_TYPE_GUID
+ partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1);
+#endif
partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1);
/* for the terminating null */
partlistlen++;
@@ -211,6 +214,11 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info,
PART_TYPE_LEN);
newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0';
newpart->gpt_part_info.bootable = info->bootable;
+#ifdef CONFIG_PARTITION_TYPE_GUID
+ strncpy(newpart->gpt_part_info.type_guid, (const char *)info->type_guid,
+ UUID_STR_LEN);
+ newpart->gpt_part_info.type_guid[UUID_STR_LEN] = '\0';
+#endif
if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) {
strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info),
UUID_STR_LEN + 1);
@@ -250,6 +258,9 @@ static void print_gpt_info(void)
curr->gpt_part_info.name);
printf("Type %s, bootable %d\n", curr->gpt_part_info.type,
curr->gpt_part_info.bootable & PART_BOOTABLE);
+#ifdef CONFIG_PARTITION_TYPE_GUID
+ printf("Type GUID %s\n", curr->gpt_part_info.type_guid);
+#endif
#ifdef CONFIG_PARTITION_UUIDS
printf("UUID %s\n", curr->gpt_part_info.uuid);
#endif
@@ -297,6 +308,11 @@ static int create_gpt_partitions_list(int numparts, const char *guid,
curr->gpt_part_info.blksz);
strncat(partitions_list, partstr, PART_NAME_LEN + 1);
+#ifdef CONFIG_PARTITION_TYPE_GUID
+ strcat(partitions_list, ",type=");
+ strncat(partitions_list, curr->gpt_part_info.type_guid,
+ UUID_STR_LEN + 1);
+#endif
strcat(partitions_list, ",uuid=");
strncat(partitions_list, curr->gpt_part_info.uuid,
UUID_STR_LEN + 1);