Welcome 微信登录

首页 / 操作系统 / Linux / LDD3 范例程序在新版本Linux内核下的问题及解决办法

Linux内核从2.6.18到2 .6.19发生了较大变化,而《limux设备驱动程序3》中的程序是针对2.6.10内核的,在使用包含较新版本内核的linux发行版编译这些程序时,总不是向书上说的那么顺利,在此总结一下遇到的问题和解决办法,本篇日志会随着我的进度进行更新,有些问题可能发现了我也暂时解决不了,欢迎交流。scull:
1)编译main.c时提示错误:main.c:17:26: error: linux/config.h: No such file or directory
解决办法:把#include<linux/config.h>注释掉或者在内核源码中创建空的config.h文件,从2.6.19后的新版本的内核已经不再包含config.h文件了,参见这里。2)编译access.c时提示错误:
/home/lits/test/access.c: In function ‘scull_u_open’:
/home/lits/test/access.c:108: error: dereferencing pointer to incomplete type
/home/lits/test/access.c:109: error: dereferencing pointer to incomplete type
/home/lits/test/access.c:116: error: dereferencing pointer to incomplete type
/home/lits/test/access.c: In function ‘scull_w_available’:
/home/lits/test/access.c:167: error: dereferencing pointer to incomplete type
/home/lits/test/access.c:168: error: dereferencing pointer to incomplete type
/home/lits/test/access.c: In function ‘scull_w_open’:
/home/lits/test/access.c:181: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/home/lits/test/access.c:181: error: (Each undeclared identifier is reported only once
/home/lits/test/access.c:181: error: for each function it appears in.)
/home/lits/test/access.c:181: error: implicit declaration of function ‘signal_pending’
/home/lits/test/access.c:181: error: implicit declaration of function ‘schedule’
/home/lits/test/access.c:186: error: dereferencing pointer to incomplete type
/home/lits/test/access.c: In function ‘scull_w_release’:
/home/lits/test/access.c:207: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/home/lits/test/access.c: In function ‘scull_c_open’:
/home/lits/test/access.c:279: error: dereferencing pointer to incomplete type
/home/lits/test/access.c:283: error: dereferencing pointer to incomplete type
/home/lits/test/access.c: In function ‘scull_access_setup’:
/home/lits/test/access.c:356: warning: format not a string literal and no format arguments
解决办法:在access.c中添加 #include <linux/sched.h>即可正常编译产生模块文件。Linux下加入组播出错处理Ubuntu 10.10 Linux下玩植物大战僵尸游戏相关资讯      Linux内核 
  • IT人员必须了解的六项Linux内核变  (今 12:05)
  • Linux 内核更新:3.10.98、3.14.62  (02月26日)
  • Linux:让手机运行主线内核  (11/26/2015 22:16:17)
  • Linux内核自防护项目  (05月24日)
  • Linux 内核架构的理解  (12/09/2015 09:01:01)
  • Linux内核被指缺乏安全性  (11/07/2015 08:28:47)
本文评论 查看全部评论 (0)
表情: 姓名: 字数