From e1fdff44727e69613bc3b8e32896e8290bdb81ab Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Wed, 23 Jun 2010 23:14:44 +0000 Subject: If flashrom is standalone and has no OS below, it can't call dmidecode Provide empty DMI stubs for that case until someone implements our own dmidecode subset. Tested by Patrick Georgi on top of libpayload. Corresponding to flashrom svn r1058. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Patrick Georgi --- dmi.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dmi.c b/dmi.c index cde11a50..40ca85c7 100644 --- a/dmi.c +++ b/dmi.c @@ -24,6 +24,26 @@ #include "flash.h" +int has_dmi_support = 0; + +#if STANDALONE + +/* Stub to indicate missing DMI functionality. + * has_dmi_support is 0 by default, so nothing to do here. + * Because dmidecode is not available on all systems, the goal is to implement + * the DMI subset we need directly in this file. + */ +void dmi_init(void) +{ +} + +int dmi_match(const char *pattern) +{ + return 0; +} + +#else /* STANDALONE */ + const char *dmidecode_names[] = { "system-manufacturer", "system-product-name", @@ -36,7 +56,6 @@ const char *dmidecode_names[] = { #define DMI_COMMAND_LEN_MAX 260 const char *dmidecode_command = "dmidecode"; -int has_dmi_support = 0; char *dmistrings[ARRAY_SIZE(dmidecode_names)]; /* Strings longer than 4096 in DMI are just insane. */ @@ -172,3 +191,5 @@ int dmi_match(const char *pattern) return 0; } + +#endif /* STANDALONE */ -- cgit v1.2.3