zephyr-image: Add image artifacts to output files

Inherit image-artifact-names bbclass in zephyr-image.inc and add
image artifacts to output generated files.

Before:
zephyr-helloworld.elf

After:
zephyr-helloworld-{MACHINE}-{DATETIME}.elf

Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com>
This commit is contained in:
Sandeep Gundlupet Raju
2025-08-14 21:54:42 -06:00
committed by Lee Chee Yang
parent c21d75720f
commit d8f6fac0db

View File

@@ -1,16 +1,19 @@
require zephyr-kernel-src.inc
require zephyr-kernel-common.inc
inherit deploy
inherit deploy image-artifact-names
OECMAKE_SOURCEPATH = "${ZEPHYR_SRC_DIR}"
ZEPHYR_IMAGE_LINK_NAME ?= "${PN}-${MACHINE}"
ZEPHYR_IMAGE_BASE_NAME ?= "${PN}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
do_install() {
install -d ${D}/firmware
for output in ${ZEPHYR_MAKE_OUTPUT}; do
if [ -f ${B}/zephyr/${output} ];
then
output_img=$(echo ${output} | sed -e "s/zephyr/${PN}/g")
output_img=$(echo ${output} | sed -e "s/zephyr/${ZEPHYR_IMAGE_BASE_NAME}/g")
install -D ${B}/zephyr/${output} ${D}/firmware/${output_img}
fi
done
@@ -20,6 +23,14 @@ INSANE_SKIP += "ldflags buildpaths"
SYSROOT_DIRS += "/firmware"
do_deploy() {
cp ${D}/firmware/* ${DEPLOYDIR}/
for output in ${ZEPHYR_MAKE_OUTPUT}; do
if [ -f ${B}/zephyr/${output} ];
then
output_img=$(echo ${output} | sed -e "s/zephyr/${ZEPHYR_IMAGE_BASE_NAME}/g")
output_img_link=$(echo ${output} | sed -e "s/zephyr/${ZEPHYR_IMAGE_LINK_NAME}/g")
cp ${B}/zephyr/${output} ${DEPLOYDIR}/${output_img}
ln -sf ${output_img} ${DEPLOYDIR}/${output_img_link}
fi
done
}
addtask deploy after do_install