Linux symbol export method:
[1] If we want export the symbol in a module, just use the EXPORT_SYMBOL(xxxx) in the C or H file.
And compile the module by adding the compile flag -DEXPORT_SYMTAB.
Then we can use the xxxx in the other module.
[2] If we want export some symbol in Kernel that is not in a module such as xxxx in the /arch/ppc/fec.c.
Firstly, define the xxxx in the fec.c;
Secondly, make a new file which contain the "extern" define the xxxx(for example, extern int xxxx);
Lastly, in the ppc_ksyms.c we includes the new file, and add the EXPORT_SYMBOL(xxxx).
Then we can use the xxxx.
其中第二条指明:在编译内核的同时编译模块,若出现内核中某符号在模块中未定义的错误,则需要做以下事情(实践经验步骤):
(1)找到该符号在内核代码中定义的文件
(2)在符号定义文件内#include 文件
(3)在符号定义文件内EXPORT_SYMBOL(XXX) 导出该符号XXX供模块代码使用;
阅读(2591) | 评论(0) | 转发(1) |