core/flash: Emit a warning if Skiboot version doesn't match

Message ID 20180711071738.18350-1-sam@mendozajonas.com
State Accepted
Headers show
Series
  • core/flash: Emit a warning if Skiboot version doesn't match
Related show

Commit Message

Samuel Mendoza-Jonas July 11, 2018, 7:17 a.m.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
The message is very bikesheddable but this could be a useful sanity check
on non-dev machines.

 core/flash.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stewart Smith July 17, 2018, 8:07 a.m. | #1
Samuel Mendoza-Jonas <sam@mendozajonas.com> writes:
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
> ---
> The message is very bikesheddable but this could be a useful sanity check
> on non-dev machines.

Oh, I like this.

The bike shed is also fine, it seems to hold multiple bicyles and is of
a suitably neutral colour.

Merged to master as of 714be69223cc965675e2226d75d1f287c16fe58d

Patch

diff --git a/core/flash.c b/core/flash.c
index e258fe17..8f00d85e 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -212,6 +212,10 @@  static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data)
 		/* Increment past "key-" */
 		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)
+				prlog(PR_WARNING, "WARNING! Skiboot version does not match VERSION partition!\n");
 	}
 }