[PATCH v2 11/13] smbios: Fill UUID from sysinfo when available

Tom Rini trini at konsulko.com
Fri Oct 25 03:08:54 CEST 2024


On Tue, Oct 22, 2024 at 08:04:28AM +0200, Jan Kiszka wrote:

> From: Jan Kiszka <jan.kiszka at siemens.com>
> 
> Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will
> be first used by the IOT2050 boards.
> 
> Based on original patch by Li Hua Qian.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> ---
>  include/sysinfo.h | 1 +
>  lib/smbios.c      | 4 ++++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/include/sysinfo.h b/include/sysinfo.h
> index 8a77ef44856..1c5008b5f23 100644
> --- a/include/sysinfo.h
> +++ b/include/sysinfo.h
> @@ -49,6 +49,7 @@ enum sysinfo_id {
>  	SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
>  	SYSINFO_ID_SMBIOS_SYSTEM_SKU,
>  	SYSINFO_ID_SMBIOS_SYSTEM_FAMILY,
> +	SYSINFO_ID_SMBIOS_SYSTEM_UUID,
>  	SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER,
>  	SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT,
>  	SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
> diff --git a/lib/smbios.c b/lib/smbios.c
> index 7c24ea129eb..1441fa4cde6 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,
>  	struct smbios_type1 *t;
>  	int len = sizeof(struct smbios_type1);
>  	char *serial_str = env_get("serial#");
> +	char uuid[sizeof(t->uuid)];
>  
>  	t = map_sysmem(*current, len);
>  	memset(t, 0, sizeof(struct smbios_type1));
> @@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,
>  						      SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
>  						      NULL);
>  	}
> +	if (!sysinfo_get_str(ctx->dev, SYSINFO_ID_SMBIOS_SYSTEM_UUID,
> +			     sizeof(uuid), uuid))
> +		strncpy((char *)t->uuid, uuid, sizeof(t->uuid));
>  	t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
>  	t->sku_number = smbios_add_prop_si(ctx, "sku",
>  					   SYSINFO_ID_SMBIOS_SYSTEM_SKU, NULL);

This commit leads to sandbox (and sandbox with clang) failing a ton of
tests:
https://source.denx.de/u-boot/u-boot/-/jobs/929474

Without this commit in the series, iot2050 fails to build.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20241024/f47193b9/attachment.sig>


More information about the U-Boot mailing list