Skip to content

Commit 2a9c8c0

Browse files
saschahauerNicolas Schier
authored andcommitted
kbuild: add target to build a cpio containing modules
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 <[email protected]> Reviewed-by: Simon Glass <[email protected]> Tested-by: Simon Glass <[email protected]> Co-developed-by: Ahmad Fatoum <[email protected]> Signed-off-by: Ahmad Fatoum <[email protected]> Reviewed-by: Thomas Weißschuh <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Tested-by: Nicolas Schier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Nicolas Schier <[email protected]>
1 parent c83c956 commit 2a9c8c0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

scripts/Makefile.package

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,25 @@ tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar
189189
tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
190190
@:
191191

192+
# modules-cpio-pkg - generate an initramfs with the modules
193+
# ---------------------------------------------------------------------------
194+
195+
.tmp_modules_cpio: FORCE
196+
$(Q)$(MAKE) -f $(srctree)/Makefile
197+
$(Q)rm -rf $@
198+
$(Q)$(MAKE) -f $(srctree)/Makefile INSTALL_MOD_PATH=$@ modules_install
199+
200+
quiet_cmd_cpio = CPIO $@
201+
cmd_cpio = $(CONFIG_SHELL) $(srctree)/usr/gen_initramfs.sh -o $@ $<
202+
203+
modules-$(KERNELRELEASE)-$(ARCH).cpio: .tmp_modules_cpio
204+
$(Q)$(MAKE) $(build)=usr usr/gen_init_cpio
205+
$(call cmd,cpio)
206+
207+
PHONY += modules-cpio-pkg
208+
modules-cpio-pkg: modules-$(KERNELRELEASE)-$(ARCH).cpio
209+
@:
210+
192211
# perf-tar*-src-pkg - generate a source tarball with perf source
193212
# ---------------------------------------------------------------------------
194213

@@ -245,6 +264,7 @@ help:
245264
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
246265
@echo ' tarxz-pkg - Build the kernel as a xz compressed tarball'
247266
@echo ' tarzst-pkg - Build the kernel as a zstd compressed tarball'
267+
@echo ' modules-cpio-pkg - Build the kernel modules as cpio archive'
248268
@echo ' perf-tar-src-pkg - Build the perf source tarball with no compression'
249269
@echo ' perf-targz-src-pkg - Build the perf source tarball with gzip compression'
250270
@echo ' perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression'

0 commit comments

Comments
 (0)