Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 1 | SUMMARY = "Witherspoon IPMI daemon configuration" |
| 2 | PR = "r1" |
| 3 | |
| 4 | inherit obmc-phosphor-license |
| 5 | inherit allarch |
| 6 | |
Tom Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 7 | FILESEXTRAPATHS_prepend := \ |
| 8 | "${THISDIR}/../../../../../../meta-phosphor/common/recipes-phosphor/ipmi/phosphor-ipmi-config/:" |
| 9 | |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 10 | SRC_URI = " \ |
| 11 | file://cipher_list.json \ |
Tom Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 12 | file://witherspoon/dcmi_cap.json \ |
| 13 | file://witherspoon/dcmi_sensors.json \ |
| 14 | file://witherspoon/dev_id.json \ |
| 15 | file://witherspoon/power_reading.json \ |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 16 | " |
| 17 | |
| 18 | FILES_${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 | |
| 26 | do_fetch[noexec] = "1" |
| 27 | do_configure[noexec] = "1" |
| 28 | do_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 | |
| 42 | inherit image_version |
| 43 | |
| 44 | do_patch[depends] = "os-release:do_populate_sysroot" |
| 45 | |
| 46 | python 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 Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 62 | file = os.path.join(workdir, 'witherspoon/', 'dev_id.json') |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 63 | |
| 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 | |
| 73 | do_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 Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 77 | install -m 0644 -D ${WORKDIR}/witherspoon/dcmi_cap.json \ |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 78 | ${D}${datadir}/ipmi-providers/dcmi_cap.json |
Tom Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 79 | install -m 0644 -D ${WORKDIR}/witherspoon/dcmi_sensors.json \ |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 80 | ${D}${datadir}/ipmi-providers/dcmi_sensors.json |
Tom Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 81 | install -m 0644 -D ${WORKDIR}/witherspoon/dev_id.json \ |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 82 | ${D}${datadir}/ipmi-providers/dev_id.json |
Tom Joseph | a9123ac | 2018-09-02 23:42:47 -0500 | [diff] [blame^] | 83 | install -m 0644 -D ${WORKDIR}/witherspoon/power_reading.json \ |
Andrew Jeffery | b055d4c | 2018-04-06 14:13:14 +0930 | [diff] [blame] | 84 | ${D}${datadir}/ipmi-providers/power_reading.json |
| 85 | } |