Support compressed kernel images
My device apparently has a 32MiB size limit for a combination of kernel + initramfs + dtb + some overhead. Even when initramfs-tools is configured with MODULES=dep
, I'm getting dangerously close to hitting that limit. A good way to alleviate it is to compress the kernel, e.g. compressing vmlinuz-5.2.0-2-arm64
with lz4 -9
reduces its size from 18.9 MiB
to 8.0 MiB
. Another issue is that mainline kernel makefile (make bindeb-pkg
) packages a gzip
compressed kernel, which flash-kernel tries to make into an image without setting -C gzip
for mkimage
. This commit solves both problems at the same time by decompressing/recompressing appropriately based on a db field. This was initially based on the patch on the bug report (#831003), but I rewrote it beyond recognition.
I also tested this in combination with my depthcharge code; using either a debian-packaged kernel or a custom gzipped kernel, to be either used uncompressed, lz4 or lzma compressed.
I've uploaded a newer version since then, but don't have a flash-kernel-running device to test.