blob: 2737a04369d6e777e8d4c7ed7a6b60c2efe29a60 [file] [log] [blame]
Andrew Jefferyb055d4c2018-04-06 14:13:14 +09301SUMMARY = "Witherspoon IPMI daemon configuration"
2PR = "r1"
3
4inherit obmc-phosphor-license
5inherit allarch
6
Tom Josepha9123ac2018-09-02 23:42:47 -05007FILESEXTRAPATHS_prepend := \
8"${THISDIR}/../../../../../../meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/:"
9
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093010SRC_URI = " \
11 file://cipher_list.json \
Tom Josepha9123ac2018-09-02 23:42:47 -050012 file://witherspoon/dcmi_cap.json \
13 file://witherspoon/dcmi_sensors.json \
14 file://witherspoon/dev_id.json \
15 file://witherspoon/power_reading.json \
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093016 "
17
18FILES_${PN} = " \
19 ${datadir}/ipmi-providers/cipher_list.json \
20 ${datadir}/ipmi-providers/dcmi_cap.json \
21 ${datadir}/ipmi-providers/dcmi_sensors.json \
22 ${datadir}/ipmi-providers/dev_id.json \
23 ${datadir}/ipmi-providers/power_reading.json \
24 "
25
26do_fetch[noexec] = "1"
27do_configure[noexec] = "1"
28do_compile[noexec] = "1"
29
30# Calculate the auxiliary firmware revision to be updated in the dev_id.json
31# file. It is calculated from the VERSION_ID field which currently has two
32# formats. The revision field is 4 bytes, the first two bytes represent the
33# count of commits from the tagging and next two bytes represent the version.
34# Both fields are represented in BCD encoded format, so 9999 is the maximum
35# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot
36# would display the firmware revision as "Firmware version: 2.01.02160000",
37# "0216" is count and the revision is "0000". With the format
38# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision
39# as "Firmware version: 2.00.00100041", "0010" is count and the revision
40# is "0041".
41
42inherit image_version
43
44do_patch[depends] = "os-release:do_populate_sysroot"
45
46python do_patch() {
47 import json
48 import re
49 from shutil import copyfile
50 version_id = do_get_version(d)
51
52 # count from the commit version
53 count = re.findall("-(\d{1,4})-", version_id)
54
55 release = re.findall("-r(\d{1,4})", version_id)
56 if release:
57 auxVer = count[0] + "{0:0>4}".format(release[0])
58 else:
59 auxVer = count[0] + "0000"
60
61 workdir = d.getVar('WORKDIR', True)
Tom Josepha9123ac2018-09-02 23:42:47 -050062 file = os.path.join(workdir, 'witherspoon/', 'dev_id.json')
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093063
64 # Update dev_id.json with the auxiliary firmware revision
65 with open(file, "r+") as jsonFile:
66 data = json.load(jsonFile)
67 jsonFile.seek(0)
68 jsonFile.truncate()
69 data["aux"] = int(auxVer, 16)
70 json.dump(data, jsonFile)
71}
72
73do_install() {
74 install -d ${D}${datadir}/ipmi-providers
75 install -m 0644 -D ${WORKDIR}/cipher_list.json \
76 ${D}${datadir}/ipmi-providers/cipher_list.json
Tom Josepha9123ac2018-09-02 23:42:47 -050077 install -m 0644 -D ${WORKDIR}/witherspoon/dcmi_cap.json \
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093078 ${D}${datadir}/ipmi-providers/dcmi_cap.json
Tom Josepha9123ac2018-09-02 23:42:47 -050079 install -m 0644 -D ${WORKDIR}/witherspoon/dcmi_sensors.json \
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093080 ${D}${datadir}/ipmi-providers/dcmi_sensors.json
Tom Josepha9123ac2018-09-02 23:42:47 -050081 install -m 0644 -D ${WORKDIR}/witherspoon/dev_id.json \
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093082 ${D}${datadir}/ipmi-providers/dev_id.json
Tom Josepha9123ac2018-09-02 23:42:47 -050083 install -m 0644 -D ${WORKDIR}/witherspoon/power_reading.json \
Andrew Jefferyb055d4c2018-04-06 14:13:14 +093084 ${D}${datadir}/ipmi-providers/power_reading.json
85}