-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
u-boot-iot2050: Add the support for smbios and sysinfo
Signed-off-by: Li Hua Qian <[email protected]>
- Loading branch information
Showing
3 changed files
with
587 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
recipes-bsp/u-boot/files/0012-smbios-enhance-system-information-retrieval.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From c69ca28af082a076ad82f1f258487ca89e30a493 Mon Sep 17 00:00:00 2001 | ||
From: Li Hua Qian <[email protected]> | ||
Date: Thu, 20 Jun 2024 15:28:21 +0800 | ||
Subject: [PATCH 1/2] smbios: enhance system information retrieval | ||
|
||
add support to get serial number and uuid value of system info from sysinfo | ||
|
||
Signed-off-by: Li Hua Qian <[email protected]> | ||
--- | ||
include/sysinfo.h | 2 ++ | ||
lib/smbios.c | 8 ++++++++ | ||
2 files changed, 10 insertions(+) | ||
|
||
diff --git a/include/sysinfo.h b/include/sysinfo.h | ||
index b140d742..e38c65ca 100644 | ||
--- a/include/sysinfo.h | ||
+++ b/include/sysinfo.h | ||
@@ -42,6 +42,8 @@ enum sysinfo_id { | ||
|
||
/* For SMBIOS tables */ | ||
SYSINFO_ID_SMBIOS_SYSTEM_VERSION, | ||
+ SYSINFO_ID_SMBIOS_SYSTEM_SERIAL_NUMBER, | ||
+ SYSINFO_ID_SMBIOS_SYSTEM_UUID, | ||
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION, | ||
|
||
/* For show_board_info() */ | ||
diff --git a/lib/smbios.c b/lib/smbios.c | ||
index d7f4999e..ad9db020 100644 | ||
--- a/lib/smbios.c | ||
+++ b/lib/smbios.c | ||
@@ -275,6 +275,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 the_uuid[16] = {0}; | ||
|
||
t = map_sysmem(*current, len); | ||
memset(t, 0, sizeof(struct smbios_type1)); | ||
@@ -293,7 +294,14 @@ static int smbios_write_type1(ulong *current, int handle, | ||
strncpy((char *)t->uuid, serial_str, sizeof(t->uuid)); | ||
} else { | ||
t->serial_number = smbios_add_prop(ctx, "serial"); | ||
+ if (!t->serial_number) | ||
+ t->serial_number = smbios_add_prop_si(ctx, "serial", | ||
+ SYSINFO_ID_SMBIOS_SYSTEM_SERIAL_NUMBER); | ||
} | ||
+ if (!sysinfo_get_str(ctx->dev, SYSINFO_ID_SMBIOS_SYSTEM_UUID, | ||
+ sizeof(the_uuid), the_uuid)) | ||
+ strncpy((char *)t->uuid, the_uuid, sizeof(t->uuid)); | ||
+ | ||
t->sku_number = smbios_add_prop(ctx, "sku"); | ||
t->family = smbios_add_prop(ctx, "family"); | ||
|
||
-- | ||
2.30.2 | ||
|
Oops, something went wrong.