在Ubuntu 9.04 内核2.6.32.2 上编译Linux driver edit3 例子详解scull
2010-01-06 21:06
561 查看
上一篇已经搭好好了2.6.32.2 的内核树。
scull 编译错误
问题1:
make -C /lib/modules/2.6.26-2-686/build M=/usr/local/workspace/ldd3_examples/scull LDDINC=/usr/local/workspace/ldd3_examples/scull/../include modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-2-686'
scripts/Makefile.build:46: *** CFLAGS was changed in "/usr/local/workspace/ldd3_examples/scull/Makefile". Fix it to use EXTRA_CFLAGS。 停止。
make[1]: *** [_module_/usr/local/workspace/ldd3_examples/scull] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-2-686'
make: *** [modules] 错误 2
(1)用EXTRA_CFLAGS替换Makefile中的CFLAGS
(2)使用命令 #make KBUILD_NOPEDANTIC=1 我使用的是这个。
问题2:
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-2-686'
CC [M] /usr/local/workspace/ldd3_examples/scull/main.o
/usr/local/workspace/ldd3_examples/scull/main.c:15:26: error: linux/config.h: 没有那个文件或目录
make[2]: *** [/usr/local/workspace/ldd3_examples/scull/main.o] 错误 1
make[1]: *** [_module_/usr/local/workspace/ldd3_examples/scull] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-2-686'
make: *** [modules] 错误 2
1) 在access.c和pipe.c中添加#include<linux/sched.h>
2) 把main.c 中的//#include <linux/config.h>注释掉
问题3:pipe.c 编译问题
error: ‘struct task_struct’ has no member named ‘euid’
error: ‘struct task_struct’ has no member named ‘uid’
1)current->euid 换成 current->cred->euid 等等都是这样改的。
之后所有的问题都解决了。会生成出一scull.ko文件这个就是我们所要的驱动文件
note:
介绍几个有用的命令
挂在驱动的命令
#sudo insmod scull.ko
查看驱动的命令
#cat /proc/devices
#sudo lsmod
卸载命令
#sudo rmmod scull
建立挂在点命令
#mknod /dev/scull c 251 0
解释一下最后的一个命令:scull这个是文件名可以随便起,c是字符设备 251是主设备名 可以在#cat /proc/devices查到 ,0是次设备号,可以起0开始的255之间的数。
reference: http://blog.chinaunix.net/u3/97311/showart_1999976.html
scull 编译错误
问题1:
make -C /lib/modules/2.6.26-2-686/build M=/usr/local/workspace/ldd3_examples/scull LDDINC=/usr/local/workspace/ldd3_examples/scull/../include modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-2-686'
scripts/Makefile.build:46: *** CFLAGS was changed in "/usr/local/workspace/ldd3_examples/scull/Makefile". Fix it to use EXTRA_CFLAGS。 停止。
make[1]: *** [_module_/usr/local/workspace/ldd3_examples/scull] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-2-686'
make: *** [modules] 错误 2
(1)用EXTRA_CFLAGS替换Makefile中的CFLAGS
(2)使用命令 #make KBUILD_NOPEDANTIC=1 我使用的是这个。
问题2:
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-2-686'
CC [M] /usr/local/workspace/ldd3_examples/scull/main.o
/usr/local/workspace/ldd3_examples/scull/main.c:15:26: error: linux/config.h: 没有那个文件或目录
make[2]: *** [/usr/local/workspace/ldd3_examples/scull/main.o] 错误 1
make[1]: *** [_module_/usr/local/workspace/ldd3_examples/scull] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-2-686'
make: *** [modules] 错误 2
1) 在access.c和pipe.c中添加#include<linux/sched.h>
2) 把main.c 中的//#include <linux/config.h>注释掉
问题3:pipe.c 编译问题
error: ‘struct task_struct’ has no member named ‘euid’
error: ‘struct task_struct’ has no member named ‘uid’
1)current->euid 换成 current->cred->euid 等等都是这样改的。
之后所有的问题都解决了。会生成出一scull.ko文件这个就是我们所要的驱动文件
note:
介绍几个有用的命令
挂在驱动的命令
#sudo insmod scull.ko
查看驱动的命令
#cat /proc/devices
#sudo lsmod
卸载命令
#sudo rmmod scull
建立挂在点命令
#mknod /dev/scull c 251 0
解释一下最后的一个命令:scull这个是文件名可以随便起,c是字符设备 251是主设备名 可以在#cat /proc/devices查到 ,0是次设备号,可以起0开始的255之间的数。
reference: http://blog.chinaunix.net/u3/97311/showart_1999976.html
相关文章推荐
- ubuntu 9.04 linux 2.6.32.2 内核编译
- LINUX内核编译过程详解[UBUNTU9.04 kernel 2.6.28.9]
- linux (ubuntu) 编译内核详解[转]
- ubuntu 9.04 环境下实现ylp2410 Linux2.6.8内核编译
- ubuntu环境下编译内核详解(linux kernel compile)
- tony之linux driver_LDD3_scull字符设备驱动编译在新内核编译问题
- LINUX操作系统的内核编译内幕详解一
- [转]Linux编译内核详解
- ubuntu14.04编译linux 3.17.内核源码
- 【转】Linux内核编译详解
- Linux 内核编译步骤及配置详解
- Linux 内核编译详解
- Linux编译内核详解
- Linux-4.9.2内核在mini2440上的移植(一)——Ubuntu编译环境搭建(上)
- Linux 内核编译详解
- Ubuntu 编译 Linux 内核 错误
- Ubuntu下Xilinx Linux内核编译问题,出现“缺少ncurses”libraries
- Ubuntu10.10下编译Linux2.6.36内核
- linux内核编译选项详解(一):General setup
- Linux 2.6 menuconfig内核编译配置选项详解