diff options
author | Tom Joseph <tomjoseph@in.ibm.com> | 2018-03-09 04:58:06 -0600 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2018-03-26 14:23:49 -0500 |
commit | f02787a460b9fac4ccdb7974951a3d771da64920 (patch) | |
tree | 0e388816dc175f7b0eaa0b3eefdb249a5460e09f /meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor | |
parent | 58219d36216d086875c4258729ce970f1ab3d340 (diff) | |
download | talos-openbmc-f02787a460b9fac4ccdb7974951a3d771da64920.tar.gz talos-openbmc-f02787a460b9fac4ccdb7974951a3d771da64920.zip |
Generate IPMI Aux firmware revision from VERSION_ID field
IPMI command get device id supports auxiliary firmware version field
in the response. This field is 4 bytes and the first 2 bytes would
contain the count from the version tag in BCD format, the next 2 bytes
would represent the release version in BCD format. This change can
support the VERSION_ID format of IBM enterprise build and a build
from the master.
Resolves openbmc/openbmc#2972
Change-Id: I4f4e23a3be687b814cef51b1b96c7b97778bcb16
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor')
-rw-r--r-- | meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend index 3f4b2925e..a4a6618bc 100644 --- a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend +++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/ipmi/phosphor-ipmi-host.bbappend @@ -5,3 +5,44 @@ SRC_URI_append_witherspoon = " file://occ_sensors.hardcoded.yaml \ file://power_reading.json \ file://hwmon_sensors.hardcoded.yaml \ " +inherit image_version + +# Calculate the auxiliary firmware revision to be updated in the dev_id.json +# file. It is calculated from the VERSION_ID field which currently has two +# formats. The revision field is 4 bytes, the first two bytes represent the +# count of commits from the tagging and next two bytes represent the version. +# Both fields are represented in BCD encoded format, so 9999 is the maximum +# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot +# would display the firmware revision as "Firmware version: 2.01.02160000", +# "0216" is count and the revision is "0000". With the format +# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision +# as "Firmware version: 2.00.00100041", "0010" is count and the revision +# is "0041". + +python do_populate_aux_version() { + import json + import re + version_id = do_get_version(d) + + # count from the commit version + count = re.findall("-(\d{1,4})-", version_id) + + release = re.findall("-r(\d{1,4})", version_id) + if release: + auxVer = count[0] + "{0:0>4}".format(release[0]) + else: + auxVer = count[0] + "0000" + + # Update dev_id.json with the auxiliary firmware revision + workdir = d.getVar('WORKDIR', True) + file = os.path.join(workdir, 'dev_id.json') + + with open(file, "r+") as jsonFile: + data = json.load(jsonFile) + jsonFile.seek(0) + jsonFile.truncate() + data["aux"] = int(auxVer, 16) + json.dump(data, jsonFile) +} + +addtask populate_aux_version after do_configure before do_compile |