From 0641c48da7b27177ae7260ac1f346d5f042de4b7 Mon Sep 17 00:00:00 2001 From: John Wang Date: Thu, 27 Jun 2019 10:50:24 +0800 Subject: fp5280g2: ipmi: Add device id config Tested: Ran command `ipmitool mc info` got responses: Device ID : 0 Device Revision : 0 Firmware Revision : 0.00 IPMI Version : 2.0 Manufacturer ID : 51850 Manufacturer Name : Unknown (0xCA8A) Product ID : 514 (0x0202) Product Name : Unknown (0x202) Device Available : yes Provides Device SDRs : yes Additional Device Support : Sensor Device SEL Device FRU Inventory Device Chassis Device Aux Firmware Rev Info : 0x00 0x00 0x80 0x09 (From meta-inspur rev: 98340847a922cd3f405cc2cada1f1a75c960da7c) Signed-off-by: John Wang Change-Id: I5ad8c45eba95ef27de80fd688dacbe8e1e1775ba Signed-off-by: Brad Bishop --- .../ipmi/phosphor-ipmi-config.bbappend | 45 +++++++++++++++++++++- .../ipmi/phosphor-ipmi-config/dev_id.json | 2 + 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json (limited to 'meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi') diff --git a/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend index 27e7cf9cf..3256e834a 100644 --- a/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend +++ b/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend @@ -1 +1,44 @@ -FILESEXTRAPATHS_prepend_fp5280g2 := "${THISDIR}/${PN}:" +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +# 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". +inherit image_version + +unset do_patch[noexec] +do_patch[depends] = "os-release:do_populate_sysroot" + +python do_patch() { + import json + import re + from shutil import copyfile + 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" + + workdir = d.getVar('WORKDIR', True) + file = os.path.join(workdir, 'dev_id.json') + + # Update dev_id.json with the auxiliary firmware revision + with open(file, "r+") as jsonFile: + data = json.load(jsonFile) + jsonFile.seek(0) + jsonFile.truncate() + data["aux"] = int(auxVer, 16) + json.dump(data, jsonFile) +} diff --git a/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json b/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json new file mode 100644 index 000000000..dd3f137c2 --- /dev/null +++ b/meta-inspur/meta-fp5280g2/recipes-phosphor/ipmi/phosphor-ipmi-config/dev_id.json @@ -0,0 +1,2 @@ +{"id": 0, "revision": 128, "addn_dev_support": 141, + "manuf_id": 51850, "prod_id": 514, "aux": 0} -- cgit v1.2.3