From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C00A40DFC5; Sat, 21 Mar 2026 15:21:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774106510; cv=none; b=b7JZn+aaRbxrgg/rOoix9eY3HGB68pBvQSC9d1QbPQgSksS5B/cEdKFXTabL0ckRY7xddffIEMWH9vEi4Kw+zJ7nHJIT6NOpfv+cFn1ZQ+09Phckj0JpJUL4eAuK52PDNMoeOAQkhqhAMZCbxhNM8t5pplIzLDzqetxBmHf3A78= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774106510; c=relaxed/simple; bh=907u5WBCJ4s8WuOb30TbiGpm7LvyoNFeDrgDS4NmWzo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FplzlKyanS1+jncivg6coZf1Rjq+jxx7RWn433HcwY+BY3WLee/5bprYeH47f91AKfOwD68Mx6AJcWS+CqqyKyRDlWXKXe+N63vmr3mz75+zerf+vJ1CCTbjacNNFYLUz8NrpEuF1OHedEgO6vzHbnzNU3bFWSJWrtDTWbio2fw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XrKAXgM1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XrKAXgM1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF32CC19421; Sat, 21 Mar 2026 15:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774106510; bh=907u5WBCJ4s8WuOb30TbiGpm7LvyoNFeDrgDS4NmWzo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XrKAXgM1MQfaHBiUYnCvCQijcQT/EhuXFbGOTnziudhMXRglCcTvxpURssUxCvBUW VYX2EwBxwVPCT5l8A1s8vLogFImTgLeLKWQ6KaCsoAo2t1+Il2JHRDLsNHg50Ax5Vz HftT6D8DmlSTHOMyNedci4+bQ2KQUnISrJmUof6begXedwnpwAjD4Atk6qNoDG72HO sROZHlzpNJI2c20SB211Z+KO5U+G229+XxFzgyhX+ihpugyZXaaTRTNNxiC36USlMU leyGstbzTakF21AwNHriFxbqogRGZv0g7zlhBz7TUvdXEmk7bmTB8kXKboAwwbL9Sa 0KihXbIYMPOVg== Date: Sat, 21 Mar 2026 16:18:46 +0100 From: Nicolas Schier To: Janne Grunau Cc: Nathan Chancellor , Ahmad Fatoum , Sascha Hauer , Simon Glass , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Message-ID: Mail-Followup-To: Nicolas Schier , Janne Grunau , Nathan Chancellor , Ahmad Fatoum , Sascha Hauer , Simon Glass , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260320-kbuild-modules-cpio-pkg-usr-merge-v1-1-cee1ad1bb7cb@jannau.net> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260320-kbuild-modules-cpio-pkg-usr-merge-v1-1-cee1ad1bb7cb@jannau.net> On Fri, Mar 20, 2026 at 03:30:32PM +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] > Signed-off-by: Janne Grunau > --- > 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. > > I'm not sure whether the trickery to avoid repeated '/' is justified. It > is necessary to add a slash between "$@" and a non empty > $(INSTALL_MOD_PATH) to avoid make failures due to non existing > .tmp_modules_cpio when INSTALL_MOD_PATH without leading slash is used. > modules-cpio-pkg`. > > Better or shorter ways to document this not completely obvious behavior > would be appreciated. > > Janne > --- > scripts/Makefile.package | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/scripts/Makefile.package b/scripts/Makefile.package > index 0ec946f9b905f74f8698d8d6967d22f5b76f64e0..ab18cf81622ae319380528c401f9aeb6d32070c6 100644 > --- a/scripts/Makefile.package > +++ b/scripts/Makefile.package > @@ -195,7 +195,9 @@ 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=$@$(if $(INSTALL_MOD_PATH),/$(INSTALL_MOD_PATH:/%=%)) \ > + modules_install Thanks for the patch along with its detailed description! For completeness: I'd rather use $(addprefix): INSTALL_MOD_PATH=$@$(addprefix /,$(INSTALL_MOD_PATH:/%=%)) but as POSIX states: | Multiple successive characters are considered to be the same | as one , except it is implementation-defined whether the case | of exactly two leading characters is treated specially. https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/ there is no need for handling possible repeated slashes here. So, from my point of view we can keep it as simple as: INSTALL_MOD_PATH=$@/$(INSTALL_MOD_PATH) as a trailing slash in INSTALL_MOD_PATH should not be a problem here. > > quiet_cmd_cpio = CPIO $@ > cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $< > @@ -263,7 +265,7 @@ help: > @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' > @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 ' modules-cpio-pkg - Build the kernel modules as cpio archive (modules installed in INSTALL_MOD_PATH (default: /))' Please break that line, e.g.: @echo ' modules-cpio-pkg - Build the kernel modules as cpio archive' @echo ' (modules installed in INSTALL_MOD_PATH (default: /))' Fixes: 2a9c8c0b59d3 (\"kbuild: add target to build a cpio containing modules\") Kind regards, Nicolas