[PATCH] bootstd: cros: store partition type in an efi_guid_t

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Jun 27 21:28:04 CEST 2024



Am 27. Juni 2024 19:06:29 MESZ schrieb "Vincent Stehlé" <vincent.stehle at arm.com>:
>The scan_part() function uses a struct uuid to store the little-endian
>partition type GUID, but this structure should be used only to contain a
>big-endian UUID. Use an efi_guid_t instead.
>
>Signed-off-by: Vincent Stehlé <vincent.stehle at arm.com>
>Cc: Simon Glass <sjg at chromium.org>
>Cc: Tom Rini <trini at konsulko.com>
>---
> boot/bootmeth_cros.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/boot/bootmeth_cros.c b/boot/bootmeth_cros.c
>index f015f2e1c75..1f83c14aeab 100644
>--- a/boot/bootmeth_cros.c
>+++ b/boot/bootmeth_cros.c
>@@ -148,7 +148,7 @@ static int scan_part(struct udevice *blk, int partnum,
> {
> 	struct blk_desc *desc = dev_get_uclass_plat(blk);
> 	struct vb2_keyblock *hdr;
>-	struct uuid type;
>+	efi_guid_t type;

Does Chrome OS only support GPT partitioning?

> 	ulong num_blks;
> 	int ret;
> 
>@@ -161,7 +161,7 @@ static int scan_part(struct udevice *blk, int partnum,
> 
> 	/* Check for kernel partition type */
> 	log_debug("part %x: type=%s\n", partnum, info->type_guid);
>-	if (uuid_str_to_bin(info->type_guid, (u8 *)&type, UUID_STR_FORMAT_GUID))
>+	if (uuid_str_to_bin(info->type_guid, type.b, UUID_STR_FORMAT_GUID))
> 		return log_msg_ret("typ", -EINVAL);

struct disk_partition containing a string which is only needed in the CLI instead of the 16 byte GUID was a bad idea to start with. Shouldn't we replace it or add least add a GUID field instead of first converting to string and than back to GUID?

> 
> 	if (memcmp(&cros_kern_type, &type, sizeof(type)))

You could use the guidcmp() macro here.

Best regards

Heinrich



More information about the U-Boot mailing list