免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5514 | 回复: 14
打印 上一主题 下一主题

驱动开发是不是必须要重新编译内核啊? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-19 11:47 |只看该作者 |倒序浏览
我在fc下面运行《linux设备驱动程序》里面的scull的例程
以前在我的那个2.6.24的内核的fc下面运行 是好好的 一点问题没有
后来我装了一个新的2.6.23的内核 结果就出现了下面一大堆错误
新的这个系统安装后 没有编译过内核
是不是必须要编译一边才可以啊
下面的错误是因为这个原因造成的么》?
谢谢了 哪个高手知道请指导一下





make -C /lib/modules/2.6.23.1-42.fc8/build M=/root/study/jeff/scull LDDINC=/root/study/jeff/scull/../include modules
make[1]: Entering directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
  CC [M]  /root/study/jeff/scull/main.o
  CC [M]  /root/study/jeff/scull/pipe.o
  CC [M]  /root/study/jeff/scull/access.o
/root/study/jeff/scull/access.c: In function ‘scull_u_open’:
/root/study/jeff/scull/access.c:106: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c:107: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c:114: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c: In function ‘scull_w_available’:
/root/study/jeff/scull/access.c:165: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c:166: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c: In function ‘scull_w_open’:
/root/study/jeff/scull/access.c:179: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/root/study/jeff/scull/access.c:179: error: (Each undeclared identifier is reported only once
/root/study/jeff/scull/access.c:179: error: for each function it appears in.)
/root/study/jeff/scull/access.c:179: error: implicit declaration of function ‘signal_pending’
/root/study/jeff/scull/access.c:179: error: implicit declaration of function ‘schedule’
/root/study/jeff/scull/access.c:184: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c: In function ‘scull_w_release’:
/root/study/jeff/scull/access.c:205: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/root/study/jeff/scull/access.c: In function ‘scull_c_open’:
/root/study/jeff/scull/access.c:277: error: dereferencing pointer to incomplete type
/root/study/jeff/scull/access.c:281: error: dereferencing pointer to incomplete type
make[2]: *** [/root/study/jeff/scull/access.o] Error 1
make[1]: *** [_module_/root/study/jeff/scull] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
make: *** [modules] Error 2

论坛徽章:
0
2 [报告]
发表于 2008-08-19 11:58 |只看该作者
重新编译也没用,你看的书就是那本LDD3吗?Linux的内核从2.6.18到2.6.19改动比较大,连中断入口的参数个数都修改了,而头文件中的定义也修改了许多,所以你要么找到对应版本去测试那些例子,要么修改代码适应新的内核。
Linux的系统调用相对比较稳定,但开发驱动直接用了内核中的函数,变来变去的实现是很麻烦。

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
3 [报告]
发表于 2008-08-19 12:00 |只看该作者

回复 #1 jeff1115 的帖子

编译内核没有必要,驱动程序与对应的内核版本这个比较重要。

论坛徽章:
0
4 [报告]
发表于 2008-08-19 14:57 |只看该作者

回复 #2 Cyberman.Wu 的帖子

谢谢你们的回复(包括三楼的)

论坛徽章:
0
5 [报告]
发表于 2008-08-19 15:02 |只看该作者

回复 #2 Cyberman.Wu 的帖子

另外再问一个问题
看书上说 开发驱动要构建内核树
是啥子意思啊?
是不是就是说编译一下内核呢?

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
6 [报告]
发表于 2008-08-19 15:17 |只看该作者

回复 #5 jeff1115 的帖子

实际上就是安装内核源代码,构建你自己的内核开发环境。

论坛徽章:
0
7 [报告]
发表于 2008-08-19 15:31 |只看该作者

回复 #6 dreamice 的帖子

安装内核源代码
我的好像已经有内核代码了啊?

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
8 [报告]
发表于 2008-08-19 15:40 |只看该作者

回复 #7 jeff1115 的帖子

有了并不代表你配置好了,那你可以写模块并编译加载了么?

论坛徽章:
0
9 [报告]
发表于 2008-08-19 16:08 |只看该作者

回复 #8 dreamice 的帖子

ldd3中的那个scull的例程
我把出错的access.c那个文件注释掉
可以生成scull.ko模块
但是不能insmod   提示出错

论坛徽章:
3
金牛座
日期:2014-06-14 22:04:062015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:45
10 [报告]
发表于 2008-08-19 16:24 |只看该作者

回复 #9 jeff1115 的帖子

你这个错误不知道,没有详细信息,不知道该如何定位。如果编译没有问题的话,那說明内核源代码是安装好了的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP