mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH] x86/boot: use zstd -19 if building for 32-bit
@ 2026-07-28 14:31 Mingcong Bai
  2026-07-28 14:42 ` Xi Ruoyao
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mingcong Bai @ 2026-07-28 14:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Kexy Biscuit, Xi Ruoyao, Mingcong Bai, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Nathan Chancellor, Nicolas Schier, Nick Terrell, David Sterba,
	Ard Biesheuvel, Jan Stancek, Josh Poimboeuf, Petr Mladek,
	Peter Zijlstra (Intel),
	Thomas Weißschuh, Simon Glass, Marco Elver, linux-kbuild

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@aosc.io>
---
 arch/x86/boot/compressed/Makefile | 5 +++++
 scripts/Makefile.lib              | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 07e0e64b9a98..2261fb0d4d1d 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -143,8 +143,13 @@ $(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
 	$(call if_changed,lzo_with_size)
 $(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
 	$(call if_changed,lz4_with_size)
+ifdef CONFIG_X86_32
+$(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
+	$(call if_changed,zstd_with_size)
+else
 $(obj)/vmlinux.bin.zst: $(vmlinux.bin.all-y) FORCE
 	$(call if_changed,zstd22_with_size)
+endif
 
 suffix-$(CONFIG_KERNEL_GZIP)	:= gz
 suffix-$(CONFIG_KERNEL_BZIP2)	:= bz2
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0718e39cedda..09910dc57af3 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -464,6 +464,9 @@ quiet_cmd_xzmisc = XZMISC  $@
 quiet_cmd_zstd = ZSTD    $@
       cmd_zstd = cat $(real-prereqs) | $(ZSTD) -19 > $@
 
+quiet_cmd_zstd = ZSTD    $@
+      cmd_zstd_with_size = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@
+
 quiet_cmd_zstd22 = ZSTD22  $@
       cmd_zstd22 = cat $(real-prereqs) | $(ZSTD) -22 --ultra > $@
 
-- 
2.55.0


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

end of thread, other threads:[~2026-07-29  1:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 14:31 [RFC PATCH] x86/boot: use zstd -19 if building for 32-bit Mingcong Bai
2026-07-28 14:42 ` Xi Ruoyao
2026-07-28 15:58 ` Ard Biesheuvel
2026-07-29  1:44   ` Mingcong Bai
2026-07-28 16:05 ` H. Peter Anvin

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®