QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: 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   <=========总觉得不太安心
回复

使用道具 举报

发表于 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.
回复

使用道具 举报

发表于 2003-5-22 22:04:47 | 显示全部楼层
[quote:0612c16423="applepie"]#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   <=========总觉得不太安心[/quote]

ok, so what u change?

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

使用道具 举报

 楼主| 发表于 2003-5-22 22:05:58 | 显示全部楼层
谢谢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.
回复

使用道具 举报

 楼主| 发表于 2003-5-23 22:07:22 | 显示全部楼层
谢谢各位的帮助

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

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

使用道具 举报

发表于 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
回复

使用道具 举报

 楼主| 发表于 2003-5-23 23:17:30 | 显示全部楼层
你猜对了


Dragonfly
回复

使用道具 举报

发表于 2003-5-23 23:43:50 | 显示全部楼层
welcome
回复

使用道具 举报

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

本版积分规则

GMT+8, 2024-6-16 06:38 , Processed in 0.072733 second(s), 13 queries .

© 2021 Powered by Discuz! X3.5.

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