All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi_loader: set partition GUID in device path for SIG_TYPE_GUID
@ 2021-07-15 13:31 Alfonso Sánchez-Beato
  2021-07-18  9:07 ` Heinrich Schuchardt
  0 siblings, 1 reply; 2+ messages in thread
From: Alfonso Sánchez-Beato @ 2021-07-15 13:31 UTC (permalink / raw)
  To: u-boot
  Cc: xypron.glpk, agraf, Alfonso Sánchez-Beato, Heinrich Schuchardt

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>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 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;
 		}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi_loader: set partition GUID in device path for SIG_TYPE_GUID
  2021-07-15 13:31 [PATCH] efi_loader: set partition GUID in device path for SIG_TYPE_GUID Alfonso Sánchez-Beato
@ 2021-07-18  9:07 ` Heinrich Schuchardt
  0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-07-18  9:07 UTC (permalink / raw)
  To: Alfonso Sánchez-Beato, u-boot; +Cc: agraf, Heinrich Schuchardt

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@canonical.com>
> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@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;
>  		}
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-18  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 13:31 [PATCH] efi_loader: set partition GUID in device path for SIG_TYPE_GUID Alfonso Sánchez-Beato
2021-07-18  9:07 ` Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.