blob: 8ab47c631f8c4e8be50d6d83e566717f73b2be14 [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
7SRC_URI = " \
8 file://cipher_list.json \
9 file://dcmi_cap.json \
10 file://dcmi_sensors.json \
11 file://dev_id.json \
12 file://power_reading.json \
13 "
14
15FILES_${PN} = " \
16 ${datadir}/ipmi-providers/cipher_list.json \
17 ${datadir}/ipmi-providers/dcmi_cap.json \
18 ${datadir}/ipmi-providers/dcmi_sensors.json \
19 ${datadir}/ipmi-providers/dev_id.json \
20 ${datadir}/ipmi-providers/power_reading.json \
21 "
22
23do_fetch[noexec] = "1"
24do_configure[noexec] = "1"
25do_compile[noexec] = "1"
26
27# Calculate the auxiliary firmware revision to be updated in the dev_id.json
28# file. It is calculated from the VERSION_ID field which currently has two
29# formats. The revision field is 4 bytes, the first two bytes represent the
30# count of commits from the tagging and next two bytes represent the version.
31# Both fields are represented in BCD encoded format, so 9999 is the maximum
32# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot
33# would display the firmware revision as "Firmware version: 2.01.02160000",
34# "0216" is count and the revision is "0000". With the format
35# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision
36# as "Firmware version: 2.00.00100041", "0010" is count and the revision
37# is "0041".
38
39inherit image_version
40
41do_patch[depends] = "os-release:do_populate_sysroot"
42
43python do_patch() {
44 import json
45 import re
46 from shutil import copyfile
47 version_id = do_get_version(d)
48
49 # count from the commit version
50 count = re.findall("-(\d{1,4})-", version_id)
51
52 release = re.findall("-r(\d{1,4})", version_id)
53 if release:
54 auxVer = count[0] + "{0:0>4}".format(release[0])
55 else:
56 auxVer = count[0] + "0000"
57
58 workdir = d.getVar('WORKDIR', True)
59 file = os.path.join(workdir, 'dev_id.json')
60
61 # Update dev_id.json with the auxiliary firmware revision
62 with open(file, "r+") as jsonFile:
63 data = json.load(jsonFile)
64 jsonFile.seek(0)
65 jsonFile.truncate()
66 data["aux"] = int(auxVer, 16)
67 json.dump(data, jsonFile)
68}
69
70do_install() {
71 install -d ${D}${datadir}/ipmi-providers
72 install -m 0644 -D ${WORKDIR}/cipher_list.json \
73 ${D}${datadir}/ipmi-providers/cipher_list.json
74 install -m 0644 -D ${WORKDIR}/dcmi_cap.json \
75 ${D}${datadir}/ipmi-providers/dcmi_cap.json
76 install -m 0644 -D ${WORKDIR}/dcmi_sensors.json \
77 ${D}${datadir}/ipmi-providers/dcmi_sensors.json
78 install -m 0644 -D ${WORKDIR}/dev_id.json \
79 ${D}${datadir}/ipmi-providers/dev_id.json
80 install -m 0644 -D ${WORKDIR}/power_reading.json \
81 ${D}${datadir}/ipmi-providers/power_reading.json
82}