summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-08-23 20:50:46 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2023-09-01 15:58:16 +0900
commit5e02797b8eb093ba73fcbdc6048d02a3f9fb7379 (patch)
tree55d377007bb888cf4b18c7ab1e1d7ee1cedf3f66 /scripts
parent2dfec887c0fd7d25d26b2ba7e60479208f9b6fb8 (diff)
kbuild: move more module installation code to scripts/Makefile.modinst
Move more relevant code to scripts/Makefile.modinst. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.modinst33
1 files changed, 31 insertions, 2 deletions
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 96fea7c5dbe1..5e2f98f0e991 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -11,6 +11,33 @@ include $(srctree)/scripts/Kbuild.include
install-y :=
+ifeq ($(KBUILD_EXTMOD)$(modules_sign_only),)
+
+# remove the old directory and symlink
+$(shell rm -fr $(MODLIB)/kernel $(MODLIB)/build)
+
+install-$(CONFIG_MODULES) += $(addprefix $(MODLIB)/, build modules.order)
+
+$(MODLIB)/build: FORCE
+ $(call cmd,symlink)
+
+quiet_cmd_symlink = SYMLINK $@
+ cmd_symlink = ln -s $(CURDIR) $@
+
+$(MODLIB)/modules.order: modules.order FORCE
+ $(call cmd,install_modorder)
+
+quiet_cmd_install_modorder = INSTALL $@
+ cmd_install_modorder = sed 's:^\(.*\)\.o$$:kernel/\1.ko:' $< > $@
+
+# Install modules.builtin(.modinfo) even when CONFIG_MODULES is disabled.
+install-y += $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo)
+
+$(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo): $(MODLIB)/%: % FORCE
+ $(call cmd,install)
+
+endif
+
modules := $(call read-file, $(MODORDER))
ifeq ($(KBUILD_EXTMOD),)
@@ -31,7 +58,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
install-$(CONFIG_MODULES) += $(modules)
-__modinst: $(modules)
+__modinst: $(install-y)
@:
#
@@ -92,14 +119,16 @@ $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
$(call cmd,strip)
$(call cmd,sign)
+ifdef CONFIG_MODULES
__modinst: depmod
PHONY += depmod
-depmod: $(modules)
+depmod: $(install-y)
$(call cmd,depmod)
quiet_cmd_depmod = DEPMOD $(MODLIB)
cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
+endif
else