linux内核开发--LDD3 scull错误集合,内核版本迁移清单 .
来源:互联网 发布:c语言中的递归 编辑:程序博客网 时间:2024/06/10 07:53
由于linux内核版本的升级,往往会让能在老版本内核上编译通过的驱动程序移植到新版本内核中出现各种编译和链接错误,这里就将我遇到的一些问题做个整理,让后续开发更流畅^_^!
当前内核版本为3.2.4
1.make[1]: Entering directory `/usr/src/linux-***' scripts/Makefile.build:49: *** CFLAGS was changed in "***/Makefile". Fix it to use ***. Stop.
原因:与Makefile.build中的CFLAGS冲突
建议:删除CFLAGS或者将CFLAGS重命名
2. fatal error: linux/config.h: No such file or directory
原因:linux-2.6.20起,linux/config.h被移除了
建议:可以添加如下代码
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
#include <generated/autoconf.h>
#else
#include <linux/autoconf.h>
#endif
#else
#include <linux/config.h>
#endif
3. error: unknown field ‘ioctl’ specified in initializer
原因:linux-2.6.26起,file_operations修改了,移除了ioctl,添加了如下两个接口
long(*unlocked_ioctl)(structfile *, unsignedint,unsignedlong);
建议:视程序使用情况,把.ioctl修改成为.unlocked_ioctl或者compat_ioctllong (*compat_ioctl) (struct file *, unsigned int, unsigned long);
4 error: implicit declaration of function ‘init_MUTEX’
原因:linux-2.6.25起,移除init_MUTEX,init_MUTEX_LOCKED宏定义
建议:添加如下代码
#include <linux/semaphore.h>
#define init_MUTEX(a) sema_init(a,1)
#define init_MUTEX_LOCKED(a) sema_init(a,0)
5. error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
原因:linux-2.6.19起,TASK_INTERRUPTIBLE的定义被移动到linux/sched.h
建议:添加头文件 linux/sched.h
6. error: ‘SPIN_LOCK_UNLOCKED’ undeclared here
原因:新版本内核中,SPIN_LOCK_UNLOCKED被移除
建议:使用DEFINE_SPINLOCK(lock)宏来替代
7. error: ‘struct task_struct’ has no member named ‘uid’/ ‘euid’
原因:linux-2.6.31起,struct task_struct定义在include/linux/sched.h中,原来task_struct结构体定义有所改动,将uid和euid等挪到 cred中,见include/linux/sched.h和 include/linux/cred.h
建议:只需要将报error的代码做如下修改
current->uid 修改为 current->cred->uid
current->euid 修改为 current->cred->euid
- linux内核开发--LDD3 scull错误集合,内核版本迁移清单
- linux内核开发--LDD3 scull错误集合,内核版本迁移清单
- linux内核开发--LDD3 scull错误集合,内核版本迁移清单 .
- ldd3 读书笔记 —— scull 1 编译,解决内核更新引起的错误
- (LDD3)Scull在2.6.35-30内核中的编译解决方案
- 在内核3.17.6上编译scull(LDD3)
- ldd3 scull错误移除
- ldd3 scull错误移除
- LDD3中scull在新内核上编译中的各种error处理
- Ldd3 学习笔记2 — simple 2.6.10以上内核版本编译错误解决方法!!!
- LDD3学习笔记scull编译错误解决
- ARM-LINUX-2.6.36-LDD3-scull
- linux 内核驱动学习之scull代码编译
- linux内核开发过程内核版本不匹配的解决方法
- Linux内核开发入门及内核版本-补丁制作
- ldd3-内核内存分配
- LDD3构建内核树
- 慢慢学Linux驱动开发,第八篇,LDD3中第三章scull注释详解
- SQL数据库 大数据快速导入
- 1、XML概述
- Windows7使用OpenOffice SDK的配置 (5)
- PIC单片机之电容触摸按键
- How to use equals( ) and equalsIgnoreCase( ) in Java
- linux内核开发--LDD3 scull错误集合,内核版本迁移清单 .
- oracle顶级用户,建角色
- 【黑马程序员】- 面向对象_多态_抽象类
- 程序员学习能力提升三要素
- 使用libvirt管理kvm虚拟机
- mysql event的用法
- 创建BOM,分配工厂,删除分配操作
- wp8的开发环境误导大家了,i3就可以
- PLY文件格式