part_efi: interpret UUID text as GUID

This patch from Digi u-boot source code

There is an inconsistency in U-Boot v2015.04 handling unique
identifiers.
The binary data may be read out into strings as GUID format, but the
'gpt'
command expects strings to be passed in UUID format.

When partitions info is written with 'gpt' in v2015.04 using the UUID
string stored in an environment variable, for example:
 - $part1_uuid=43f1961b-ce4c-4e6c-8f22-2230c5d532bd
  - gpt write mmc 0
  "...start=2MiB,name=linux,size=64MiB,uuid=${part1_uuid}..."
  then reading out the UUID with the part command will return:
   - part uuid mmc 0:1
      1b96f143-4cce-6c4e-8f22-2230c5d532bd
      which is the same string in UUID string representation. This,
      however,
      cannot be string compared to the value in the variable.

      This commit does not try to resolve the inconsistency of uuid/guid
      naming
      and handling in U-Boot source code, but rather maintain the
      backwards
      compatibility with the UUID was written and interpreted.
This commit is contained in:
SteveChen
2018-04-26 22:31:02 +08:00
parent a768050f5f
commit c0fce23730

View File

@ -482,7 +482,7 @@ int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
str_uuid = partitions[i].uuid;
bin_uuid = gpt_e[i].unique_partition_guid.b;
if (uuid_str_to_bin(str_uuid, bin_uuid, UUID_STR_FORMAT_STD)) {
if (uuid_str_to_bin(str_uuid, bin_uuid, UUID_STR_FORMAT_GUID)) {
printf("Partition no. %d: invalid guid: %s\n",
i, str_uuid);
return -1;