I am coding outside the kernel source tree. There are two modules, the first one printt have a function printtty()
to print string to the current tty, and the second module hello which invokes printtty()
during initialization.
I have added EXPORT_SYMBOL(printtty)
in module printt, and after insmod ./printt.ko
, the information of printtty()
can be seen in /proc/kallsyms
.
The make
process of module hello goes all right. But insmod ./hello.ko
will cause an error like:
insmod: ERROR: could not insert module hello.ko: Invalid parameters
and dmesg
shows
hello: no symbol version for printttyhello: Unknown symbol printtty (err -22)`.
I've fixed this by
(1) Copy the hello.ko
file to a location beneath /lib/modules/version/kernel
(2) Add the exported symbols from hello.ko
to /lib/modules/version/build/Module.symvers
But I wonder is there any way to export a symbol just from an external module(without modifying kernel source tree)?