Instead of using the same string for every field, let those fields to be set individually on config.h
The current default value is kept (CONFIG_APPNAME), but it should allow fine-tuned configuration at build-time on config.h.
Signed-off-by: Eduardo Habkost ehabkost@redhat.com --- src/config.h | 8 ++++++++ src/smbios.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/config.h b/src/config.h index 92a02aa..1302140 100644 --- a/src/config.h +++ b/src/config.h @@ -17,6 +17,14 @@ #define CONFIG_OEM_TABLE_ID_4 CONFIG_APPNAME4 #define CONFIG_ASL_COMPILER_ID_4 CONFIG_APPNAME4
+/* SMBIOS fields */ +#define CONFIG_SMBIOS_VENDOR CONFIG_APPNAME +#define CONFIG_SMBIOS_VERSION CONFIG_APPNAME +#define CONFIG_SMBIOS_MANUFACTURER CONFIG_APPNAME +#define CONFIG_SMBIOS_PROD_NAME CONFIG_APPNAME +#define CONFIG_SMBIOS_TYPE3_NAME CONFIG_APPNAME +#define CONFIG_SMBIOS_CPU_NAME CONFIG_APPNAME + // Configure as a coreboot payload. #define CONFIG_COREBOOT 0
diff --git a/src/smbios.c b/src/smbios.c index e19a62d..eec271d 100644 --- a/src/smbios.c +++ b/src/smbios.c @@ -88,8 +88,8 @@ smbios_init_type_0(void *start) p->header.length = sizeof(struct smbios_type_0); p->header.handle = 0;
- load_str_field_with_default(0, vendor_str, CONFIG_APPNAME); - load_str_field_with_default(0, bios_version_str, CONFIG_APPNAME); + load_str_field_with_default(0, vendor_str, CONFIG_SMBIOS_VENDOR); + load_str_field_with_default(0, bios_version_str, CONFIG_SMBIOS_VERSION);
p->bios_starting_address_segment = 0xe800;
@@ -135,8 +135,8 @@ smbios_init_type_1(void *start) p->header.length = sizeof(struct smbios_type_1); p->header.handle = 0x100;
- load_str_field_with_default(1, manufacturer_str, CONFIG_APPNAME); - load_str_field_with_default(1, product_name_str, CONFIG_APPNAME); + load_str_field_with_default(1, manufacturer_str, CONFIG_SMBIOS_MANUFACTURER); + load_str_field_with_default(1, product_name_str, CONFIG_SMBIOS_PROD_NAME); load_str_field_or_skip(1, version_str); load_str_field_or_skip(1, serial_number_str);
@@ -185,9 +185,9 @@ smbios_init_type_3(void *start) p->contained_element_count = 0;
start += sizeof(struct smbios_type_3); - memcpy((char *)start, CONFIG_APPNAME"\0\0", sizeof(CONFIG_APPNAME) + 1); + memcpy((char *)start, CONFIG_SMBIOS_TYPE3_NAME"\0\0", sizeof(CONFIG_SMBIOS_TYPE3_NAME) + 1);
- return start + sizeof(CONFIG_APPNAME) + 1; + return start + sizeof(CONFIG_SMBIOS_TYPE3_NAME) + 1; }
/* Type 4 -- Processor Information */ @@ -228,9 +228,9 @@ smbios_init_type_4(void *start, unsigned int cpu_number)
snprintf((char*)start, 6, "CPU%2x", cpu_number); start += 6; - memcpy((char *)start, CONFIG_APPNAME"\0\0", sizeof(CONFIG_APPNAME) + 1); + memcpy((char *)start, CONFIG_SMBIOS_CPU_NAME"\0\0", sizeof(CONFIG_SMBIOS_CPU_NAME) + 1);
- return start + sizeof(CONFIG_APPNAME) + 1; + return start + sizeof(CONFIG_SMBIOS_CPU_NAME) + 1; }
/* Type 16 -- Physical Memory Array */