[PATCH] efi_loader: set partition GUID in device path for SIG_TYPE_GUID

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Jul 18 11:07:08 CEST 2021


On 15.07.21 15:31, Alfonso Sánchez-Beato wrote:
> Previously, the GPT device GUID was being used instead of the partition,
> which was incorrect.
>
> Signed-off-by: Alfonso Sánchez-Beato <alfonso.sanchez-beato at canonical.com>
> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>

Building fails on some platforms with

+lib/efi_loader/efi_device_path.c:855:49: error: 'struct disk_partition'
has no member named 'uuid'
+  855 |                         if (uuid_str_to_bin(info.uuid,
+      |                                                 ^

https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/8287

The availability of the field depends on CONFIG_PARTITION_UUIDS. You
could let EFI_LOADER select PARTITION_UUIDS in lib/efi_loader/Kconfig.

Best regards

Heinrich

> ---
>  lib/efi_loader/efi_device_path.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
> index 76c2f82fe6..a2c19538ad 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -16,6 +16,7 @@
>  #include <efi_loader.h>
>  #include <part.h>
>  #include <sandboxblockdev.h>
> +#include <uuid.h>
>  #include <asm-generic/unaligned.h>
>  #include <linux/compat.h> /* U16_MAX */
>
> @@ -851,8 +852,10 @@ static void *dp_part_node(void *buf, struct blk_desc *desc, int part)
>  			break;
>  		case SIG_TYPE_GUID:
>  			hddp->signature_type = 2;
> -			memcpy(hddp->partition_signature, &desc->guid_sig,
> -			       sizeof(hddp->partition_signature));
> +			if (uuid_str_to_bin(info.uuid,
> +					    hddp->partition_signature, 1))
> +				printf("Partition no. %d: invalid guid: %s\n",
> +				       part, info.uuid);
>  			break;
>  		}
>
>



More information about the U-Boot mailing list