加载模块时出现的错误信息,请高手来看看!!

jiangli829 2004-08-13 05:07:22
加载模块时出现下面的错误信息:

Warning: loading hello.o will taint the kernel: no license
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
hello.o: init_module: Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.
You may find more information in syslog or the output from dmesg

该模块代码是:
#define MODULE
#define __KERNEL__

#include "linux/kernel.h"
#include "linux/module.h"

#ifdef MODVERSIONS
#include "linux/modversions.h"
#endif

int init_module()
{
printk(" hello !\n");
return 1;
}


int cleanup_module()
{
printk(" I will shut down myself in kernerl mod \n");
return 0;
}
...全文
251 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiangli829 2004-08-18
  • 打赏
  • 举报
回复
更正一下,前面mahongxi老师说的是对的,是我自己把 MODULE_LICENSE("GPL");
写成 #define MODULE_LICENSE(GPL) 了.
现在结贴.
jiangli829 2004-08-16
  • 打赏
  • 举报
回复
关于"烤鸡翅膀"说的 MODULE_LICENSE(GPL) 这个好像是在 module.h 已经定义了,
再把它加在代码里编译时会造成 redefine

但是,既然license已经define了,为什么错误信息里还是no license 呢???
jiangli829 2004-08-16
  • 打赏
  • 举报
回复
用bailee的方法有一点进步了,模块加载上去了,但是任然有错误:
Warning: loading hello.o will taint the kernel: no license
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
Module hello loaded, with warnings

而且想要的输出还是没有
bailee 2004-08-16
  • 打赏
  • 举报
回复
把 int init_module()
{
printk(" hello !\n");
return 1;
}
中的return 1 改为return 0 就可以了
jiangli829 2004-08-16
  • 打赏
  • 举报
回复
再补充一下我的问题.
加载模块之后再运行dmesg
在输出的最后一行可以看到init_module()要print的内容,就象这样:
......
......
lp0: console ready
ide-floppy driver 0.99.newide
hdc: ATAPI CD-ROM drive, 128kB Cache, DMA
Uniform CD-ROM driver Revision: 3.12
cdrom: This disc doesn't have any tracks I recognize!
hello !

但是没有cleanup_module()要print的内容, lsmod后,也没有看到有hello模块
这到底是怎么会事呀???高手们加油啊!!!!
jiangli829 2004-08-16
  • 打赏
  • 举报
回复
楼上两位大哥的办法行不通哦
groock 2004-08-13
  • 打赏
  • 举报
回复
MODULE_LICENCE("GPL");

这个好像无所谓吧
是不是你的init_module(void)
cleanup_module(void)呢
mahongxi 2004-08-13
  • 打赏
  • 举报
回复
加在int init_module一句之前
mahongxi 2004-08-13
  • 打赏
  • 举报
回复
MODULE_LICENCE("GPL");

4,438

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