QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1951|回复: 3

Linux 内核不匹配的问题

[复制链接]
发表于 2006-5-11 12:53:07 | 显示全部楼层 |阅读模式
我照着书上些的例子:
代码:

#define MODULE

#include <linux/module.h>

int init_module(void)
{
    printk("<1>Hello, world !\n");
    return 0;
}
void cleanup_module(void)
{
    printk("<1>Goodbye cruel world !\n");
}

保存为2.1.c

然后一次运行
[root@localhost pro]# gcc -c 2.1.c
[root@localhost pro]# insmod 2.1.c
2.1.c: 2.1.c is not an ELF file
[root@localhost pro]# insmod 2.1.o
2.1.o: kernel-module version mismatch
2.1.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.22-1.2115.nptl.
[root@localhost pro]#

请问我该怎么解决??要改编内核吗??我刚学Linux,不知道该怎么做?
发表于 2006-5-11 14:15:11 | 显示全部楼层
insmod -f 2.1o
或者到 version.h 中去修改版本号
回复

使用道具 举报

 楼主| 发表于 2006-5-11 18:12:59 | 显示全部楼层
这样的话,每次都有warning,
有什么本质的修改方法吗??
回复

使用道具 举报

发表于 2006-5-12 08:48:18 | 显示全部楼层
也就事编译器和内核版本号不匹配 改一下version.h就可以了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-3-29 13:33 , Processed in 0.091072 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表