我尝试构建简单的内核模块(使用从developer.sonymobile.com下载的源代码)但是在编译之后我无法insmod它:未知符号__gnu_mcount_nc所以我创建了一个解决方案并且我使用汇编程序编写了另一个模块并且我导出了这个功能。在此模块正确编码后,我在lsmod中看到所有模块都是permament。我有简单文件系统的问题(权限被拒绝 - 指针为空时的默认操作),在PC上这个代码没有任何错误。
我想源代码中的配置是错误的(结构中某些字段的偏移可能是设备中的另一个字段)。
内置版本为:24.0.A.5.14(从developer.sonymobile.com网站下载)。
我可以做任何事情来获得与设备相同的配置吗?
我没有/proc/config.gz所以我不能轻易搞定。
模块来源:
#include <linux/module.h>
#include <linux/kernel.h>
int __init example_init(void)
{
printk("Hello world!\n");
return 0;
}
void __exit example_exit(void)
{
printk("example module exit\n");
}
module_init(example_init);
module_exit(example_exit);
我看到Hello World!在dmesg,但模块仍然是永久性的。
我在这里找到__gnu_mcount_nc的来源:http://doc.ironwoodlabs.com/arm-arm-none-eabi/html/getting-started/arm-mcount.html
答案 0 :(得分:0)
在构建内核模块时,是否使用profile enable -pg标志进行编译?它看起来那样。
CFLAGS的内核模块Makefile。