[Skiboot] [PATCH] core/flash: Ignore prefix when comparing versions.

Samuel Mendoza-Jonas sam at mendozajonas.com
Wed Oct 10 17:32:40 AEDT 2018


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 at mendozajonas.com>
---
 core/flash.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/core/flash.c b/core/flash.c
index 8e7b90e6..b4bf5516 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -160,6 +160,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",
@@ -213,9 +214,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");
+		}
 	}
 }
 
-- 
2.19.0



More information about the Skiboot mailing list