设为首页 加入收藏

TOP

scull字符设备驱动编译在新内核编译问题解决方案(二)
2014-11-24 12:18:55 来源: 作者: 【 】 浏览:1
Tags:scull 字符 设备驱动 编译 内核 问题 解决方案
ipe.o] Error 1
make[1]: *** [_module_/home/elite/Desktop/linux设备驱动开发/examples/scull] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-22-generic'
make: *** [modules] Error 2


TASK_INTERRUPTIBLE找不到,既然前面删除掉了了一个头文件,必然有很多变量找不到,
那就到/usr/src/linux-headers-2.6.32-22-generic下grep一下呗:
最终找到头文件,添加上:
#include


access.c也需要添加上面的头文件。


然后,还得make,痛苦阿。。。。


make -C /lib/modules/2.6.32-22-generic/build M=/home/elite/Desktop/linux设备驱动开发/examples/scull LDDINC=/home/elite/Desktop/linux设备驱动开发/examples/scull/../include modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-22-generic'
CC [M] /home/elite/Desktop/linux设备驱动开发/examples/scull/access.o
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c: In function‘scull_u_open’:
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c:107: error:‘struct task_struct’ has no member named ‘uid’
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c:108: error:‘struct task_struct’ has no member named ‘euid’
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c:115: error:‘struct task_struct’ has no member named ‘uid’
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c: In function‘scull_w_available’:
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c:166: error:‘struct task_struct’ has no member named ‘uid’
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c:167: error:‘struct task_struct’ has no member named ‘euid’
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c: In function‘scull_w_open’:
/home/elite/Desktop/linux设备驱动开发/examples/scull/access.c:185: error:‘struct task_struct’ has no member named ‘uid’
make[2]: *** [/home/elite/Desktop/linux设备驱动开发/examples/scull/access.o] Error 1
make[1]: *** [_module_/home/elite/Desktop/linux设备驱动开发/examples/scull] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-22-generic'
make: *** [modules] Error 2


说task_struct结构体没有uid,euid成员变量,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


然后编译,即可通过。


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Linux 函数局部变量的堆栈使用 下一篇基本shellcode提取方法

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis 分布式锁全解 (2025-12-25 17:19:51)
·SpringBoot 整合 Red (2025-12-25 17:19:48)
·MongoDB 索引 - 菜鸟 (2025-12-25 17:19:45)
·What Is Linux (2025-12-25 16:57:17)
·Linux小白必备:超全 (2025-12-25 16:57:14)