Commit f40f6ce6 authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: Install external modules in a path relative to their own path

When an external module is being built in down in a directory structure
keep the relative directory when installing the module.

Example:
fs/ contains a Makefile used to build both modules:
obj-y := myfs/ oldfs/
Install directories
fs/myfs/myfs.ko	  => Will be installed in /lib/modules/<version>/extra/fs/myfs/
fs/oldfs/oldfs.o  => Will be installed in /lib/modules/<version>/extra/fs/oldfs/
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent c6d69cd4
...@@ -21,8 +21,9 @@ quiet_cmd_modules_install = INSTALL $@ ...@@ -21,8 +21,9 @@ quiet_cmd_modules_install = INSTALL $@
# Modules built outside the kernel source tree go into extra by default # Modules built outside the kernel source tree go into extra by default
INSTALL_MOD_DIR ?= extra INSTALL_MOD_DIR ?= extra
ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(KBUILD_EXTMOD),,$(@D))
modinst_dir = $(MODLIB)/$(if $(filter ../% /%,$@),$(INSTALL_MOD_DIR)/,kernel/$(@D)) modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
$(modules): $(modules):
$(call cmd,modules_install,$(modinst_dir)) $(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
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