linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Add top-level target for building gen_init_cpio
@ 2025-11-28 20:01 Nicolas Schier
  2025-12-01 23:36 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Schier @ 2025-11-28 20:01 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Ahmad Fatoum, Sascha Hauer, Simon Glass, Thomas Weißschuh,
	linux-kbuild, linux-kernel, Nicolas Schier

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>
---
This is based on the patch set from
https://lore.kernel.org/linux-kbuild/20251125-cpio-modules-pkg-v2-0-aa8277d89682@pengutronix.de
---
 Makefile                 | 6 ++++++
 scripts/Makefile.package | 1 -
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 17cfa11ca716..d5750e5bd633 100644
--- a/Makefile
+++ b/Makefile
@@ -1383,6 +1383,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
@@ -1635,6 +1639,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
diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 83bfcf7cb09f..0ec946f9b905 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -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

---
base-commit: cb6649f6217c0331b885cf787f1d175963e2a1d2
change-id: 20251128-kbuild-add-top-level-target-for-building-gen_init_cpio-6401e0ee0710
prerequisite-message-id: 20251125-cpio-modules-pkg-v2-0-aa8277d89682@pengutronix.de
prerequisite-patch-id: 9132e567c46357daaf2bd728ff18bfda1c51a9cb
prerequisite-patch-id: 0dfe03db654169d314d3baaba8536a9bfc9bcc70

Best regards,
-- 
Nicolas


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

* Re: [PATCH] kbuild: Add top-level target for building gen_init_cpio
  2025-11-28 20:01 [PATCH] kbuild: Add top-level target for building gen_init_cpio Nicolas Schier
@ 2025-12-01 23:36 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2025-12-01 23:36 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: Nicolas Schier, Ahmad Fatoum, Sascha Hauer, Simon Glass,
	Thomas Weißschuh, linux-kbuild, linux-kernel

On Fri, Nov 28, 2025 at 09:01:55PM +0100, Nicolas Schier wrote:
> 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>

Do you want to take this for a late 6.19 features pull request or should
I pick it up during the 6.20 cycle?

> ---
>  Makefile                 | 6 ++++++
>  scripts/Makefile.package | 1 -
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 17cfa11ca716..d5750e5bd633 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1383,6 +1383,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
> @@ -1635,6 +1639,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
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 83bfcf7cb09f..0ec946f9b905 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -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
> 
> ---
> base-commit: cb6649f6217c0331b885cf787f1d175963e2a1d2
> change-id: 20251128-kbuild-add-top-level-target-for-building-gen_init_cpio-6401e0ee0710
> prerequisite-message-id: 20251125-cpio-modules-pkg-v2-0-aa8277d89682@pengutronix.de
> prerequisite-patch-id: 9132e567c46357daaf2bd728ff18bfda1c51a9cb
> prerequisite-patch-id: 0dfe03db654169d314d3baaba8536a9bfc9bcc70
> 
> Best regards,
> -- 
> Nicolas
> 

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

end of thread, other threads:[~2025-12-01 23:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-28 20:01 [PATCH] kbuild: Add top-level target for building gen_init_cpio Nicolas Schier
2025-12-01 23:36 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).