efi_loader: set partition GUID in device path for SIG_TYPE_GUID
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>
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 76c2f82..9c3ac71 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -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 @@
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;
}