blob: a4a6618bc708881e9c7b552f1890d771d94da9f4 [file] [log] [blame]
Dhruvaraj Subhashchandran9117ebd2017-08-04 16:09:15 -05001FILESEXTRAPATHS_append_witherspoon := ":${THISDIR}/${PN}"
David Cobbley2b68b202017-11-22 13:22:35 -08002SRC_URI_append_witherspoon = " file://occ_sensors.hardcoded.yaml \
3 file://dev_id.json \
Deepak Kodihallic6561432018-02-06 06:58:06 -06004 file://dcmi_sensors.json \
Marri Devender Rao20ba4ac2018-01-18 11:27:13 -06005 file://power_reading.json \
Marri Devender Rao24528022018-02-05 01:31:39 -06006 file://hwmon_sensors.hardcoded.yaml \
David Cobbley2b68b202017-11-22 13:22:35 -08007 "
Tom Joseph7ca5ec12018-03-09 04:58:06 -06008inherit image_version
9
10# Calculate the auxiliary firmware revision to be updated in the dev_id.json
11# file. It is calculated from the VERSION_ID field which currently has two
12# formats. The revision field is 4 bytes, the first two bytes represent the
13# count of commits from the tagging and next two bytes represent the version.
14# Both fields are represented in BCD encoded format, so 9999 is the maximum
15# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot
16# would display the firmware revision as "Firmware version: 2.01.02160000",
17# "0216" is count and the revision is "0000". With the format
18# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision
19# as "Firmware version: 2.00.00100041", "0010" is count and the revision
20# is "0041".
21
22python do_populate_aux_version() {
23 import json
24 import re
25 version_id = do_get_version(d)
26
27 # count from the commit version
28 count = re.findall("-(\d{1,4})-", version_id)
29
30 release = re.findall("-r(\d{1,4})", version_id)
31 if release:
32 auxVer = count[0] + "{0:0>4}".format(release[0])
33 else:
34 auxVer = count[0] + "0000"
35
36 # Update dev_id.json with the auxiliary firmware revision
37 workdir = d.getVar('WORKDIR', True)
38 file = os.path.join(workdir, 'dev_id.json')
39
40 with open(file, "r+") as jsonFile:
41 data = json.load(jsonFile)
42 jsonFile.seek(0)
43 jsonFile.truncate()
44 data["aux"] = int(auxVer, 16)
45 json.dump(data, jsonFile)
46}
47
48addtask populate_aux_version after do_configure before do_compile