summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2016-08-19 01:23:31 +0200
committerAlexander Graf <agraf@suse.de>2016-10-19 09:01:53 +0200
commit6fb580d7b41069461093296a0f1059cf294a44dd (patch)
treea1a77ecabfe649db42199dadfad2c03d94dcfe89 /lib
parentaba5e9194b98988162e5bd026dbcb6627a53efe5 (diff)
downloadu-boot-6fb580d7b41069461093296a0f1059cf294a44dd.tar.gz
smbios: Provide serial number
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 and UUID fields in the SMBIOS tables. Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/smbios.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/smbios.c b/lib/smbios.c
index 237f5f05fd..ce1974d86f 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -112,11 +112,16 @@ 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) {
+ strncpy((char*)t->uuid, serial_str, sizeof(t->uuid));
+ t->serial_number = smbios_add_string(t->eos, serial_str);
+ }
len = t->length + smbios_string_table_len(t->eos);
*current += len;