mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] m68k: add Zstandard-compressed vmlinux target
@ 2026-12-02  7:32 Artem Novak
  2026-12-02 23:38 ` Finn Thain
  2026-12-03 10:15 ` Daniel Palmer
  0 siblings, 2 replies; 5+ messages in thread
From: Artem Novak @ 2026-12-02  7:32 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel, Artem Novak

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@gmail.com>
---
 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
+endif
+
+CLEAN_FILES += vmlinux.gz vmlinux.bz2 vmlinux.zst
 
 archheaders:
 	$(Q)$(MAKE) $(build)=arch/m68k/kernel/syscalls all
-- 
2.56.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] m68k: add Zstandard-compressed vmlinux target
  2026-12-02  7:32 [PATCH] m68k: add Zstandard-compressed vmlinux target Artem Novak
@ 2026-12-02 23:38 ` Finn Thain
  2026-12-03  6:37   ` Artem Novak
  2026-12-03 10:15 ` Daniel Palmer
  1 sibling, 1 reply; 5+ messages in thread
From: Finn Thain @ 2026-12-02 23:38 UTC (permalink / raw)
  To: Artem Novak; +Cc: Geert Uytterhoeven, linux-m68k, linux-kernel


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@gmail.com>

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
$ 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] m68k: add Zstandard-compressed vmlinux target
  2026-12-02 23:38 ` Finn Thain
@ 2026-12-03  6:37   ` Artem Novak
  0 siblings, 0 replies; 5+ messages in thread
From: Artem Novak @ 2026-12-03  6:37 UTC (permalink / raw)
  To: Finn Thain; +Cc: Geert Uytterhoeven, linux-m68k, linux-kernel

Hello,

On Wed, Dec 2, 2026 at 5:38 PM Finn Thain <fthain@linux-m68k.org> wrote:
> With which bootloader did you test your patch? How shall reviewers test
> it?

I tested the decompressed kernel under QEMU,
but I haven't tested a bootloader loading the Zstandard compressed
image directly.

Regarding the reviewers part, I will provide steps on how to verify
the target in the v2.
Also how am I going to reach out to them?

> 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
> $

Oh I see. I'll revise the patch to v2 in a day or so.
Also one more thing: does your testing laptop have i386 instructions
or familiar?

Thanks
Artem.

>
>
> 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@gmail.com>
>
>
> > ---
> >  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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] m68k: add Zstandard-compressed vmlinux target
  2026-12-02  7:32 [PATCH] m68k: add Zstandard-compressed vmlinux target Artem Novak
  2026-12-02 23:38 ` Finn Thain
@ 2026-12-03 10:15 ` Daniel Palmer
  2026-12-03 10:44   ` Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Palmer @ 2026-12-03 10:15 UTC (permalink / raw)
  To: Artem Novak; +Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, Finn Thain

Hi Artem,

On Wed, 2 Dec 2026 at 16:32, Artem Novak <artem122novak@gmail.com> wrote:
>
> Add an optional vmlinux.zst target for building Zstandard-compressed
> m68k kernel images.

My comment is basically the same as what Finn already said but if you
are going to add another compression format to m68k make it lz4.
Anything else is not going to decompress fast enough to make it worth
loading a compressed kernel from disk or network and decompressing it.
lz4 also has an advantage over gzip in that it's not a complete
nightmare to do on demand IO for the compressed data.
With lz4 you have a block size and can fetch a block, decompress it
until all blocks are decompressed without much effort.

I think I even sent patches to add lz4 a while back, some of my m68k
machines are booting from lz4 kernels...

Thanks,

Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] m68k: add Zstandard-compressed vmlinux target
  2026-12-03 10:15 ` Daniel Palmer
@ 2026-12-03 10:44   ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2026-12-03 10:44 UTC (permalink / raw)
  To: Daniel Palmer; +Cc: linux-m68k, linux-kernel, Finn Thain, Artem Novak

Hi Daniel,

On Thu, Dec 3, 2026, at 11:15, Daniel Palmer wrote:
> I think I even sent patches to add lz4 a while back, some of my m68k
> machines are booting from lz4 kernels...

Waiting for v2, apparently ;-)

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                                            -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-03 10:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02  7:32 [PATCH] m68k: add Zstandard-compressed vmlinux target Artem Novak
2026-12-02 23:38 ` Finn Thain
2026-12-03  6:37   ` Artem Novak
2026-12-03 10:15 ` Daniel Palmer
2026-12-03 10:44   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®