aboutsummaryrefslogtreecommitdiff
path: root/core/flash.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-10-10 17:32:40 +1100
committerStewart Smith <stewart@linux.ibm.com>2018-10-16 18:26:24 +1100
commitc0375a62396d09874b4dd84a13904b89e6f96b60 (patch)
tree33efecd3841afc7ee581f7b2825b8d207afafd59 /core/flash.c
parentc5d71815288cc7646c9e426bcb9a97dd5f4f2f2d (diff)
downloadskiboot-c0375a62396d09874b4dd84a13904b89e6f96b60.zip
skiboot-c0375a62396d09874b4dd84a13904b89e6f96b60.tar.gz
skiboot-c0375a62396d09874b4dd84a13904b89e6f96b60.tar.bz2
core/flash: Ignore prefix when comparing versions.
The Skiboot version can include a "skiboot-" prefix if built with something like Buildroot. The property being compared against won't include this so ignore it. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core/flash.c')
-rw-r--r--core/flash.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/flash.c b/core/flash.c
index 83c1112..6d6e354 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -171,6 +171,7 @@ static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data)
char *prop;
int version_len, i;
int len = strlen(data);
+ const char *skiboot_version;
const char * version_str[] = {"open-power", "buildroot", "skiboot",
"hostboot-binaries", "hostboot", "linux",
"petitboot", "occ", "capp-ucode", "sbe",
@@ -224,9 +225,22 @@ static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data)
prop = data + version_len + 1;
dt_add_property_string(fw_version, version_str[i], prop);
- if (strncmp(version_str[i], "skiboot", strlen("skiboot")) == 0)
- if (strncmp(prop, version, strlen(version)) != 0)
+ /* Sanity check against what Skiboot thinks its version is. */
+ if (strncmp(version_str[i], "skiboot",
+ strlen("skiboot")) == 0) {
+ /*
+ * If Skiboot was built with Buildroot its version may
+ * include a 'skiboot-' prefix; ignore it.
+ */
+ if (strncmp(version, "skiboot-",
+ strlen("skiboot-")) == 0)
+ skiboot_version = version + strlen("skiboot-");
+ else
+ skiboot_version = version;
+ if (strncmp(prop, skiboot_version,
+ strlen(skiboot_version)) != 0)
prlog(PR_WARNING, "WARNING! Skiboot version does not match VERSION partition!\n");
+ }
}
}