Commit 46cccf0b authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Use list of modules for "make modules_install"

Since we rely on our list of all modules for building anyway, we
can as well use it to install the modules. So we don't need to
descend in that step anymore, speeding it up, though it's not
a particularly performance-critical area.
parent 2ec54bc1
...@@ -513,7 +513,7 @@ modules: $(SUBDIRS) $(if $(CONFIG_MODVERSIONS),vmlinux) ...@@ -513,7 +513,7 @@ modules: $(SUBDIRS) $(if $(CONFIG_MODVERSIONS),vmlinux)
# Install modules # Install modules
.PHONY: modules_install .PHONY: modules_install
modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post modules_install: _modinst_ _modinst_post
.PHONY: _modinst_ .PHONY: _modinst_
_modinst_: _modinst_:
...@@ -521,6 +521,7 @@ _modinst_: ...@@ -521,6 +521,7 @@ _modinst_:
@rm -f $(MODLIB)/build @rm -f $(MODLIB)/build
@mkdir -p $(MODLIB)/kernel @mkdir -p $(MODLIB)/kernel
@ln -s $(TOPDIR) $(MODLIB)/build @ln -s $(TOPDIR) $(MODLIB)/build
$(Q)$(MAKE) -rR -f scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a # If System.map exists, run depmod. This deliberately does not have a
# dependency on System.map since that would run the dependency tree on # dependency on System.map since that would run the dependency tree on
...@@ -533,13 +534,9 @@ else ...@@ -533,13 +534,9 @@ else
depmod_opts := -b $(INSTALL_MOD_PATH) -r depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif endif
.PHONY: _modinst_post .PHONY: _modinst_post
_modinst_post: _modinst_post: _modinst_
if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
$(patsubst %, _modinst_%, $(SUBDIRS)) :
$(Q)$(MAKE) -rR -f scripts/Makefile.modinst obj=$(patsubst _modinst_%,%,$@)
else # CONFIG_MODULES else # CONFIG_MODULES
# Modules not configured # Modules not configured
......
...@@ -2,33 +2,38 @@ ...@@ -2,33 +2,38 @@
# Installing modules # Installing modules
# ========================================================================== # ==========================================================================
src := $(obj) .PHONY: __modinst
__modinst:
.PHONY: modules_install include scripts/Makefile.lib
modules_install:
include .config #
include $(obj)/Makefile __modules := $(shell cd $(MODVERDIR); cat *.mod)
modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
include scripts/Makefile.lib ifneq ($(filter-out $(modules),$(__modules)),)
$(warning *** Uh-oh, you have stale module entries. You messed with SUBDIRS, do not complain if something goes wrong.)
endif
# ========================================================================== .PHONY: $(modules)
__modinst: $(modules)
@:
# Modules built within the kernel tree
quiet_cmd_modules_install = INSTALL $(obj-m:.o=.ko) quiet_cmd_modules_install = INSTALL $(obj-m:.o=.ko)
cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \ cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(@D); \
cp $(obj-m:.o=.ko) $(MODLIB)/kernel/$(obj) cp $@ $(MODLIB)/kernel/$(@D)
modules_install: $(subdir-ym) $(filter-out ../% /%,$(modules)):
ifneq ($(obj-m:.o=.ko),)
$(call cmd,modules_install) $(call cmd,modules_install)
else
@:
endif
# Descending # Modules built outside just go into extra
# ---------------------------------------------------------------------------
quiet_cmd_modules_install_extra = INSTALL $(obj-m:.o=.ko)
cmd_modules_install_extra = mkdir -p $(MODLIB)/extra; \
cp $@ $(MODLIB)/extra
.PHONY: $(subdir-ym) $(filter ../% /%,$(modules)):
$(subdir-ym): $(call cmd,modules_install_extra)
$(Q)$(MAKE) -rR -f scripts/Makefile.modinst obj=$@
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment