From bef2978876fa56df65ab0405bfe7d7102cb01fdc Mon Sep 17 00:00:00 2001 From: Samuel Dolt Date: Thu, 31 Aug 2023 16:07:44 +0200 Subject: [PATCH] nwl-image-fitimage: automatically add the fitimage as a CI artifact The nwl-image-fitimage is now integrated with the coreos-image-ci classes and automatically add the generated fitimage to the list of artifacts that need to be published by the CI --- .../classes/nwl-image-fitimage.bbclass | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/layers/meta-nwl-distro/classes/nwl-image-fitimage.bbclass b/layers/meta-nwl-distro/classes/nwl-image-fitimage.bbclass index c11099d..e272220 100644 --- a/layers/meta-nwl-distro/classes/nwl-image-fitimage.bbclass +++ b/layers/meta-nwl-distro/classes/nwl-image-fitimage.bbclass @@ -83,3 +83,25 @@ python __anonymous () { task = task.replace(f'initramfs_path="{deploy_dir_image}', f'initramfs_path="{imgdeploydir}') d.setVar('fitimage_assemble', task) } + +# Glue for coreos-image-ci.bbclass +# ============================================================================== + +def get_nwl_fitimage_ci_artifacts(d): + bundle = d.getVar('INITRAMFS_IMAGE_BUNDLE') + initramfs = d.getVar('INITRAMFS_IMAGE_NAME') + + # We only support fitimage with INITRAMFS_IMAGE_BUNDLE set to 0 + if bundle == "1": + bb.warn(f"Adding a fitimage built with INITRAMFS_IMAGE_BUNDLE into COREOS_CI_DEPLOY_ARTIFACTS is currently not supported") + return "" + + # If an initramfs is used, publish the fitImage that contains it + # otherwise the image without an initramfs + if initramfs.strip() != "": + return "fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}${KERNEL_FIT_BIN_EXT}" + else: + return "fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}${KERNEL_FIT_BIN_EXT}" + +# Add the generated fitImage to the list of artifacts to publish in the CI +COREOS_CI_DEPLOY_ARTIFACTS += "${@get_nwl_fitimage_ci_artifacts(d)}"