summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMing Liu <ming.liu@toradex.com>2022-03-28 15:23:55 +0200
committerMing Liu <ming.liu@toradex.com>2022-04-01 11:00:55 +0200
commit4d2ad76efd531a274375f81a7e3e4c0da65411f9 (patch)
treeb75d89c5e819787a970ceedcd289cfaf1c1fa0a0
parent4487e89561252487608e227d7077cb2b2d79f37c (diff)
toradex-fitimage.bbclass: introduce FIT_SUPPORTED_INITRAMFS_FSTYPES
It was found when a end user wants to build a squashfs type initramfs into fitimage, it just fails without printing out any error or warning messages, which is not right. Introduce a FIT_SUPPORTED_INITRAMFS_FSTYPES variable to avoid hard-coding the supported initramfs types, and it could be overridden in config files. Also break the build when none of a supported initramfs type is found. A similar change has been merged into OE, reference: https://lore.kernel.org/all/20220328141551.571676-1-liu.ming50@gmail.com Related-to: TEI-1005 Signed-off-by: Ming Liu <ming.liu@toradex.com>
-rw-r--r--classes/toradex-fitimage.bbclass10
1 files changed, 9 insertions, 1 deletions
diff --git a/classes/toradex-fitimage.bbclass b/classes/toradex-fitimage.bbclass
index 24fb2fc..f3ad492 100644
--- a/classes/toradex-fitimage.bbclass
+++ b/classes/toradex-fitimage.bbclass
@@ -7,6 +7,8 @@
inherit kernel-fitimage
+FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio squashfs"
+
#
# Override fitimage_assemble in kernel-fitimage.bbclass
#
@@ -81,14 +83,20 @@ fitimage_assemble() {
#
if [ "x${ramdiskcount}" = "x1" ] ; then
# Find and use the first initramfs image archive type we find
- for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz ext2.gz cpio; do
+ found=
+ for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
echo "Using $initramfs_path"
if [ -e "${initramfs_path}" ]; then
+ found=true
fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}"
break
fi
done
+
+ if [ -z "$found" ]; then
+ bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
+ fi
fi
fitimage_emit_section_maint ${1} sectend