diff options
author | Mikko Gronoff <mikko.gronoff@qt.io> | 2023-06-01 13:52:45 +0300 |
---|---|---|
committer | Mikko Gronoff <mikko.gronoff@qt.io> | 2023-06-01 12:18:06 +0000 |
commit | 1e7b7e5dc71859c79f84e729fb99d7ea904a482e (patch) | |
tree | 26ffd42dc65aec284d41fd8c04b941f2867d1f50 | |
parent | b4ea671e492f87746de89e6be1422d59323e0f14 (diff) |
Add image_type_tezi_b2qt.bbclass
Change-Id: Ic6338f13c8f8f44c115a385bd87e6f9c9197d101
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
-rw-r--r-- | classes/image_type_tezi_b2qt.bbclass | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/classes/image_type_tezi_b2qt.bbclass b/classes/image_type_tezi_b2qt.bbclass new file mode 100644 index 0000000..b869377 --- /dev/null +++ b/classes/image_type_tezi_b2qt.bbclass @@ -0,0 +1,59 @@ +IMAGE_CMD:teziimg:append() { + ${IMAGE_CMD_TAR} --transform 's,^,${IMAGE_NAME}-Tezi_${TEZI_VERSION}/,' -rhf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${TEZI_VERSION}.tar TEZI_B2QT_EULA.TXT Built_with_Qt.png + ln -fs ${TEZI_IMAGE_NAME}-Tezi_${TEZI_VERSION}.tar ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.tezi.tar +} + +def rootfs_tezi_json_b2qt(d, flash_type, flash_data, json_file, uenv_file): + import json + from collections import OrderedDict + from datetime import datetime + + qtversion = d.getVar('QT_VERSION') + deploydir = d.getVar('DEPLOY_DIR_IMAGE') + data = OrderedDict({ "config_format": d.getVar('TEZI_CONFIG_FORMAT'), "autoinstall": False }) + + # Use image recipes SUMMARY/DESCRIPTION... + data["name"] = d.getVar('SUMMARY') + data["description"] = d.getVar('DESCRIPTION') + data["version"] = "Qt " + qtversion + data["release_date"] = datetime.strptime(d.getVar('DATE', False), '%Y%m%d').date().isoformat() + data["u_boot_env"] = uenv_file + if os.path.exists(os.path.join(deploydir, "prepare.sh")): + data["prepare_script"] = "prepare.sh" + if os.path.exists(os.path.join(deploydir, "wrapup.sh")): + data["wrapup_script"] = "wrapup.sh" + if os.path.exists(os.path.join(deploydir, "marketing.tar")): + data["marketing"] = "marketing.tar" + data["license_title"] = "QT DEMO IMAGE END USER LICENSE AGREEMENT" + data["license"] = "TEZI_B2QT_EULA.TXT" + data["icon"] = "Built_with_Qt.png" + + product_ids = d.getVar('TORADEX_PRODUCT_IDS') + if product_ids is None: + bb.fatal("Supported Toradex product ids missing, assign TORADEX_PRODUCT_IDS with a list of product ids.") + + dtmapping = d.getVarFlags('TORADEX_PRODUCT_IDS') + data["supported_product_ids"] = [] + + # If no varflags are set, we assume all product ids supported with single image/U-Boot + if dtmapping is not None: + for f, v in dtmapping.items(): + dtbflashtypearr = v.split(',') + if len(dtbflashtypearr) < 2 or dtbflashtypearr[1] == flash_type: + data["supported_product_ids"].append(f) + else: + data["supported_product_ids"].extend(product_ids.split()) + + if flash_type == "rawnand": + data["mtddevs"] = flash_data + elif flash_type == "emmc": + data["blockdevs"] = flash_data + + with open(os.path.join(d.getVar('IMGDEPLOYDIR'), json_file), 'w') as outfile: + json.dump(data, outfile, indent=4) + bb.note("Toradex Easy Installer metadata file {0} written.".format(json_file)) + +python rootfs_tezi_run_json:append() { + # rewrite image.json with our data + rootfs_tezi_json_b2qt(d, flash_type, flash_data, "image-%s.json" % d.getVar('IMAGE_BASENAME'), uenv_file) +} |