I've two kernel modules A
and B
, the module A
exports the function foo
using EXPORT_SYMBOL(foo)
. To be sure if the symbol was correctly exported I executed cat /proc/kallsyms | grep foo
which gives me the following:
0000000000000000 r __ksymtab_foo [mod_a]0000000000000000 r __kstrtab_foo [mod_a]0000000000000000 T foo [mod_a]
I want to use the function foo
on module B
, in order to do it I build the module B
with the following Makefile
KBUILD_EXTRA_SYMBOLS := /path/to/mod/a/Module.symversobj-m = mod_b.o# Get the current kernel version numberKVERSION = $(shell uname -r)all: make -C /lib/modules/$(KVERSION)/build M=$(PWD) modulesclean: make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
But even using KBUILD_EXTRA_SYMBOLS
I receive a error: implicit declaration of function ‘foo’
when I try to build the module B
. Am I using the KBUILD_EXTRA_SYMBOLS
right? Btw, build the two modules together isn't an option.
My kernel version is 5.4.0