support to overwrite DMI board info
PATCH 1/1 support to overwrite DMI board info
From: Jiang, Chao <[email protected]>
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 <[email protected]>
Signed-off-by Alan Cox <[email protected]>
---
drivers/firmware/dmi_scan.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
drivers/firmware/dmi_scan.c +37 -0
@@ -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);
Op 28-09-10 14:36, Alan Cox schreef:
Quoted 6 lines
From: Jiang, Chao<[email protected]>
support to overwrite board vendor/version/name information by editing
/boot/cmdlinefile. Format example:
board_vendor="XXX company" board_version=DV3.0
3 new boot parameters... How about also updating Documentation/kernel-parameters.txt to explain what they do without users having to read the git changelog?
Cheers,
Eric