Re: [PATCH] m68k: add Zstandard-compressed vmlinux target

From: Finn Thain

Date: Wed Dec 02 2026 - 18:38:10 EST



On Wed, 2 Dec 2026, Artem Novak wrote:

> Add an optional vmlinux.zst target for building Zstandard-compressed
> m68k kernel images.
>
> Follow the existing vmlinux.gz and vmlinux.bz2 targets, including
> stripping vmlinux when CONFIG_KGDB is disabled, and add the
> generated artifact to CLEAN_FILES.
>
> Signed-off-by: Artem Novak <artem122novak@xxxxxxxxx>

With which bootloader did you test your patch? How shall reviewers test
it?

> ---
> arch/m68k/Makefile | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
> index 0abcf994ce55..27086950e7ae 100644
> --- a/arch/m68k/Makefile
> +++ b/arch/m68k/Makefile
> @@ -124,7 +124,18 @@ else
> $(KBZIP2) -1c vmlinux >vmlinux.bz2
> endif
>
> -CLEAN_FILES += vmlinux.gz vmlinux.bz2
> +vmlinux.zst: vmlinux
> +
> +ifndef CONFIG_KGDB
> + cp vmlinux vmlinux.tmp
> + $(STRIP) vmlinux.tmp
> + $(ZSTD) -19 -c vmlinux.tmp >vmlinux.zst
> + rm vmlinux.tmp
> +else
> + $(ZSTD) -19 -c vmlinux >vmlinux.zst

A compression level of 19 would be infeasible on m68k hardware as it's too
expensive to uncompress it. Compared to level 1, level 19 costs about 30x
the CPU time (measured on this IA32 laptop, with huge caches relative to
68040).

Recall that any bootloader needs sufficient RAM for the dictionary, the
uncomressed kernel image, plus an initrd, as well as whatever overhead is
imposed by the loader operating system. So your code probably won't work
on small systems (anything with less than about 32 MB of memory).

$ f=vmlinux ; zstd -1 -c < $f | ( time zstd -M1M -dc ) | cmp - $f

real 0m0.089s
user 0m0.037s
sys 0m0.000s
$ f=vmlinux ; zstd -19 -c < $f | ( time zstd -M8M -dc ) | cmp - $f

real 0m2.835s
user 0m0.049s
sys 0m0.005s
$ f=vmlinux ; zstd -19 -c < $f | ( time zstd -M7M -dc ) | cmp - $f
/*stdin*\ : Decoding error (36) : Frame requires too much memory for decoding
/*stdin*\ : Window size larger than maximum : 8388608 > 7340032
/*stdin*\ : Use --long=23 or --memory=8MB

real 0m1.404s
user 0m0.002s
sys 0m0.000s
cmp: EOF on '-' which is empty
$