From 0472f407a38eaf4445e6287e70151b7c2d6add2a Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Mon, 28 Mar 2022 15:23:55 +0200 Subject: 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 (cherry picked from commit 4d2ad76efd531a274375f81a7e3e4c0da65411f9) --- classes/toradex-fitimage.bbclass | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'classes') 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 -- cgit v1.2.3