All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 7/7] smbios: Provide serial number
Date: Thu, 11 Aug 2016 23:45:07 +0200	[thread overview]
Message-ID: <1470951907-96243-1-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1470665194-19619-8-git-send-email-agraf@suse.de>

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>

---

v1 -> v2:

  - Also populate UUID
---
 lib/smbios.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/smbios.c b/lib/smbios.c
index 4d85155..2d0df23 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -111,11 +111,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;
-- 
1.8.5.6

  parent reply	other threads:[~2016-08-11 21:45 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 14:06 [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 1/7] x86: Move table csum into separate header Alexander Graf
2016-08-09  9:23   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 2/7] x86: Move smbios generation into arch independent directory Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 3/7] efi_loader: Expose efi_install_configuration_table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 4/7] smbios: Allow compilation on 64bit systems Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-08 14:06 ` [U-Boot] [PATCH 5/7] smbios: Expose in efi_loader as table Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-11  9:48     ` [U-Boot] [PATCH v2 " Alexander Graf
2016-08-12  1:30       ` Bin Meng
2016-08-12 17:20   ` [U-Boot] [PATCH " Simon Glass
2016-08-12 18:36     ` Alexander Graf
2016-08-12 20:07       ` Simon Glass
2016-08-16  8:38         ` Alexander Graf
2016-08-17  4:15           ` Simon Glass
2016-08-08 14:06 ` [U-Boot] [PATCH 6/7] efi_loader: Fix efi_install_configuration_table Alexander Graf
2016-08-08 14:06 ` [U-Boot] [PATCH 7/7] smbios: Provide serial number Alexander Graf
2016-08-09  9:24   ` Bin Meng
2016-08-11 21:45   ` Alexander Graf [this message]
2016-08-12  1:31     ` [U-Boot] [PATCH v2 " Bin Meng
2016-08-12 17:20       ` Simon Glass
2016-08-08 21:44 ` [U-Boot] [PATCH 0/7] efi_loader: Expose SMBIOS table Simon Glass
2016-08-09  3:42   ` Bin Meng
2016-08-09  6:48   ` Alexander Graf
2016-08-09 13:57     ` Simon Glass
2016-08-09 14:11       ` Alexander Graf
2016-08-09 14:35         ` Simon Glass
2016-08-10  7:29           ` Alexander Graf
2016-08-12 17:20             ` Simon Glass
2016-08-12 18:26               ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470951907-96243-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.