From nobody Sun Feb 8 18:43:49 2026 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 5240D1B532F for ; Sat, 15 Nov 2025 14:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763217101; cv=none; b=MdS8B5n/f7PIW7SH7WKr+a0gxzz9FS2e51eqJsRy2rwe3xj5s5TrJNgUAh+LuCahYVmknThKMuDbr3Xq+tt/sK+LNd37YM6ZUqUtpb/sE87xXU/0UuA4ac0CAwNclFKNc8gaQ++nUbR5/XNkdEz3jBrSYyvsOITLSBq8Ba0ZhVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763217101; c=relaxed/simple; bh=rH2mmmw2NQnHWrzH+7KshY2pip4EbGFdE6Q7uHk65B0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=qYGRUZLdc3VUpfGZeOEIUZU51MIq5mWYHXEpsgVoGLWlmkitlJggcg1c0y4WWiRJEwTSw586QEDTWM6PW4ZvdDGJf+SxDvMQSSd3Bca/Mg6ZqcX0bAWd0tEOoYZguGiGSjLzof+X5FgLXG/T8ucbicurZKjYo+gorIOMQOix6H0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vKHJJ-0007iq-MR; Sat, 15 Nov 2025 15:31:29 +0100 Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vKHJI-000bLu-0r; Sat, 15 Nov 2025 15:31:28 +0100 Received: from localhost ([::1] helo=dude05.red.stw.pengutronix.de) by dude05.red.stw.pengutronix.de with esmtp (Exim 4.98.2) (envelope-from ) id 1vKHJI-0000000HHrX-0pY6; Sat, 15 Nov 2025 15:31:28 +0100 From: Ahmad Fatoum Date: Sat, 15 Nov 2025 15:21:51 +0100 Subject: [PATCH] kbuild: add target to build a cpio containing modules Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251115-cpio-modules-pkg-v1-1-01d5a0748442@pengutronix.de> X-B4-Tracking: v=1; b=H4sIAH6MGGkC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI1NDQ0NT3eSCzHzd3PyU0pzUYt2C7HRdc4MUC9NEM0sLS6MkJaC2gqLUtMw KsJHRsbW1AMG3FwhiAAAA X-Change-ID: 20251115-cpio-modules-pkg-70d85a69892b To: Nathan Chancellor , Nicolas Schier Cc: Simon Glass , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Sascha Hauer , Ahmad Fatoum X-Mailer: b4 0.14.2 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org From: Sascha Hauer 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 Co-developed-by: Ahmad Fatoum Signed-off-by: Ahmad Fatoum Reviewed-by: Simon Glass Tested-by: Simon Glass --- .gitignore | 5 +++++ Makefile | 2 +- scripts/Makefile.package | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 86a1ba0d90353962183b47c0c657ec877e5b2f9f..764d115400d90f0904b8f60ea88= 51a7860c16411 100644 --- a/.gitignore +++ b/.gitignore @@ -96,6 +96,11 @@ modules.order # /tar-install/ =20 +# +# modules directory (make cpio-modules-pkg) +# +/modules-install/ + # # pacman files (make pacman-pkg) # diff --git a/Makefile b/Makefile index fb4389aa5d5f1776f7bb5988102ed54f92491de7..19c7900d02ed5eee06f00820c13= 8591b42e895e1 100644 --- a/Makefile +++ b/Makefile @@ -1583,7 +1583,7 @@ CLEAN_FILES +=3D vmlinux.symvers modules-only.symvers= \ # Directories & files removed with 'make mrproper' MRPROPER_FILES +=3D include/config include/generated \ arch/$(SRCARCH)/include/generated .objdiff \ - debian snap tar-install PKGBUILD pacman \ + debian snap tar-install modules-install PKGBUILD pacman \ .config .config.old .version \ Module.symvers \ certs/signing_key.pem \ diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 74bcb9e7f7a4516473481468a0fcf700c3bead33..20eec9e2dec4dda3fa0ef64a15b= 80dccdcb55f90 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -189,6 +189,22 @@ tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE @: =20 +modules-install: FORCE + $(Q)$(MAKE) -f $(srctree)/Makefile + $(Q)rm -rf $@ + $(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=3D$@ modules_install + +quiet_cmd_cpio =3D CPIO $@ + cmd_cpio =3D $(srctree)/usr/gen_initramfs.sh $< > $@ + +modules-$(KERNELRELEASE)-$(ARCH).cpio: modules-install + $(Q)$(MAKE) -f $(srctree)/Makefile $(build)=3Dusr cpio-data=3D usr/gen_in= it_cpio + $(call cmd,cpio) + +PHONY +=3D cpio-modules-pkg +cpio-modules-pkg: modules-$(KERNELRELEASE)-$(ARCH).cpio + @: + # perf-tar*-src-pkg - generate a source tarball with perf source # ------------------------------------------------------------------------= --- =20 @@ -245,6 +261,7 @@ help: @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tar= ball' @echo ' tarxz-pkg - Build the kernel as a xz compressed tarbal= l' @echo ' tarzst-pkg - Build the kernel as a zstd compressed tarb= all' + @echo ' cpio-modules-pkg - Build the kernel modules as cpio archive' @echo ' perf-tar-src-pkg - Build the perf source tarball with no comp= ression' @echo ' perf-targz-src-pkg - Build the perf source tarball with gzip co= mpression' @echo ' perf-tarbz2-src-pkg - Build the perf source tarball with bz2 com= pression' --- base-commit: e9a6fb0bcdd7609be6969112f3fbfcce3b1d4a7c change-id: 20251115-cpio-modules-pkg-70d85a69892b Best regards, --=20 Ahmad Fatoum