scripts/Makefile.package | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
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>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
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 v3:
- Drop comment added in v2, change is straight forward after dropping
the repeated slash prevention
- collect Thomas' and Nathan's Rb:
- Link to v2: https://lore.kernel.org/r/20260325-kbuild-modules-cpio-pkg-usr-merge-v2-1-339ac87d82ea@jannau.net
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..6d36786ba31cefaf5ae2c6e2537d421b5bfb7a06 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -195,7 +195,7 @@ 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
+ $(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 +264,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>
On Fri, 27 Mar 2026 09:30:29 +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`.
>
> [...]
Applied to kbuild/linux.git (kbuild-next-unstable), thanks!
[1/1] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
https://git.kernel.org/kbuild/c/b205a1a5
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped,
reverted or modified (e.g. trailers). Patches applied to the
kbuild-next-unstable branch are accepted pending wider testing in
linux-next and any post-commit review; they will generally be moved
to the kbuild-next branch in about a week if no issues are found.
Best regards,
--
Nicolas
On Tue, Mar 31, 2026 at 06:09:38PM +0200, Nicolas Schier wrote:
> On Fri, 27 Mar 2026 09:30:29 +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`.
> >
> > [...]
>
> Applied to kbuild/linux.git (kbuild-next-unstable), thanks!
>
> [1/1] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
> https://git.kernel.org/kbuild/c/b205a1a5
>
> Please look out for regression or issue reports or other follow up
> comments, as they may result in the patch/series getting dropped,
> reverted or modified (e.g. trailers). Patches applied to the
> kbuild-next-unstable branch are accepted pending wider testing in
> linux-next and any post-commit review; they will generally be moved
> to the kbuild-next branch in about a week if no issues are found.
>
> Best regards,
> --
> Nicolas
>
I made a mistake, please ignore. Sorry for the noise.
--
Nicolas
On Fri, 27 Mar 2026 09:30:29 +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`.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-fixes
Thanks!
[1/1] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH
https://git.kernel.org/kbuild/c/742de64b62b69
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
On Fri, Mar 27, 2026 at 09:30:29AM +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>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> 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 v3:
> - Drop comment added in v2, change is straight forward after dropping
> the repeated slash prevention
> - collect Thomas' and Nathan's Rb:
> - Link to v2: https://lore.kernel.org/r/20260325-kbuild-modules-cpio-pkg-usr-merge-v2-1-339ac87d82ea@jannau.net
>
Thanks!
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Tested-by: Nicolas Schier <nsc@kernel.org>
--
Nicolas
Hi,
On 3/27/26 9:30 AM, 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>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Thanks,
Ahmad
> 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 v3:
> - Drop comment added in v2, change is straight forward after dropping
> the repeated slash prevention
> - collect Thomas' and Nathan's Rb:
> - Link to v2: https://lore.kernel.org/r/20260325-kbuild-modules-cpio-pkg-usr-merge-v2-1-339ac87d82ea@jannau.net
>
> 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 | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..6d36786ba31cefaf5ae2c6e2537d421b5bfb7a06 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -195,7 +195,7 @@ 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
> + $(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 +264,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,
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
© 2016 - 2026 Red Hat, Inc.