public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
@ 2026-03-25 14:57 Janne Grunau
  2026-03-25 15:17 ` Thomas Weißschuh
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Janne Grunau @ 2026-03-25 14:57 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Ahmad Fatoum, Sascha Hauer
  Cc: Simon Glass, Thomas Weißschuh, linux-kbuild, linux-kernel,
	stable, Janne Grunau

The modules-cpio-pkg target added in commit 2a9c8c0b59d3 ("kbuild: add
target to build a cpio containing modules") is incompatible with
initramfs with merged /lib and /usr/lib directories [1]. "/lib" cannot
be a link and directory at the same time.
Respect a non-empty INSTALL_MOD_PATH in the modules-cpio-pkg target so
that `make INSTALL_MOD_PATH=/usr modules-cpio-pkg` results in the same
module install location as `make INSTALL_MOD_PATH=/usr modules_install`.

Tested with Fedora distribution initramfs produced by dracut.

Link: https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/ [1]
Fixes: 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
Cc: stable@vger.kernel.org
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Janne Grunau <j@jannau.net>
---
Hej,

this patch allows to produce modules-cpio initramfs which are compatible
with initramfs with merged /lib and /usr/lib (/lib as symlink to
/usr/lib). I expect initramfs of distributions with merged /usr to have
a merged /usr as well. This is at least true for Fedora initramfs built
with dracut.

Janne
---
Changes in v2:
- drop pointless avoidance of repeated slashes
- comment the changed Makefile rule
- break long modles-cpio-pkg help text to 2 lines
- imported Simon's Rb:
- add fixes tag for commit 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
- Link to v1: https://lore.kernel.org/r/20260320-kbuild-modules-cpio-pkg-usr-merge-v1-1-cee1ad1bb7cb@jannau.net
---
 scripts/Makefile.package | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..c19b88b346d0632cc99e74617d79b07d81d48635 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -195,7 +195,8 @@ tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
 .tmp_modules_cpio: FORCE
 	$(Q)$(MAKE) -f $(srctree)/Makefile
 	$(Q)rm -rf $@
-	$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
+	# Prepend INSTALL_MOD_PATH inside the staging dir
+	$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@/$(INSTALL_MOD_PATH) modules_install
 
 quiet_cmd_cpio = CPIO    $@
       cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $<
@@ -264,6 +265,7 @@ help:
 	@echo '  tarxz-pkg           - Build the kernel as a xz compressed tarball'
 	@echo '  tarzst-pkg          - Build the kernel as a zstd compressed tarball'
 	@echo '  modules-cpio-pkg    - Build the kernel modules as cpio archive'
+	@echo '                        (uses INSTALL_MOD_PATH inside the archive)'
 	@echo '  perf-tar-src-pkg    - Build the perf source tarball with no compression'
 	@echo '  perf-targz-src-pkg  - Build the perf source tarball with gzip compression'
 	@echo '  perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression'

---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260320-kbuild-modules-cpio-pkg-usr-merge-4266a460282c

Best regards,
-- 
Janne Grunau <j@jannau.net>


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

* Re: [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
  2026-03-25 14:57 [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Janne Grunau
@ 2026-03-25 15:17 ` Thomas Weißschuh
  2026-03-26  2:25 ` Nathan Chancellor
  2026-03-26 10:45 ` Janne Grunau
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-03-25 15:17 UTC (permalink / raw)
  To: Janne Grunau
  Cc: Nathan Chancellor, Nicolas Schier, Ahmad Fatoum, Sascha Hauer,
	Simon Glass, linux-kbuild, linux-kernel, stable

