Re: [RFC PATCH] x86/boot: use zstd -19 if building for 32-bit
"H. Peter Anvin" <[email protected]> Tue, 28 Jul 2026 09:05:32 -0700
| Newsgroups | org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On July 28, 2026 7:31:35 AM PDT, Mingcong Bai <jeffbai@aosc=2Eio> wrote:
>When using native build environments (that is, 32-bit x86 chroot/containe=
r
>as build environment for 32-bit x86 binaries), `zstd -22' requests more
>virtual memory than that could be allowed on 32-bit hosts=2E
>
>Introduce `cmd_zstd_with_size' for CONFIG_X86_32 builds=2E
>
>This is quite possibly just stupid=2E=2E=2E But there doesn't seem to be =
a way
>to detect the host environment=2E So I'm sending this patch as a means to
>ask for your opinions=2E
>
>Any help would be greated appreciated=2E
>
>Signed-off-by: Mingcong Bai <jeffbai@aosc=2Eio>
>---
> arch/x86/boot/compressed/Makefile | 5 +++++
> scripts/Makefile=2Elib | 3 +++
> 2 files changed, 8 insertions(+)
>
>diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed=
/Makefile
>index 07e0e64b9a98=2E=2E2261fb0d4d1d 100644
>--- a/arch/x86/boot/compressed/Makefile
>+++ b/arch/x86/boot/compressed/Makefile
>@@ -143,8 +143,13 @@ $(obj)/vmlinux=2Ebin=2Elzo: $(vmlinux=2Ebin=2Eall-y)=
FORCE
> $(call if_changed,lzo_with_size)
> $(obj)/vmlinux=2Ebin=2Elz4: $(vmlinux=2Ebin=2Eall-y) FORCE
> $(call if_changed,lz4_with_size)
>+ifdef CONFIG_X86_32
>+$(obj)/vmlinux=2Ebin=2Ezst: $(vmlinux=2Ebin=2Eall-y) FORCE
>+ $(call if_changed,zstd_with_size)
>+else
> $(obj)/vmlinux=2Ebin=2Ezst: $(vmlinux=2Ebin=2Eall-y) FORCE
> $(call if_changed,zstd22_with_size)
>+endif
>=20
> suffix-$(CONFIG_KERNEL_GZIP) :=3D gz
> suffix-$(CONFIG_KERNEL_BZIP2) :=3D bz2
>diff --git a/scripts/Makefile=2Elib b/scripts/Makefile=2Elib
>index 0718e39cedda=2E=2E09910dc57af3 100644
>--- a/scripts/Makefile=2Elib
>+++ b/scripts/Makefile=2Elib
>@@ -464,6 +464,9 @@ quiet_cmd_xzmisc =3D XZMISC $@
> quiet_cmd_zstd =3D ZSTD $@
> cmd_zstd =3D cat $(real-prereqs) | $(ZSTD) -19 > $@
>=20
>+quiet_cmd_zstd =3D ZSTD $@
>+ cmd_zstd_with_size =3D { cat $(real-prereqs) | $(ZSTD) -19; $(size=
_append); } > $@
>+
> quiet_cmd_zstd22 =3D ZSTD22 $@
> cmd_zstd22 =3D cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
>=20
This is really just stupid=2E Basing it on the config setting is just plai=
n wrong=2E