Re: [RFC PATCH] x86/boot: use zstd -19 if building for 32-bit

From: Mingcong Bai

Date: Tue Jul 28 2026 - 21:47:57 EST


Hi Ard,

在 2026/7/28 23:58, Ard Biesheuvel 写道:


On Tue, 28 Jul 2026, at 17:31, Mingcong Bai wrote:
When using native build environments (that is, 32-bit x86 chroot/container
as build environment for 32-bit x86 binaries), `zstd -22' requests more
virtual memory than that could be allowed on 32-bit hosts.

Introduce `cmd_zstd_with_size' for CONFIG_X86_32 builds.

This is quite possibly just stupid... But there doesn't seem to be a way
to detect the host environment. So I'm sending this patch as a means to
ask for your opinions.

Any help would be greated appreciated.

Signed-off-by: Mingcong Bai <jeffbai@xxxxxxx>
---
arch/x86/boot/compressed/Makefile | 5 +++++
scripts/Makefile.lib | 3 +++
2 files changed, 8 insertions(+)


Doesn't this mean ZSTD -22 is generally broken on 32-bit? How is this
specific to the kernel?
It's not (and remains unresolved)[1] - as I mentioned in the email, I sent this patch out as a means to spark some discussion on how to approach this problem.

Nick Terrel mentioned in commit 48f7ddf785af ("init: Add support for zstd compressed kernel") that "zstd22 is used for kernel compression because it is decompressed in a single pass, so zstd doesn't need to allocate a window buffer." But I wonder if it resulted in tangible change in compression ratio - but I can do more testing.

[1]: https://github.com/facebook/zstd/issues/1964

Best Regards,
Mingcong Bai