From d25b1a9e4b6476ff7cd50497f79497000de4f309 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 24 Aug 2023 09:22:11 +0200 Subject: [PATCH] common: Improve "traditional FIT" image generation Make the traditional FITs smaller by: - Filtering out the kernel image from the rootfs, since the FIT way is to ship it separately. - Gzipping the kernel in the FIT, since aarch64 uses the uncompressed "Image" format, and squashfs won't take care of it for us. --- board/common/mkfit.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/board/common/mkfit.sh b/board/common/mkfit.sh index 9595a1f1a..c0e132ad7 100755 --- a/board/common/mkfit.sh +++ b/board/common/mkfit.sh @@ -18,12 +18,22 @@ load_cfg() load_cfg [ "$FIT_IMAGE" = "y" ] || exit 0 -work=$(pwd)/build/fit-image-local +work=$BUILD_DIR/fit-image-local dtbs=$(find $BINARIES_DIR -name '*.dtb') kernel=$(find $BINARIES_DIR -name '*Image' | head -n1) squash=$BINARIES_DIR/rootfs.squashfs mkdir -p $work +gzip <$kernel >$work/Image.gz +kernel=$work/Image.gz + +rm -rf $work/rootfs +unsquashfs -f -d $work/rootfs $squash +rm -f $work/rootfs/boot/*Image + +squash=$work/rootfs-no-kernel.squashfs +rm -f $squash +mksquashfs $work/rootfs $squash # mkimage will only align images to 4 bytes, but U-Boot will leave # both DTB and ramdisk in place when starting the kernel. So we pad @@ -79,7 +89,7 @@ cat <$work/infix.its arch = "$FIT_ARCH"; os = "linux"; $(cat $work/kernel-load.itsi) - compression = "none"; + compression = "gzip"; data = /incbin/("$kernel"); };