diff --git a/core/flash.c b/core/flash.c index eacf55bb72be..d526ef33a220 100644 --- a/core/flash.c +++ b/core/flash.c @@ -156,6 +156,7 @@ static int flash_nvram_write(uint32_t dst, void *src, uint32_t len) static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data) { + static bool first = true; char *prop; int version_len, i; int len = strlen(data); @@ -164,6 +165,25 @@ static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data) "petitboot", "occ", "capp-ucode", "sbe", "machine-xml"}; + if (first) { + first = false; + + /* Increment past "key-" */ + if (memcmp(data, "open-power", strlen("open-power")) == 0) + prop = data + strlen("open-power"); + else + prop = strchr(data, '-'); + if (!prop) { + prlog(PR_DEBUG, + "FLASH: Invalid fw version format (%s)\n", data); + return; + } + prop++; + + dt_add_property_string(fw_version, "version", prop); + return; + } + /* * PNOR version strings are not easily consumable. Split them into * property, value.