From fe1fee9a45076aab2e39e38b5705d1ad0aa06de5 Mon Sep 17 00:00:00 2001 From: John Toomey Date: Mon, 29 Jan 2024 13:41:46 +0000 Subject: bootbin-version-header: Move recipe from meta-kria Signed-off-by: John Toomey Signed-off-by: Mark Hatle --- .../recipes-bsp/bootbin/bootbin-version-header.bb | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 meta-xilinx-core/recipes-bsp/bootbin/bootbin-version-header.bb (limited to 'meta-xilinx-core') diff --git a/meta-xilinx-core/recipes-bsp/bootbin/bootbin-version-header.bb b/meta-xilinx-core/recipes-bsp/bootbin/bootbin-version-header.bb new file mode 100644 index 00000000..98eebc3e --- /dev/null +++ b/meta-xilinx-core/recipes-bsp/bootbin/bootbin-version-header.bb @@ -0,0 +1,54 @@ +DESCRIPTION = "Bootbin version string file" +SUMMARY = "The BIF file for bootbin requires a version file in a specific format" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +COMPATIBLE_MACHINE = "^$" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +BOOTBIN_VER_MAIN ?= "" + +BOOTBIN_VER_SUFFIX ?= "${@(d.getVar('XILINX_VER_BUILD') or '')[:8] if d.getVar('XILINX_VER_UPDATE') != 'release' and not d.getVar('XILINX_VER_UPDATE').startswith('update') else ''}" +BOOTBIN_VER_FILE = "bootbin-version-header.txt" +BOOTBIN_VER_MAX_LEN = "36" + +BOOTBIN_MANIFEST_FILE ?= "bootbin-version-header.manifest" + +inherit deploy image-artifact-names + +python do_configure() { + if d.getVar("BOOTBIN_VER_SUFFIX"): + version = version + "-" + d.getVar("BOOTBIN_VER_SUFFIX") + + if len(version) > int(d.getVar("BOOTBIN_VER_MAX_LEN")): + bb.error("version string too long") + + with open(d.expand("${B}/${BOOTBIN_VER_FILE}"), "w") as f: + f.write(version.encode("utf-8").hex()) + + with open(d.expand("${B}/${BOOTBIN_MANIFEST_FILE}"), "w") as f: + f.write("* %s\n" % d.getVar('PN')) + f.write("VERSION: %s\n" % version) + f.write("PV: %s\n" % d.getVar('PV')) + f.write("XILINX_VER_MAIN: %s\n" % d.getVar('XILINX_VER_MAIN')) + f.write("XILINX_VER_UPDATE: %s\n" % d.getVar('XILINX_VER_UPDATE')) + f.write("XILINX_VER_BUILD: %s\n\n" % d.getVar('XILINX_VER_BUILD')) +} + +do_install() { + install -d ${D}/boot + install -m 0644 ${B}/${BOOTBIN_VER_FILE} ${D}/boot/ +} + +do_deploy() { + install -m 0644 ${B}/${BOOTBIN_VER_FILE} ${DEPLOYDIR}/${IMAGE_NAME}.txt + ln -s ${IMAGE_NAME}.txt ${DEPLOYDIR}/${IMAGE_LINK_NAME}.txt + install -m 0644 ${B}/${BOOTBIN_MANIFEST_FILE} ${DEPLOYDIR}/${IMAGE_NAME}.manifest + ln -s ${IMAGE_NAME}.manifest ${DEPLOYDIR}/${IMAGE_LINK_NAME}.manifest +} + +addtask deploy after do_compile + +SYSROOT_DIRS += "/boot" +FILES:${PN} += "/boot/${BOOTBIN_VER_FILE}" -- cgit v1.2.3-54-g00ecf