From nobody Tue Dec 2 00:25:45 2025 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 8DF82219A86 for ; Tue, 25 Nov 2025 13:18:34 +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=1764076718; cv=none; b=OGcNS+SfKM/uz+bhFff/dfK72S1jgyp5U61NNi1q8ZAcoDt6FWXoxefhNL8XgfUs0jNh0pJ//cjHWqVtSiZ4uVwUDoLnd/XVlN1OtQROhJx3nf6SxUbsDBgJJwVL68/9gTSwsx6i/1gQD82MH1IRWPb4vhPAgWUkYy2iKKMpFgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764076718; c=relaxed/simple; bh=U3A6Xd9TSpMn+xkgCiCwE8rYfDb5pBA+PsQtjpsv/A0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T/WvczYn9E6a+xbrSDbKiNlSWqTaA4r3oSnOtBfQnLujS/MgIE6RQHJDRViszmiFmmG+NTWZdn6bbbjvGZwSnzZQ1OJNUjDbXpu5dO4yAeGnn0CBX2sdiZdLVP842K2v9TVt1xnTwHXCo6OpfIikb20akCslxCYuwxaTSQG1W9A= 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 1vNswA-00041j-Uo; Tue, 25 Nov 2025 14:18:30 +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 1vNswA-002PEZ-24; Tue, 25 Nov 2025 14:18:30 +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 1vNswA-0000000243F-2N7T; Tue, 25 Nov 2025 14:18:30 +0100 From: Ahmad Fatoum Date: Tue, 25 Nov 2025 14:18:20 +0100 Subject: [PATCH v2 2/2] 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: <20251125-cpio-modules-pkg-v2-2-aa8277d89682@pengutronix.de> References: <20251125-cpio-modules-pkg-v2-0-aa8277d89682@pengutronix.de> In-Reply-To: <20251125-cpio-modules-pkg-v2-0-aa8277d89682@pengutronix.de> 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 Reviewed-by: Simon Glass Tested-by: Simon Glass Co-developed-by: Ahmad Fatoum Signed-off-by: Ahmad Fatoum Tested-by: Nicolas Schier --- scripts/Makefile.package | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 74bcb9e7f7a4516473481468a0fcf700c3bead33..83bfcf7cb09fd2d69b97e0c19a2= b99c728835e8d 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -189,6 +189,25 @@ tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE @: =20 +# modules-cpio-pkg - generate an initramfs with the modules +# ------------------------------------------------------------------------= --- + +.tmp_modules_cpio: 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 $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $< + +modules-$(KERNELRELEASE)-$(ARCH).cpio: .tmp_modules_cpio + $(Q)$(MAKE) $(build)=3Dusr usr/gen_init_cpio + $(call cmd,cpio) + +PHONY +=3D modules-cpio-pkg +modules-cpio-pkg: modules-$(KERNELRELEASE)-$(ARCH).cpio + @: + # perf-tar*-src-pkg - generate a source tarball with perf source # ------------------------------------------------------------------------= --- =20 @@ -245,6 +264,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 ' modules-cpio-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' --=20 2.47.3