Kernels and ipks can be zopfli compressed. Should they be?

I have a script to automate the build process for my access points that uses zopfli (think of it as gzip -11 if you've not head of it) rather than the standard gzip tool, and it saves around 100-120KB. Should I submit a PR?

I've also found that the ipk files can be reduced 5-8% by repacking them.

Keep in mind that in the end, the size of the ipk packages doesn't really matter all that much, what does matter if the on-flash result (be it as part of the squashfs or the overlay, both of which use their own compression). Depending on the details, those would be lzma/ xz, which should provide smaller results than gzip based compressors.

I suspect that were ipk packages to be included in squashfs it would probably be best to repack them with no compression at all (retaining gzip containers for compatibility).

Packages are not included in the SquashFS, their contents are installed and the packages are registered as such. So as slh explains, it does not matter how they are compressed. SquashFS has its own compression method unrelated to the split packages which meant for user installs onto the overlays (or which are decompressed when integrated into a custom image).

I've seen some custom builds that include IPKs in the squashfs (which doesn't seem particularly sensible) and in general they're not big enough to matter, so... let's focus this discussion on kernels?

The kernel generally seems to be in a separate flash partition, though AFAIK it's possible to load it from a filesystem as well.

In cases where it's in a separate partition, it probably only makes sense to try to shrink it further if it exceeds the size of that partition by a small amount (I've never seen zopfli give more than a 10% improvement, maybe have that be the cut off of not even trying).

How the kernel gets compressed is mandated by the (OEM-) bootloader, which is often very picky about the details (down to dictionary sizes and even more exotic settings, in other words, this is nothing to experiment with, unless you have a good reason to do so). Wherever possible, that would be lzma or xz, which both should be better than zopfli.

1 Like