[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aSdnuxCNjwAma4_X@derry.ads.avm.de>
Date: Wed, 26 Nov 2025 21:48:59 +0100
From: Nicolas Schier <nsc@...nel.org>
To: Ahmad Fatoum <a.fatoum@...gutronix.de>
Cc: Nathan Chancellor <nathan@...nel.org>, Simon Glass <sjg@...omium.org>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
kernel@...gutronix.de, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, Sascha Hauer <s.hauer@...gutronix.de>
Subject: Re: [PATCH v2 2/2] kbuild: add target to build a cpio containing
modules
On Tue, Nov 25, 2025 at 02:18:20PM +0100, Ahmad Fatoum wrote:
> From: Sascha Hauer <s.hauer@...gutronix.de>
>
> Add a new package target to build a cpio archive containing the kernel
> modules. This is particularly useful to supplement an existing initramfs
> with the kernel modules so that the root filesystem can be started with
> all needed kernel modules without modifying it.
>
> Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
> Reviewed-by: Simon Glass <sjg@...omium.org>
> Tested-by: Simon Glass <sjg@...omium.org>
> Co-developed-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@...gutronix.de>
> ---
> scripts/Makefile.package | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 74bcb9e7f7a4516473481468a0fcf700c3bead33..83bfcf7cb09fd2d69b97e0c19a2b99c728835e8d 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -189,6 +189,25 @@ tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar
> tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
> @:
>
> +# modules-cpio-pkg - generate an initramfs with the modules
> +# ---------------------------------------------------------------------------
> +
> +.tmp_modules_cpio: FORCE
> + $(Q)$(MAKE) -f $(srctree)/Makefile
> + $(Q)rm -rf $@
> + $(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
Do you know why '-f $(srctree)/Makefile' is necessary here? As this
and the make call two lines above call common top-level targets, I do
not see the reason for explicitly adding the Makefile path. Am I
missing something; or have you observed problems without '-f'?
> +
> +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)
Removing the '$(MAKE) $(build)=usr usr/gen_init_cpio' line and adding
PHONY += usr_gen_init_cpio
usr_gen_init_cpio: scripts_basic
$(Q)$(MAKE) $(build)=usr usr/gen_init_cpio
modules-cpio-pkg: usr_gen_init_cpio
to top-level Makefile could be used to allow make to compile
gen_init_cpio in parallel instead of sequential. And it simplifies a
possible move of gen_init_cpio from usr/ to scripts/, as Nathan
suggested.
What do you think? (Top-level Makefile addition should probably better
be integrated into patch 1.) I can also send this as a follow-up patch
after merging your patches.
Nevertheless,
Tested-by: Nicolas Schier <nsc@...nel.org>
If there are no further remarks, I am going to merge the patch set
before the weekend.
Thanks and kind regards,
Nicolas
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists