Linux设备驱动程序3 官方地址:http:www.oreilly.com,源代码下载地址:http://www.oreilly.com.cn/codeexample/ldd3sc/
配套代码的linux内核代码版本是2.6.10,对应ubuntu的版本是ubuntu5.04,2005年发布的。现在估计网上很少了。且打算做驱动开发的您的linux版本绝对大于2.6.10。这样在编译实例代码时会有很多错误。先不管这些,搭建当前自己的驱动开发环境。(以下操作,如果权限不够,记得加sudo)
bory@chong:~/ldd3/test/simple$ apt-cache search linux-source linux-source - Linux kernel source with Ubuntu patches linux-source-2.6.32 - Linux kernel source for version 2.6.32 with Ubuntu patches
从打印出来的结果可知,bory使用的linux内核版本是2.6.32。所以需要下载2.6.32的内核代码
bory@chong:~$ sudo apt-get install linux-source-2.6.32下载看网速,大概十几分钟,下载后,系统默认保存在/usr/src/目录,文件名为linux-source-2.6.32.bar.bz2,先解压
bory@chong:/usr/src$ tar jxvf linux-source-2.6.32.tar.bz2
bory@chong:/usr/src$ cd linux-source-2.6.32/ bory@chong:/usr/src/linux-source-2.6.32$ make oldconfig
bory@chong:/usr/src/linux-source-2.6.32$ make bzImage
编译大概一个小时。。。
bory@chong:/usr/src/linux-source-2.6.32$ make modules需要大概一个小时。。。
最后安装
bory@chong:/usr/src/linux-source-2.6.32$ make modules_install
如有错误之处,请您指出,谢谢您的不吝赐教!
http://blog.csdn.net/k_linux_man/article/details/7023824