设为首页 加入收藏

TOP

scull字符设备驱动编译在新内核编译问题解决方案(一)
2014-11-24 12:18:55 来源: 作者: 【 】 浏览:0
Tags:scull 字符 设备驱动 编译 内核 问题 解决方案

最近在看《LINUX设备驱动程序》,给出的字符设备驱动程序scull,在linux 2.6.32-22内核上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'
scripts/Makefile.build:49: *** CFLAGS was changed in "/home/elite/Desktop/linux设备驱动开发/examples/scull/Makefile". Fix itto use EXTRA_CFLAGS. Stop.
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


打开Makefile,将CFLAGS屏蔽掉:
# CFLAGS += $(DEBFLAGS)
# CFLAGS += -I$(LDDINC)


继续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/main.o
/home/elite/Desktop/linux设备驱动开发/examples/scull/main.c:17:26: error:linux/config.h: No such file or directory
make[2]: *** [/home/elite/Desktop/linux设备驱动开发/examples/scull/main.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


linux/config.h文件找不到,可能时新版内核结构改变了,这个文件被删除了吧。
打开main.c,把#include 删除掉。


继续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/main.o
CC [M] /home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.o
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c: In function‘scull_p_read’:
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:131: error:‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:131: error: (Eachundeclared identifier is reported only once
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:131: error: foreach function it appears in.)
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:131: error:implicit declaration of function ‘signal_pending’
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:131: error:implicit declaration of function ‘schedule’
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c: In function‘scull_getwritespace’:
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:168: error:‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c: In function‘scull_p_write’:
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:219: error:‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:223: error:‘SIGIO’ undeclared (first use in this function)
/home/elite/Desktop/linux设备驱动开发/examples/scull/pipe.c:223: error:‘POLL_IN’ undeclared (first use in this function)
make[2]: *** [/home/elite/Desktop/linux设备驱动开发/examples/scull/p

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

评论

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

·用 Python 进行数据 (2025-12-25 15:49:09)
·如何学习Python数据 (2025-12-25 15:49:07)
·利用Python进行数据 (2025-12-25 15:49:04)
·Java 学习线路图是怎 (2025-12-25 15:19:15)
·关于 Java 学习,有 (2025-12-25 15:19:12)