]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: set partition GUID in device path for SIG_TYPE_GUID
authorAlfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
Thu, 15 Jul 2021 13:31:42 +0000 (15:31 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 18 Jul 2021 12:43:56 +0000 (14:43 +0200)
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@canonical.com>
Let EFI_LOADER select CONFIG_PARTITION_UUIDS.
Use log_warning() instead of printf() for warning.
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/Kconfig
lib/efi_loader/efi_device_path.c

index 156b391521127ec44ff05dcec3f83c469acffb47..a135d2f7093ab2a897a500770edb77aa1be2f3a7 100644 (file)
@@ -12,6 +12,7 @@ config EFI_LOADER
        depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
        default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
        select LIB_UUID
+       select PARTITION_UUIDS
        select HAVE_BLOCK_DEVICE
        select REGEX
        imply CFB_CONSOLE_ANSI
index 76c2f82fe661c8d44497e910ab6035830fcc6a66..9c3ac712fefbe6cad255f8d4d1a632f23db07444 100644 (file)
@@ -5,6 +5,8 @@
  * (C) Copyright 2017 Rob Clark
  */
 
+#define LOG_CATEGORY LOGC_EFI
+
 #include <common.h>
 #include <blk.h>
 #include <dm.h>
@@ -16,6 +18,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 +854,11 @@ 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))
+                               log_warning(
+                                       "Partition no. %d: invalid guid: %s\n",
+                                       part, info.uuid);
                        break;
                }