part: efi: use BOOT_PART_TYPE symbol
PATCH 1/1 part: efi: use BOOT_PART_TYPE symbol
From: Denis Mukhin <[email protected]>
Use existing BOOT_PART_TYPE symbol instead of open-coded "U-Boot".
--- disk/part_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
disk/part_efi.c +1 -1
@@ -304,7 +304,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,snprintf ((char *)info->name,sizeof (info->name),"%s" ,print_efiname (&gpt_pte)); -strcpy ((char *)info->type,"U-Boot" ); +strcpy ((char *)info->type,BOOT_PART_TYPE ); info->bootable =get_bootable (&gpt_pte); info->type_flags = gpt_pte.attributes.fields.type_guid_specific;if (CONFIG_IS_ENABLED (PARTITION_UUIDS )) {
Signature · 1 line
2.54.0
Quoted 14 lines · Denis Mukhin via U-Boot
From: Denis Mukhin <[email protected]>
Use existing
BOOT_PART_TYPEsymbol instead of open-coded "U-Boot".Signed-off-by Denis Mukhin <[email protected]>--- disk/part_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)disk/part_efi.c +0
-0
disk/part_efi.c static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part, · line 307
Quoted 5 lines
disk/part_efi.c +1
-1@@ -304,7 +304,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,snprintf ((char *)info->name,sizeof (info->name),"%s" ,print_efiname (&gpt_pte)); -strcpy ((char *)info->type,"U-Boot" ); +strcpy ((char *)info->type,BOOT_PART_TYPE );
Thank you for looking into the value of this field which unfortunately is not well described in include/part.h. It is used in print_gpt_info() to print a user readable description of the partition type.
=> gpt read host 0
Partition 1:
Start 1MiB, size 62MiB
Block size 512, name Linux filesystem
Type U-Boot, bootable 0
UUID d3f19932-f3fb-408a-81dc-fadb4438ed5a
Type GUID c12a7328-f81f-11d2-ba4b-00a0c93ec93b
The constant BOOT_PART_TYPE is unrelated to the field type. It is used to define a linker generated list.
The value "U-Boot" itself looks wrong:
For a Mac partition we would expect values like "Apple_HFS", "Apple_Driver".
For an Amiga partition we would see for example "DOS\0", "PDS\0", "SFS\0", "LNX\0", "MAC\0", "MDS\0".
For a GPT partition we should have a string representing the partition type depending on the partition type GUID.
If CONFIG_PARTITION_TYPE_GUID=y and CONFIG_LIB_UUID=y, we can use uuid_guid_get_str() to get the correct value, how about:
disk/part_efi.c +3 -1
@@ -304,7 +304,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,snprintf ((char *)info->name,sizeof (info->name),"%s" ,print_efiname (&gpt_pte)); -strcpy ((char *)info->type,"U-Boot" ); +strcpy ((char *)info->type,"gpt" ); info->bootable =get_bootable (&gpt_pte); info->type_flags = gpt_pte.attributes.fields.type_guid_specific;if (CONFIG_IS_ENABLED (PARTITION_UUIDS )) {
@@ -316,6 +316,8 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,uuid_bin_to_str (gpt_pte.partition_type_guid.b, (char *)disk_partition_type_guid (info),UUID_STR_FORMAT_GUID ); +snprintf ((char *)info->type,sizeof (info->type),"%pUs" , + gpt_pte.partition_type_guid.b); } log_debug("start 0x" LBAF ", size 0x" LBAF ", name %s\n",
info->start,
test/py/tests/test_gpt.py might need to be adjusted too.
Best regards
Heinrich
Quoted 3 lines
disk/part_efi.c +0
-0info->bootable =get_bootable (&gpt_pte); info->type_flags = gpt_pte.attributes.fields.type_guid_specific;if (CONFIG_IS_ENABLED (PARTITION_UUIDS )) {
Quoted 39 lines · Heinrich Schuchardt via U-Boot
Quoted 14 lines · Denis Mukhin via U-Boot
From: Denis Mukhin <[email protected]>
Use existing
BOOT_PART_TYPEsymbol instead of open-coded "U-Boot".Signed-off-by Denis Mukhin <[email protected]>--- disk/part_efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)disk/part_efi.c +0
-0disk/part_efi.c static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part, · line 306
Quoted 4 lines
disk/part_efi.c +1
-1@@ -304,7 +304,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part,snprintf ((char *)info->name,sizeof (info->name),"%s" ,print_efiname (&gpt_pte)); -strcpy ((char *)info->type,"U-Boot" ); +strcpy ((char *)info->type,BOOT_PART_TYPE );Thank you for looking into the value of this field which unfortunately is not well described in
include/part.h. It is used inprint_gpt_info()to print a user readable description of the partition type.=> gpt read host 0
Partition 1:
Start 1MiB, size 62MiB
Block size 512, name Linux filesystem
Type U-Boot, bootable 0
UUID d3f19932-f3fb-408a-81dc-fadb4438ed5a
Type GUID c12a7328-f81f-11d2-ba4b-00a0c93ec93bThe constant
BOOT_PART_TYPEis unrelated to the field type. It is used to define a linker generated list.The value "U-Boot" itself looks wrong:
For a Mac partition we would expect values like "
Apple_HFS", "Apple_Driver".
Quoted 8 lines
For an Amiga partition we would see for example "DOS\0", "PDS\0", "SFS\0", "LNX\0", "MAC\0", "MDS\0".
For a GPT partition we should have a string representing the partition type depending on the partition type GUID.
If
CONFIG_PARTITION_TYPE_GUID=yandCONFIG_LIB_UUID=y, we can useuuid_guid_get_str()to get the correct value, how about:
Thanks for taking a look!
I will check that path.
Quoted 37 lines
disk/part_efi.c +1
-1@@ -304,7 +304,7 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part, snprintf((char *)info->name, sizeof(info->name), "%s", print_efiname(&gpt_pte)); -strcpy ((char *)info->type,"U-Boot" ); +strcpy ((char *)info->type,"gpt" ); info->bootable =get_bootable (&gpt_pte); info->type_flags = gpt_pte.attributes.fields.type_guid_specific;if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {disk/part_efi.c +2
-0@@ -316,6 +316,8 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part, uuid_bin_to_str(gpt_pte.partition_type_guid.b, (char *)disk_partition_type_guid (info ),UUID_STR_FORMAT_GUID ); +snprintf ((char *)info->type,sizeof (info->type),"%pUs" , + gpt_pte.partition_type_guid.b); }log_debug("start 0x" LBAF ", size 0x" LBAF ", name %s\n",
info->start,
test/py/tests/test_gpt.pymight need to be adjusted too.Best regards
Heinrich
Quoted 3 lines
disk/part_efi.c +0
-0info->bootable =get_bootable (&gpt_pte); info->type_flags = gpt_pte.attributes.fields.type_guid_specific;if (CONFIG_IS_ENABLED (PARTITION_UUIDS )) {