summaryrefslogtreecommitdiff
path: root/meta-google/recipes-phosphor
diff options
context:
space:
mode:
authorWilly Tu <wltu@google.com>2022-06-09 23:21:39 +0300
committerWilly Tu <wltu@google.com>2022-06-10 23:49:55 +0300
commit2dc424c72b96bed45301da076bbd3f11d2b9b118 (patch)
tree81941136df50164b6f6f7e5bc6c641083375c1b4 /meta-google/recipes-phosphor
parent1bd981fd57aae52b78fa0e575191632de755beb4 (diff)
downloadopenbmc-2dc424c72b96bed45301da076bbd3f11d2b9b118.tar.xz
meta-google: ipmi-config: Recover gbmc_version and fix task dependency
Update the dev_id.json directly after the install and before the do_package to make sure it always get install/packaged properly. Tested: ``` MACHINE=$PLATFORM GBMC_VERSION=0.0.0.5 bitbake phosphor-ipmi-config ... { "addn_dev_support": 2, "aux": 327680, "firmware_revision": { "major": 0, "minor": 0 }, "id": 32, "manuf_id": 1234, "prod_id": 5678, "revision": 1 } ``` Change-Id: Ic43ba03fddb972d2dbbda64a31237574fbd39a34 Signed-off-by: Willy Tu <wltu@google.com>
Diffstat (limited to 'meta-google/recipes-phosphor')
-rw-r--r--meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend b/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
index 2f2d9e0881..5c27e02d30 100644
--- a/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
+++ b/meta-google/recipes-phosphor/ipmi/phosphor-ipmi-config.bbappend
@@ -41,3 +41,36 @@ do_install:append:gbmc() {
echo "[]" > ${D}${datadir}/ipmi-providers/entity-map.json
fi
}
+
+python do_gbmc_version () {
+ import json
+
+ if d.getVar('GBMC_VERSION') is None:
+ return
+
+ version = d.getVar('GBMC_VERSION').split('.')
+ major = min(int(version[0]), 0x7F) & 0x7F
+ minor = min(int(version[1]), 99)
+ minor = int(minor / 10) * 16 + minor % 10;
+ point = int(version[2])
+ subpoint = int(version[3])
+
+ dir = d.getVar('D') + d.getVar('datadir') + '/ipmi-providers'
+ path = os.path.join(dir, 'dev_id.json')
+
+ dev_id = {}
+
+ # Open existing dev_id and override the fields not needed for version.
+ with open(path, 'r') as f:
+ dev_id = json.load(f)
+ dev_id["firmware_revision"] = {
+ "major": major,
+ "minor": minor
+ }
+ dev_id["aux"] = subpoint << 16 | (0xFFFF & point)
+
+ with open(path, 'w') as f:
+ json.dump(dev_id, f, sort_keys=True, indent=4)
+}
+
+addtask gbmc_version after do_install before do_package