kernel-ark/scripts/Makefile.modinst
이건호 ef591a5506 scripts/Makefile.modpost: error in finding modules from .mod files.
This error may happen when the user's id or path includes .ko string.
For example, user's id is xxx.ko and building test.ko module,
the test.mod file lists ko name and all object files.
   /home/xxx.ko/kernel_dev/device/drivers/test.ko
   /home/xxx.ko/kernel_dev/device/drivers/test_main.o
/home/xxx.ko/kernel_dev/device/drivers/test_io.o ...
Current Makefile.modpost and Makefile.modinst find and list up not
only test.ko but also other object files.
because all of object file's path includes .ko string.
This is a patch to fix it.

Signed-off-by: Gunho Lee <gunho.lee@lge.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-08-31 17:37:54 +02:00

36 lines
1.0 KiB
Makefile

# ==========================================================================
# Installing modules
# ==========================================================================
PHONY := __modinst
__modinst:
include scripts/Kbuild.include
#
__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
PHONY += $(modules)
__modinst: $(modules)
@:
quiet_cmd_modules_install = INSTALL $@
cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@)
# Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D))
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
$(modules):
$(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable se we can use it in if_changed and friends.
.PHONY: $(PHONY)