From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a2-smtp.messagingengine.com (fout-a2-smtp.messagingengine.com [103.168.172.145]) (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 BA3613EDAA4; Wed, 25 Mar 2026 14:48:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774450111; cv=none; b=abdlH5aUvJE9/HBWm0rU3MYVhz4ef/GEOR9t+VJ7iWxlzuA4d4sBUbTvgNoxeT6lEeLStHByRymofcyubtUeF9A4AEgt90bbbPWcl5wzQnbiNSYXBRYU38k3pN+KsghAH4BMnmEV1YOsAtco0qD6iBc/nuq/AQQ8n8T6Jw2fJQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774450111; c=relaxed/simple; bh=TDzhfhyTp/262lNODLpUml/v+J801pwk4JGI64fkrV4=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sqhJ3FLjR3+H9cb8bg/bVJpw4DzuhkvhM1wE1nCBujSlxH77lk7xF6h5kgSkBLAS1crlwsflnJghu+rcZNJCWUuOl5HDARrhxr6Q2aa+0TuuCA9TGxdStgoQUbAh28TfKk1pSiGkHAx7JNBbCy7c5NHOrMSlEqFSDyPbk2l4o1k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jannau.net; spf=pass smtp.mailfrom=jannau.net; dkim=pass (2048-bit key) header.d=jannau.net header.i=@jannau.net header.b=SxNfTh8Z; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=2VFyPLGA; arc=none smtp.client-ip=103.168.172.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jannau.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jannau.net header.i=@jannau.net header.b="SxNfTh8Z"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="2VFyPLGA" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id B6836EC0276; Wed, 25 Mar 2026 10:48:28 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Wed, 25 Mar 2026 10:48:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jannau.net; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1774450108; x=1774536508; bh=t+4aDi00V9 A0AOTTZWe7F8ddfx8iFgH3+qtpkTiAfRg=; b=SxNfTh8ZhzR1146kREz6NJzfj6 P+AaIXoehugnmBMRNuBSqKnA7XmA3ZY+7s9oc/XVCp4/0+MqKN4jn72IkNGiYvjX RwBe7IEv+fxcTF6x2zyJ7tPCt4Fdhse6wadUA431xWiKKPKSzLivybajLpu8tmW5 bLlDhyadm7Au62qjew4MAlexDTkSr5/+1nYK/yBmL6gpIy9mpOxxgdwXBB1WKXR6 FTkigC5zKXE0mciFYYOU/h4m7ZE7ZX39DS42Cg7yvwibcaZs6LQAUylfb9j7jVRf lLfMPJLpmrz4+9XWqd2qcYzfQ3J08LfZokTOOaMl3whJcubBwzvAjU2o0tqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1774450108; x=1774536508; bh=t+4aDi00V9A0AOTTZWe7F8ddfx8iFgH3+qt pkTiAfRg=; b=2VFyPLGAkDOSJaWwjyl8uDfQwbHMJml7BiQgdWPG/9eCPFgrFJg O/+jCWR6uxKCY4BuGVZKUroRDXk1XM9V7rEar/V0kbaJzIkkQJlXOtyg4sFD3XSQ H4IoXorAKq+0OHXG+1nSD5nBm5uLa+hN2pP9V7gbuU69A2ot7XXzJRTSNjqONwil dXcOvGMYpbJY+XtX9rmjl2NInyp/d6Z9Ozzg5SmPJvXk4fWtmvh39mkymdbHfuy3 Mg7HK5LK++leEf/Mr0kwySWhrnSOp8txR1zLENfEHojayMwmdWg6tF30awAUZqYU BGTMC3flHOLisLXl53IxsxZc0NArrkOe3Ng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefvdegjeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvffukfhfgggtuggjsehttdertddttdejnecuhfhrohhmpeflrghnnhgvucfi rhhunhgruhcuoehjsehjrghnnhgruhdrnhgvtheqnecuggftrfgrthhtvghrnhepleefge evleffudegtdelgfejjeejheekieegueeivdeihfeljefhkeevieevtedtnecuffhomhgr ihhnpehshihsthgvmhgurdhiohdpohhpvghnghhrohhuphdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjsehjrghnnhgruhdrnhgv thdpnhgspghrtghpthhtohepkedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepnh hstgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepnhgrthhhrghnsehkvghrnhgvlhdr ohhrghdprhgtphhtthhopegrrdhfrghtohhumhesphgvnhhguhhtrhhonhhigidruggvpd hrtghpthhtohepshdrhhgruhgvrhesphgvnhhguhhtrhhonhhigidruggvpdhrtghpthht ohepshhjghestghhrhhomhhiuhhmrdhorhhgpdhrtghpthhtohepthhhohhmrghsrdifvg hishhsshgthhhuhheslhhinhhuthhrohhnihigrdguvgdprhgtphhtthhopehlihhnuhig qdhksghuihhlugesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuh igqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i47b949f6:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 25 Mar 2026 10:48:28 -0400 (EDT) Date: Wed, 25 Mar 2026 15:48:26 +0100 From: Janne Grunau To: Nicolas Schier , Nathan Chancellor , Ahmad Fatoum , Sascha Hauer , Simon Glass , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kbuild: modules-cpio-pkg: Respect INSTALL_MOD_PATH Message-ID: <20260325144826.GA2137845@robin.jannau.net> 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=utf-8 Content-Disposition: inline In-Reply-To: On Sat, Mar 21, 2026 at 04:18:46PM +0100, Nicolas Schier wrote: > 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/ argh, I did read this but confused myself by the second part to think it was only for leading slashes. > 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. ack, I'll just do that and I would have sent it if I did not confuse myself with the POSIX wording. > > > > > 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\") I saw it more as an additional thing but without the complications of suppressing repeated slashes the change is easy enough thanks, Janne