From: Alan Cox <alan@linux.intel.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [PATCH] support to overwrite DMI board info
Date: Tue, 28 Sep 2010 13:36:47 +0100 [thread overview]
Message-ID: <20100928123639.17046.13090.stgit@localhost.localdomain> (raw)
From: Jiang, Chao <chao.jiang@intel.com>
support to overwrite board vendor/version/name information by editing
/boot/cmdline file. Format example:
board_vendor="XXX company" board_version=DV3.0
Signed-off-by: Jiang, Chao <chao.jiang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/firmware/dmi_scan.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index b3d22d6..5763618 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -712,3 +712,40 @@ bool dmi_match(enum dmi_field f, const char *str)
return !strcmp(info, str);
}
EXPORT_SYMBOL_GPL(dmi_match);
+
+static int __init dmi_override(int slot, char *str)
+{
+ size_t len;
+ char *p;
+ if (!str)
+ return -EINVAL;
+ len = strlen(str) + 1;
+ p = dmi_alloc(len);
+ if (p != NULL)
+ strcpy(p, str);
+ else {
+ printk(KERN_ERR "dm_override: cannot allocate %Zu bytes.\n",
+ len);
+ return -ENOMEM;
+ }
+ dmi_ident[slot] = p;
+ return 0;
+}
+
+static int __init override_dmi_board_vendor(char *str)
+{
+ return dmi_override(DMI_BOARD_VENDOR, str);
+}
+early_param("board_vendor", override_dmi_board_vendor);
+
+static int __init override_dmi_board_version(char *str)
+{
+ return dmi_override(DMI_BOARD_VERSION, str);
+}
+early_param("board_version", override_dmi_board_version);
+
+static int __init override_dmi_board_name(char *str)
+{
+ return dmi_override(DMI_BOARD_NAME, str);
+}
+early_param("board_name", override_dmi_board_name);
next reply other threads:[~2010-09-28 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 12:36 Alan Cox [this message]
2010-09-29 10:10 ` [PATCH] support to overwrite DMI board info Éric Piel
-- strict thread matches above, loose matches on Subject: below --
2010-09-30 14:39 Alan Cox
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=20100928123639.17046.13090.stgit@localhost.localdomain \
--to=alan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox