linux设备驱动在2.6.32上的编译-scullp - fun - fun

linux设备驱动在2.6.32上的编译-scullp

abelard posted @ 2011年5月13日 08:41 in linux内核 , 3054 阅读

 

解:修改Makefile的CFLAGS 为 EXTRA_CFLAGS

2. 错误:linux/config.h:没有那个文件或目录

解:注释掉 #include <linux/config.h> 

3.  错误:宏“INIT_WORK”传递了 3 个参数,但只需要 2 个

解:因为2.6.32的只需要两个参数,去掉最后一个即可

4. 错误:‘NOPAGE_SIGBUS’未声明(在此函数内第一次使用)

解:在2.6.32中没有 NOPAGE_SIGBUS,查了2.6.32的源代码,定义page时,都没有初始化,于是将

struct page *page = NOPAGE_SIGBUS;

改为

struct page *page ;、

5.错误:字段‘sem’的类型不完全

解:添加

#include <linux/semaphore.h>

6. 错误:初始值设定项里有未知的字段‘nopage’

解:因为在2.6.32中,struct vm_operations_struct 没有nopage成员,因此需要将

struct vm_operations_struct scullp_vm_ops = {

.open =     scullp_vma_open,
.close =    scullp_vma_close,
.nopage =   scullp_vma_nopage,
};
改为
struct vm_operations_struct scullp_vm_ops = {
.open =     scullp_vma_open,
.close =    scullp_vma_close,
};
7. 错误:提领指向不完全类型的指针 (struct inode *inode = filp->f_dentry->d_inode;)
解:
添加: #inclucde <linux/fs.h>

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee