Skip to content

Commit

Permalink
common: Improve "traditional FIT" image generation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wkz committed Aug 24, 2023
1 parent df64be1 commit d25b1a9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions board/common/mkfit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -79,7 +89,7 @@ cat <<EOF >$work/infix.its
arch = "$FIT_ARCH";
os = "linux";
$(cat $work/kernel-load.itsi)
compression = "none";
compression = "gzip";
data = /incbin/("$kernel");
};
Expand Down

0 comments on commit d25b1a9

Please sign in to comment.