[U-Boot] [PATCH 7/7] smbios: Provide serial number

Alexander Graf agraf at suse.de
Mon Aug 8 16:06:34 CEST 2016


If the system has a valid "serial#" environment variable set (which boards that
can find it out programatically set automatically), use that as input for the
serial number field in the SMBIOS tables.

Signed-off-by: Alexander Graf <agraf at suse.de>
---
 lib/smbios.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/smbios.c b/lib/smbios.c
index b9aa741..e8befdf 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -111,11 +111,14 @@ static int smbios_write_type1(uintptr_t *current, int handle)
 {
 	struct smbios_type1 *t = (struct smbios_type1 *)*current;
 	int len = sizeof(struct smbios_type1);
+	char *serial_str = getenv("serial#");
 
 	memset(t, 0, sizeof(struct smbios_type1));
 	fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
 	t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
 	t->product_name = smbios_add_string(t->eos, CONFIG_SMBIOS_PRODUCT_NAME);
+	if (serial_str)
+		t->serial_number = smbios_add_string(t->eos, serial_str);
 
 	len = t->length + smbios_string_table_len(t->eos);
 	*current += len;
-- 
2.6.6



More information about the U-Boot mailing list