kbuild: Add top-level target for building gen_init_cpio

Add a top-level target for building gen_init_cpio to prevent re-entering
kbuild for 'modules-cpio-pkg'.

The recently introduced target 'modules-cpio-pkg' depends on
gen_init_cpio but there is no simple way to add this dependency as a
prerequisite that can be built in parallel to other recipes.

Introducing the top-level target, enables fixing this and also prepares
a possible move of gen_init_cpio from usr/ to scripts/.

Signed-off-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20251128-kbuild-add-top-level-target-for-building-gen_init_cpio-v1-1-84c63a8fc8d4@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
This commit is contained in:
Nicolas Schier 2025-11-28 21:01:55 +01:00 committed by Nathan Chancellor
parent 18e2d526bf
commit f8e05c1063
No known key found for this signature in database
GPG key ID: 1D6B269171C01A96
2 changed files with 6 additions and 1 deletions

View file

@ -1417,6 +1417,10 @@ ifdef CONFIG_HEADERS_INSTALL
prepare: headers
endif
PHONY += usr_gen_init_cpio
usr_gen_init_cpio: scripts_basic
$(Q)$(MAKE) $(build)=usr usr/gen_init_cpio
PHONY += scripts_unifdef
scripts_unifdef: scripts_basic
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
@ -1669,6 +1673,8 @@ distclean: mrproper
# Packaging of the kernel to various formats
# ---------------------------------------------------------------------------
modules-cpio-pkg: usr_gen_init_cpio
%src-pkg: FORCE
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
%pkg: include/config/kernel.release FORCE

View file

@ -201,7 +201,6 @@ quiet_cmd_cpio = CPIO $@
cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $<
modules-$(KERNELRELEASE)-$(ARCH).cpio: .tmp_modules_cpio
$(Q)$(MAKE) $(build)=usr usr/gen_init_cpio
$(call cmd,cpio)
PHONY += modules-cpio-pkg