I am coded outside of the source kernel tree. There are two modules, the first printt has a printtty() function for printing a string in the current tty, and the second is a hello module that calls printtty() during initialization.
I added EXPORT_SYMBOL(printtty) to the printt module, and after insmod ./printt.ko printtty() can be seen in /proc/kallsyms .
The make module hello process is appropriate. But insmod ./hello.ko will insmod ./hello.ko error, for example:
insmod: ERROR: could not insert module hello.ko: Invalid parameters
and dmesg shows
hello: no symbol version for printtty hello: Unknown symbol printtty (err -22)`.
I fixed it with
(1) Copy the .ko file to the location under / lib / modules / version / kernel
(2) Add exported characters to /lib/modules/version/build/Module.symvers
But I wonder if there is a way to export a symbol only from an external module (without changing the original kernel tree)?
source share