LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 830|回复: 2

ismod一个模块时出错

[复制链接]
发表于 2006-2-24 10:07:49 | 显示全部楼层 |阅读模式
我的hello如下:
#include <linux/kernel.h>
#include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{  
printk("<1>hello world !\n");
    printk("<1>I have runing in a kernel mod! \n");
    return 0;
}
void cleanup_module()
{  
printk("<1>I will shut down myself in kernel mod!\n");
}
然后gcc -O2 -DMODULE -D__KERNEL__ -I/usr/src/linux-2.6.15/include -c hello.c (少了-O2还不行)
接着insmod -f hello.o时显示:
[root@localhost device]# insmod -f hello.o
insmod: error inserting 'hello.o': -1 Invalid module format
不知是什么错误?
发表于 2006-2-25 09:59:33 | 显示全部楼层
The <filename.o> was the old module format for kernel 2.4 and older versions. 2.6 kernel uses new format for modules. Each moodule is ended with .ko .

Have a look of your hello directory, see if there is a file called hello.ko . This is the module you should insert.
回复 支持 反对

使用道具 举报

发表于 2006-2-25 16:03:30 | 显示全部楼层
search the forum
回复 支持 反对

使用道具 举报

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

本版积分规则

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