summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2017-07-20 22:34:54 +0200
committerJonas Gorski <jonas.gorski@gmail.com>2017-10-27 13:06:15 +0200
commit2e496876c60cc45a06ac610e02c00ec767028b64 (patch)
tree2755c33f7fe9083b6be488bfffd73ca16485f119 /include
parent75021e9411cd4c49e179ab76a51a388ef8276190 (diff)
downloadmtk-20170518-2e496876c60cc45a06ac610e02c00ec767028b64.zip
mtk-20170518-2e496876c60cc45a06ac610e02c00ec767028b64.tar.gz
mtk-20170518-2e496876c60cc45a06ac610e02c00ec767028b64.tar.bz2
kernel: collect module symvers for external modules
Collect module symvers for all external modules to make them available for modpost. This fixes dependencies for most external modules. Example: Before: root@LEDE:/# modinfo mt76 module: /lib/modules/4.4.74/mt76.ko license: Dual BSD/GPL depends: After: root@LEDE:/# modinfo mt76 module: /lib/modules/4.4.74/mt76.ko license: Dual BSD/GPL depends: mac80211,cfg80211 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/kernel.mk27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/kernel.mk b/include/kernel.mk
index 75797cf..f2099ad 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -123,6 +123,32 @@ ifdef CONFIG_USE_SPARSE
KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
endif
+PKG_EXTMOD_SUBDIRS ?= .
+
+define populate_module_symvers
+ cat /dev/null > $(PKG_INFO_DIR)/$(PKG_NAME).symvers; \
+ for subdir in $(PKG_EXTMOD_SUBDIRS); do \
+ cat $(PKG_INFO_DIR)/*.symvers 2>/dev/null > $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers; \
+ done
+endef
+
+define collect_module_symvers
+ for subdir in $(PKG_EXTMOD_SUBDIRS); do \
+ grep -F $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers >> $(PKG_BUILD_DIR)/Module.symvers.tmp; \
+ done; \
+ sort -u $(PKG_BUILD_DIR)/Module.symvers.tmp > $(PKG_BUILD_DIR)/Module.symvers; \
+ mv $(PKG_BUILD_DIR)/Module.symvers $(PKG_INFO_DIR)/$(PKG_NAME).symvers
+endef
+
+define KernelPackage/hooks
+ ifneq ($(PKG_NAME),kernel)
+ Hooks/Compile/Pre += populate_module_symvers
+ Hooks/Compile/Post += collect_module_symvers
+ endif
+ define KernelPackage/hooks
+ endef
+endef
+
define KernelPackage/Defaults
FILES:=
AUTOLOAD:=
@@ -230,6 +256,7 @@ $(call KernelPackage/$(1)/config)
endif
$(call KernelPackage/depends)
+ $(call KernelPackage/hooks)
ifneq ($(if $(filter-out %=y %=n %=m,$(KCONFIG)),$(filter m y,$(foreach c,$(filter-out %=y %=n %=m,$(KCONFIG)),$($(c)))),.),)
ifneq ($(strip $(FILES)),)