applepie 发表于 2003-5-22 22:01:06

#insmod chard
Using /lib/modules/2.4.20-8/misc/chard.o
Warning: loading /lib/modules/2.4.20-8/misc/chard.o will taint the kernel: no license
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
Module chard loaded, with warnings   <=========总觉得不太安心

Dragonfly 发表于 2003-5-22 22:03:29

once the /dev/null and /dev/zero is inited, it never been cleanuped. so it never needs cleanup code. but u code need do that.
read scull and that chapter again. it is very clear in book that what value should put there. u also need a small script to create device for u in /dev. as well, find it in book.
u can not tell me u do not understand that book, and u only want to have a char dev driver code. since u are coding a kernel module, u have to know it. why not tell us " do not discuss c language problem with me, i do not want to know that, i only need a chr dev code?"

u have better write a makefile although u gcc is workable.
u need not cp to /lib/mo.../, u can insmod chard.o directly.

Dragonfly 发表于 2003-5-22 22:04:47

#insmod chard
Using /lib/modules/2.4.20-8/misc/chard.o
Warning: loading /lib/modules/2.4.20-8/misc/chard.o will taint the kernel: no license
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
Module chard loaded, with warnings   <=========总觉得不太安心

ok, so what u change?

add MODULE_LICENSE("GPL"); to the end of u code to remove warning

applepie 发表于 2003-5-22 22:05:58

谢谢Dragonfly

Dragonfly 发表于 2003-5-22 22:09:55

if u can read LDD and scull example carefully, u can see that it has

#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>   /* printk() */

code in kernel is not 100% same as an external driver code. if u can read the post from that link, u also can know it.

applepie 发表于 2003-5-23 22:07:22

谢谢各位的帮助

编译的问题解决了
设备驱动我也试过了

但我如何把我的模块变为开机自动加载的?

Dragonfly 发表于 2003-5-23 23:09:50

which linux u use?
for my gentoo , add its name to /etc/modules.autoload
i guess u are using rh, then u need modify u /etc/rc.sysinit i believe

applepie 发表于 2003-5-23 23:17:30

你猜对了


Dragonfly

Dragonfly 发表于 2003-5-23 23:43:50

welcome
页: 1 [2]
查看完整版本: 请教设备驱动程序