1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 2 3# Calculate the auxiliary firmware revision to be updated in the dev_id.json 4# file. It is calculated from the VERSION_ID field which currently has two 5# formats. The revision field is 4 bytes, the first two bytes represent the 6# count of commits from the tagging and next two bytes represent the version. 7# Both fields are represented in BCD encoded format, so 9999 is the maximum 8# value both fields can take. With the format "v2.1-216-ga78ace8", Petitboot 9# would display the firmware revision as "Firmware version: 2.01.02160000", 10# "0216" is count and the revision is "0000". With the format 11# "ibm-v2.0-10-r41-0-gd0c319e" Petitboot would display the firmware revision 12# as "Firmware version: 2.00.00100041", "0010" is count and the revision 13# is "0041". 14inherit image_version 15 16unset do_patch[noexec] 17do_patch[depends] = "os-release:do_populate_sysroot" 18 19python do_patch_ibm-ac-server() { 20 import json 21 import re 22 from shutil import copyfile 23 version_id = do_get_version(d) 24 25 # count from the commit version, minimum of one digit 26 count = re.findall("-(\d{1,4})-", version_id) 27 if count: 28 commit = count[0] 29 else: 30 commit = "0" 31 32 release = re.findall("-r(\d{1,4})", version_id) 33 if release: 34 auxVer = commit + "{0:0>4}".format(release[0]) 35 else: 36 auxVer = commit + "0000" 37 38 workdir = d.getVar('WORKDIR', True) 39 file = os.path.join(workdir, 'dev_id.json') 40 41 # Update dev_id.json with the auxiliary firmware revision 42 with open(file, "r+") as jsonFile: 43 data = json.load(jsonFile) 44 jsonFile.seek(0) 45 jsonFile.truncate() 46 data["aux"] = int(auxVer, 16) 47 json.dump(data, jsonFile) 48} 49