Set KBUILD_EXTRA_SYMBOLS in linux.mk for binary kos
If kernel modules that are compiled in-tree reference symbols that are
exported by kernel modules that are compiled out-of-tree, we need to
pass KBUILD_EXTRA_SYMBOLS to the Linux build system.
KBUILD_EXTRA_SYMBOLS needs to be a file path that points to the file
Module.symvers that has been created when the out-of-tree modules were
built.
We currently need this feature to support binary-only kernel modules.
Hopefully, these binary-only kernel modules will disappear in the near
future. The vendor agreed to delivering open-source modules that can be
used in-lieu.
Buildroot packages need to append to the variable
LINUX_KBUILD_EXTRA_SYMBOLS to use this feature.
Change-Id: I6221807ccd1309a115b28a8f097de766b70a2ad5
diff --git a/linux/linux.mk b/linux/linux.mk
index fbb7b5f..d367cac 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -221,6 +221,8 @@
endef
endif
+LINUX_MAKE_MODULES_EXTRA_FLAGS += $(if LINUX_KBUILD_EXTRA_SYMBOLS,KBUILD_EXTRA_SYMBOLS="$(LINUX_KBUILD_EXTRA_SYMBOLS)")
+
# Compilation. We make sure the kernel gets rebuilt when the
# configuration has changed.
define LINUX_BUILD_CMDS
@@ -230,7 +232,7 @@
cp $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)) $(KERNEL_ARCH_PATH)/boot/dts/)
$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME)
@if grep -q "CONFIG_MODULES=y" $(@D)/.config; then \
- $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) modules ; \
+ $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) $(LINUX_MAKE_MODULES_EXTRA_FLAGS) -C $(@D) modules ; \
fi
$(LINUX_BUILD_DTB)
$(LINUX_APPEND_DTB)