On Wed, Mar 25, 2026 at 03:57:25PM +0100, Janne Grunau wrote:
> The modules-cpio-pkg target added in commit 2a9c8c0b59d3 ("kbuild: add
> target to build a cpio containing modules") is incompatible with
> initramfs with merged /lib and /usr/lib directories [1]. "/lib" cannot
> be a link and directory at the same time.
> Respect a non-empty INSTALL_MOD_PATH in the modules-cpio-pkg target so
> that `make INSTALL_MOD_PATH=/usr modules-cpio-pkg` results in the same
> module install location as `make INSTALL_MOD_PATH=/usr modules_install`.
> 
> Tested with Fedora distribution initramfs produced by dracut.
> 
> Link: https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/ [1]
> Fixes: 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> Cc: stable@vger.kernel.org
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Janne Grunau <j@jannau.net>

Looks reasonable.

Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>


Thomas

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

* Re: [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
  2026-03-25 14:57 [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Janne Grunau
  2026-03-25 15:17 ` Thomas Weißschuh
@ 2026-03-26  2:25 ` Nathan Chancellor
  2026-03-26 10:45 ` Janne Grunau
  2 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2026-03-26  2:25 UTC (permalink / raw)
  To: Janne Grunau
  Cc: Nicolas Schier, Ahmad Fatoum, Sascha Hauer, Simon Glass,
	Thomas Weißschuh, linux-kbuild, linux-kernel, stable

On Wed, Mar 25, 2026 at 03:57:25PM +0100, Janne Grunau wrote:
> The modules-cpio-pkg target added in commit 2a9c8c0b59d3 ("kbuild: add
> target to build a cpio containing modules") is incompatible with
> initramfs with merged /lib and /usr/lib directories [1]. "/lib" cannot
> be a link and directory at the same time.
> Respect a non-empty INSTALL_MOD_PATH in the modules-cpio-pkg target so
> that `make INSTALL_MOD_PATH=/usr modules-cpio-pkg` results in the same
> module install location as `make INSTALL_MOD_PATH=/usr modules_install`.
> 
> Tested with Fedora distribution initramfs produced by dracut.
> 
> Link: https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/ [1]
> Fixes: 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> Cc: stable@vger.kernel.org
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Janne Grunau <j@jannau.net>

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> Hej,
> 
> this patch allows to produce modules-cpio initramfs which are compatible
> with initramfs with merged /lib and /usr/lib (/lib as symlink to
> /usr/lib). I expect initramfs of distributions with merged /usr to have
> a merged /usr as well. This is at least true for Fedora initramfs built
> with dracut.
> 
> Janne
> ---
> Changes in v2:
> - drop pointless avoidance of repeated slashes
> - comment the changed Makefile rule
> - break long modles-cpio-pkg help text to 2 lines
> - imported Simon's Rb:
> - add fixes tag for commit 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> - Link to v1: https://lore.kernel.org/r/20260320-kbuild-modules-cpio-pkg-usr-merge-v1-1-cee1ad1bb7cb@jannau.net
> ---
>  scripts/Makefile.package | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..c19b88b346d0632cc99e74617d79b07d81d48635 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -195,7 +195,8 @@ tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
>  .tmp_modules_cpio: FORCE
>  	$(Q)$(MAKE) -f $(srctree)/Makefile
>  	$(Q)rm -rf $@
> -	$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
> +	# Prepend INSTALL_MOD_PATH inside the staging dir
> +	$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@/$(INSTALL_MOD_PATH) modules_install
>  
>  quiet_cmd_cpio = CPIO    $@
>        cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $<
> @@ -264,6 +265,7 @@ help:
>  	@echo '  tarxz-pkg           - Build the kernel as a xz compressed tarball'
>  	@echo '  tarzst-pkg          - Build the kernel as a zstd compressed tarball'
>  	@echo '  modules-cpio-pkg    - Build the kernel modules as cpio archive'
> +	@echo '                        (uses INSTALL_MOD_PATH inside the archive)'
>  	@echo '  perf-tar-src-pkg    - Build the perf source tarball with no compression'
>  	@echo '  perf-targz-src-pkg  - Build the perf source tarball with gzip compression'
>  	@echo '  perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression'
> 
> ---
> base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
> change-id: 20260320-kbuild-modules-cpio-pkg-usr-merge-4266a460282c
> 
> Best regards,
> -- 
> Janne Grunau <j@jannau.net>
> 

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

* Re: [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
  2026-03-25 14:57 [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Janne Grunau
  2026-03-25 15:17 ` Thomas Weißschuh
  2026-03-26  2:25 ` Nathan Chancellor
@ 2026-03-26 10:45 ` Janne Grunau
  2026-03-26 13:09   ` Nicolas Schier
  2 siblings, 1 reply; 5+ messages in thread
From: Janne Grunau @ 2026-03-26 10:45 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Ahmad Fatoum, Sascha Hauer
  Cc: Simon Glass, Thomas Weißschuh, linux-kbuild, linux-kernel,
	stable

On Wed, Mar 25, 2026 at 03:57:25PM +0100, Janne Grunau wrote:
> The modules-cpio-pkg target added in commit 2a9c8c0b59d3 ("kbuild: add
> target to build a cpio containing modules") is incompatible with
> initramfs with merged /lib and /usr/lib directories [1]. "/lib" cannot
> be a link and directory at the same time.
> Respect a non-empty INSTALL_MOD_PATH in the modules-cpio-pkg target so
> that `make INSTALL_MOD_PATH=/usr modules-cpio-pkg` results in the same
> module install location as `make INSTALL_MOD_PATH=/usr modules_install`.
> 
> Tested with Fedora distribution initramfs produced by dracut.
> 
> Link: https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/ [1]
> Fixes: 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> Cc: stable@vger.kernel.org
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> Hej,
> 
> this patch allows to produce modules-cpio initramfs which are compatible
> with initramfs with merged /lib and /usr/lib (/lib as symlink to
> /usr/lib). I expect initramfs of distributions with merged /usr to have
> a merged /usr as well. This is at least true for Fedora initramfs built
> with dracut.
> 
> Janne
> ---
> Changes in v2:
> - drop pointless avoidance of repeated slashes
> - comment the changed Makefile rule
> - break long modles-cpio-pkg help text to 2 lines
> - imported Simon's Rb:
> - add fixes tag for commit 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> - Link to v1: https://lore.kernel.org/r/20260320-kbuild-modules-cpio-pkg-usr-merge-v1-1-cee1ad1bb7cb@jannau.net
> ---
>  scripts/Makefile.package | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..c19b88b346d0632cc99e74617d79b07d81d48635 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -195,7 +195,8 @@ tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
>  .tmp_modules_cpio: FORCE
>  	$(Q)$(MAKE) -f $(srctree)/Makefile
>  	$(Q)rm -rf $@
> -	$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
> +	# Prepend INSTALL_MOD_PATH inside the staging dir

The comment needs to be indented with spaces. With a tab it gets printed
to the shell.

I'll send a v3 tomorrow

Janne

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

* Re: [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
  2026-03-26 10:45 ` Janne Grunau
@ 2026-03-26 13:09   ` Nicolas Schier
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2026-03-26 13:09 UTC (permalink / raw)
  To: Janne Grunau
  Cc: Nathan Chancellor, Ahmad Fatoum, Sascha Hauer, Simon Glass,
	Thomas Weißschuh, linux-kbuild, linux-kernel, stable

On Thu, Mar 26, 2026 at 11:45:57AM +0100, Janne Grunau wrote:
> On Wed, Mar 25, 2026 at 03:57:25PM +0100, Janne Grunau wrote:
> > The modules-cpio-pkg target added in commit 2a9c8c0b59d3 ("kbuild: add
> > target to build a cpio containing modules") is incompatible with
> > initramfs with merged /lib and /usr/lib directories [1]. "/lib" cannot
> > be a link and directory at the same time.
> > Respect a non-empty INSTALL_MOD_PATH in the modules-cpio-pkg target so
> > that `make INSTALL_MOD_PATH=/usr modules-cpio-pkg` results in the same
> > module install location as `make INSTALL_MOD_PATH=/usr modules_install`.
> > 
> > Tested with Fedora distribution initramfs produced by dracut.
> > 
> > Link: https://systemd.io/THE_CASE_FOR_THE_USR_MERGE/ [1]
> > Fixes: 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> > Cc: stable@vger.kernel.org
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > Signed-off-by: Janne Grunau <j@jannau.net>
> > ---
> > Hej,
> > 
> > this patch allows to produce modules-cpio initramfs which are compatible
> > with initramfs with merged /lib and /usr/lib (/lib as symlink to
> > /usr/lib). I expect initramfs of distributions with merged /usr to have
> > a merged /usr as well. This is at least true for Fedora initramfs built
> > with dracut.
> > 
> > Janne
> > ---
> > Changes in v2:
> > - drop pointless avoidance of repeated slashes
> > - comment the changed Makefile rule
> > - break long modles-cpio-pkg help text to 2 lines
> > - imported Simon's Rb:
> > - add fixes tag for commit 2a9c8c0b59d3 ("kbuild: add target to build a cpio containing modules")
> > - Link to v1: https://lore.kernel.org/r/20260320-kbuild-modules-cpio-pkg-usr-merge-v1-1-cee1ad1bb7cb@jannau.net
> > ---
> >  scripts/Makefile.package | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> > index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..c19b88b346d0632cc99e74617d79b07d81d48635 100644
> > --- a/scripts/Makefile.package
> > +++ b/scripts/Makefile.package
> > @@ -195,7 +195,8 @@ tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
> >  .tmp_modules_cpio: FORCE
> >  	$(Q)$(MAKE) -f $(srctree)/Makefile
> >  	$(Q)rm -rf $@
> > -	$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
> > +	# Prepend INSTALL_MOD_PATH inside the staging dir
> 
> The comment needs to be indented with spaces. With a tab it gets printed
> to the shell.
> 
> I'll send a v3 tomorrow
> 
> Janne

Please just remove the comment.  With v2 the change is such simple that
it's obvious what is done here.

-- 
Nicolas

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

end of thread, other threads:[~2026-03-26 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 14:57 [PATCH v2] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Janne Grunau
2026-03-25 15:17 ` Thomas Weißschuh
2026-03-26  2:25 ` Nathan Chancellor
2026-03-26 10:45 ` Janne Grunau
2026-03-26 13:09   ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox