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)
# Install modules
.PHONY: modules_install
modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post
modules_install: _modinst_ _modinst_post
.PHONY: _modinst_
_modinst_:
......@@ -521,6 +521,7 @@ _modinst_:
@rm -f $(MODLIB)/build
@mkdir -p $(MODLIB)/kernel
@ln -s $(TOPDIR) $(MODLIB)/build
$(Q)$(MAKE) -rR -f scripts/Makefile.modinst
# If System.map exists, run depmod. This deliberately does not have a
# dependency on System.map since that would run the dependency tree on
......@@ -533,13 +534,9 @@ else
depmod_opts := -b $(INSTALL_MOD_PATH) -r
endif
.PHONY: _modinst_post
_modinst_post:
_modinst_post: _modinst_
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
# Modules not configured
......
......@@ -2,33 +2,38 @@
# Installing modules
# ==========================================================================
src := $(obj)
.PHONY: __modinst
__modinst:
.PHONY: modules_install
modules_install:
include scripts/Makefile.lib
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)
cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \
cp $(obj-m:.o=.ko) $(MODLIB)/kernel/$(obj)
cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(@D); \
cp $@ $(MODLIB)/kernel/$(@D)
modules_install: $(subdir-ym)
ifneq ($(obj-m:.o=.ko),)
$(filter-out ../% /%,$(modules)):
$(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)
$(subdir-ym):
$(Q)$(MAKE) -rR -f scripts/Makefile.modinst obj=$@
$(filter ../% /%,$(modules)):
$(call cmd,modules_install_extra)
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