mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
Since commit48ebe1cbbe("kbuild: compress the kernel with pigz if available"), cmd_gzip runs pigz through scripts/jobserver-exec, which takes the job slots make has free. GNU Make passes the jobserver pipe only to recipes it treats as recursive, but leaves --jobserver-auth in MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so jobserver-exec cannot open it, runs pigz on one thread, and prints: WARNING: Unable to reopen jobserver read-side pipe: FileNotFoundError(2, 'No such file or directory') Mark every recipe that can run cmd_gzip as recursive with "+", as commitecab4115c4("kbuild: mark `rustc` (and others) invocations as recursive") did for rustc. Besides the $(call if_changed,gzip) rules, this covers those that choose gzip through a variable: the built-in initramfs in usr/Makefile (which rcutorture's kvm.sh builds), the EFI zboot image, and the arm, csky, and mips compressed images. As with rustc, "make -n" now runs these recipes, including those that choose through a variable when they select another compressor. Also update the gzip entry in Documentation/kbuild/makefiles.rst, as suggested in review. Tested with GNU Make 4.3 plus CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64, on ARCH=x86_64, arm64, and arm defconfig, and ARCH=x86_64 defconfig with a built-in initramfs: none of them prints the warning, and pigz gets the free job slots (-p 54, 64, and 50 for the kernel image). Without this change, the x86_64 builds print it for the kernel image and for the initramfs. Reported-by: Paul E. McKenney <paulmck@kernel.org> Closes: https://lore.kernel.org/all/0ddb5e5e-f801-444c-aa98-0cfe814a3026@paulmck-laptop/ Fixes:48ebe1cbbe("kbuild: compress the kernel with pigz if available") Assisted-by: LLM Reviewed-by: Nicolas Schier <n.schier@fritz.com> Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org> Signed-off-by: Kees Cook <kees@kernel.org> Tested-by: Paul E. McKenney <paulmck@kernel.org> Link: https://patch.msgid.link/20261010081914.540611-1-kees@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
73 lines
2.2 KiB
Makefile
73 lines
2.2 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# Makefile for the Sparc boot stuff.
|
|
#
|
|
# Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
|
# Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
|
|
|
|
ROOT_IMG := /usr/src/root.img
|
|
ELFTOAOUT := elftoaout
|
|
|
|
hostprogs := piggyback
|
|
targets := tftpboot.img image zImage vmlinux.aout
|
|
clean-files := System.map
|
|
|
|
quiet_cmd_elftoaout = ELFTOAOUT $@
|
|
cmd_elftoaout = $(ELFTOAOUT) $(obj)/image -o $@
|
|
quiet_cmd_piggy = PIGGY $@
|
|
cmd_piggy = $(obj)/piggyback $(BITS) $@ System.map $(ROOT_IMG)
|
|
quiet_cmd_strip = STRIP $@
|
|
cmd_strip = $(STRIP) -R .comment -R .note -K sun4u_init -K _end -K _start $< -o $@
|
|
|
|
ifeq ($(CONFIG_SPARC64),y)
|
|
|
|
# Actual linking
|
|
|
|
$(obj)/zImage: $(obj)/image FORCE
|
|
+$(call if_changed,gzip)
|
|
@$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
|
|
|
|
$(obj)/vmlinux.aout: vmlinux FORCE
|
|
$(call if_changed,elftoaout)
|
|
@$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
|
|
else
|
|
|
|
$(obj)/zImage: $(obj)/image FORCE
|
|
$(call if_changed,strip)
|
|
@$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
|
|
|
|
# The following lines make a readable image for U-Boot.
|
|
# uImage - Binary file read by U-boot
|
|
# uImage.o - object file of uImage for loading with a
|
|
# flash programmer understanding ELF.
|
|
|
|
OBJCOPYFLAGS_image.bin := -S -O binary -R .note -R .comment
|
|
$(obj)/image.bin: $(obj)/image FORCE
|
|
$(call if_changed,objcopy)
|
|
|
|
$(obj)/image.gz: $(obj)/image.bin FORCE
|
|
+$(call if_changed,gzip)
|
|
|
|
UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR)
|
|
UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
|
|
UIMAGE_COMPRESSION = gzip
|
|
|
|
quiet_cmd_uimage.o = UIMAGE.O $@
|
|
cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \
|
|
-r -b binary $@ -o $@.o
|
|
|
|
targets += uImage
|
|
$(obj)/uImage: $(obj)/image.gz FORCE
|
|
$(call if_changed,uimage)
|
|
$(call if_changed,uimage.o)
|
|
@$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
|
|
|
|
endif
|
|
|
|
$(obj)/image: vmlinux FORCE
|
|
$(call if_changed,strip)
|
|
@$(kecho) 'Kernel: $@ is ready' '(#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
|
|
|
|
$(obj)/tftpboot.img: $(obj)/image $(obj)/piggyback System.map $(ROOT_IMG) FORCE
|
|
$(call if_changed,elftoaout)
|
|
$(call if_changed,piggy)
|