Skip to content

Commit

Permalink
build: pass KBUILD_EXTRA_SYMBOLS with symvers files for kernel module…
Browse files Browse the repository at this point in the history
… packages

This replaces the previous (deprecated) method of collecting symvers data
in $(PKG_BUILD_DIR)/Module.symvers, which does not work on newer kernels

Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
nbd168 committed Nov 13, 2020
1 parent 92b707f commit 5d76065
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions include/kernel-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ define BuildKernel
$(LINUX_DIR)/.modules: export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
$(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
$(Kernel/CompileModules)
mkdir -p $(PKG_SYMVERS_DIR)
touch $$@

$(LINUX_DIR)/.image: export STAGING_PREFIX=$$(STAGING_DIR_HOST)
Expand Down
12 changes: 2 additions & 10 deletions include/kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ KERNEL_MAKE_FLAGS = \
CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
cmd_syscalls=
cmd_syscalls= \
$(if $(__package_mk),KBUILD_EXTRA_SYMBOLS="$(wildcard $(PKG_SYMVERS_DIR)/*.symvers)")

ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
KERNEL_MAKE_FLAGS += \
Expand All @@ -140,14 +141,6 @@ PKG_EXTMOD_SUBDIRS ?= .

PKG_SYMVERS_DIR = $(KERNEL_BUILD_DIR)/symvers

define populate_module_symvers
@mkdir -p $(PKG_SYMVERS_DIR)
cat /dev/null > $(PKG_SYMVERS_DIR)/$(PKG_NAME).symvers; \
for subdir in $(PKG_EXTMOD_SUBDIRS); do \
cat $(PKG_SYMVERS_DIR)/*.symvers 2>/dev/null > $(PKG_BUILD_DIR)/$$$$subdir/Module.symvers; \
done
endef

define collect_module_symvers
for subdir in $(PKG_EXTMOD_SUBDIRS); do \
realdir=$$$$(readlink -f $(PKG_BUILD_DIR)); \
Expand All @@ -161,7 +154,6 @@ endef

define KernelPackage/hooks
ifneq ($(PKG_NAME),kernel)
Hooks/Compile/Pre += populate_module_symvers
Hooks/Compile/Post += collect_module_symvers
endif
define KernelPackage/hooks
Expand Down

0 comments on commit 5d76065

Please sign in to comment.