红联Linux门户
Linux帮助

"couldn't find the kernel version the module was compiled for "

发布时间:2013-03-23 06:42:13来源:红联作者:呼呼哈嘿
[i=s] 本帖最后由 呼呼哈嘿 于 2013-3-25 11:37 编辑 [/i]

问题:编写最简单的内核模块,编译内核模块时报错
#include
#include
static int hello_init(void)
{
printk("hello,world\n");
return 0;
}
static void hello_exit(void)
{
printk("Good-bye, kernel!\n”);
}
module_init(hello_init);
module_exit(hello_exit);

gcc -c -o hello.o hello.c -Wall通过,
但是,insmod hello.o时,报如标题错误
文章评论

共有 4 条评论

  1. d.x 于 2013-03-29 22:33:16发表:

    哦,原来如次

  2. 棒球小宝 于 2013-03-28 13:22:52发表:

    dingdingdingding

  3. 呼呼哈嘿 于 2013-03-25 11:37:06发表:

    已解决。
    由于我的疏忽,编译内核模块的内核版本与运行内核模块的版本不一致,所以出错。。

  4. tworkprod 于 2013-03-23 08:47:10发表:

    帮顶