blob: 27678bf889f8b44d857dffe7c147a4302b815559 [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 \
Tom Joseph70b8d002018-03-22 09:11:24 +05307 file://cipher_list.json \
David Cobbley2b68b202017-11-22 13:22:35 -08008 "
Tom Joseph7ca5ec12018-03-09 04:58:06 -06009inherit image_version
10
11# Calculate the auxiliary firmware revision to be updated in the dev_id.json
12# file. It is calculated from the VERSION_ID field which currently has two
13# formats. The revision field is 4 bytes, the first two bytes represent the
14# count of commits from the tagging and next two bytes represent the version.
15# Both fields are represented in BCD encoded format, so 9999 is the maximum
16# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot
17# would display the firmware revision as "Firmware version: 2.01.02160000",
18# "0216" is count and the revision is "0000". With the format
19# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision
20# as "Firmware version: 2.00.00100041", "0010" is count and the revision
21# is "0041".
22
23python do_populate_aux_version() {
24 import json
25 import re
26 version_id = do_get_version(d)
27
28 # count from the commit version
29 count = re.findall("-(\d{1,4})-", version_id)
30
31 release = re.findall("-r(\d{1,4})", version_id)
32 if release:
33 auxVer = count[0] + "{0:0>4}".format(release[0])
34 else:
35 auxVer = count[0] + "0000"
36
37 # Update dev_id.json with the auxiliary firmware revision
38 workdir = d.getVar('WORKDIR', True)
39 file = os.path.join(workdir, 'dev_id.json')
40
41 with open(file, "r+") as jsonFile:
42 data = json.load(jsonFile)
43 jsonFile.seek(0)
44 jsonFile.truncate()
45 data["aux"] = int(auxVer, 16)
46 json.dump(data, jsonFile)
47}
48
49addtask populate_aux_version after do_configure before do_compile