How does one export a symbol from a module built outside the kernel source tree?
I am writing this code outside the kernel source tree. In fact up to now I have not needed the kernel source tree on my machine. I'd like to find a way to do this without movign my source tree under the kernel tree.
My driver (loadable module) receives a data stream via a USB endpoint. This module includes a facility for 3rd parties to extend the data processing by writing their own modules which they can register via a registration framework I have implemented in my module.
For example, my customer might write a module that has the following line in their init() method:
My understanding is that I need to export the symbol my_framework_register via the EXPORT_SYMBOL() macro. When I do this, and make my module, I get a file named Module.symvers in the folder where the module .ko file is. When I load the module, I see the exported symbols in /proc/kallsyms tagged with 'T'. So far so good.
I then reference the exported routines via an include file containing
extern int my_framework_register( struct my_fops *);
When it builds, I get a WARNING about this symbol being unresolved. When I try to insmod the module I get an error. The dmesg buffer tells me two things: There is mo symbol version information for that symbol and the symbol did not load.
So, I try concatenating the Module.symvers file onto the one in /lib/modules/<version>/build. I reboot and try to build/load the module. The build works without any warnings, but now I get an error telling me "operation no permitted". However, this time there is nothing in the dmesg buffer.
I suspect the documentation that I was reading about EXPORT_DYMBOL and #define EXPORT_SYMTAB applies when the module is installed. But I cannot figure out everything I need to do to install my module. I presume that if I built the module inside the main kernel tree and added a Kconfig/Makefile pair to connect it all to the kernel build system this would probably just work. For lots of reasons I do not want to do this.
So the real question is how do I manually "install" a module into a precompiled kernel tree when that module was built using only the headers. Or, is there some other way to get an externally built module's symbols to be published (made available to other modules subsequently loaded)? I'll deal with the dependency issues later I just want to prove the concept is possible first.
Thanks a million for your help!
Last edited by opsimath; 02-23-2009 at 01:44 AM.