linux驱动学习(1)-ubuntu 内核源码下载及编译

1.查看当前系统原码版本
gavin@ubuntu:/usr/src$ apt-cache search linux-source
linux-source - Linux kernel source with Ubuntu patches
linux-source-2.6.35 - Linux kernel source for version 2.6.35 with Ubuntu patches


2.下载源码
gavin@ubuntu:/usr/src$ sudo apt-get install linux-source-2.6.35


下载完成后,在/usr/src目录中,可以看到压缩包
gavin@ubuntu:/usr/src$ ls
linux-headers-2.6.35-22          linux-source-2.6.35
linux-headers-2.6.35-22-generic  linux-source-2.6.35.tar.bz2

3.编译
gavin@ubuntu:/usr/src$ sudo tar -xjvf linux-source-2.6.35.tar.bz2 
gavin@ubuntu:/usr/src/linux-source-2.6.35$ sudo make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/basic/hash
  HOSTCC  scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:105: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:307: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
  HOSTCC  scripts/kconfig/kxgettext.o
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 *** 
 *** Install ncurses (ncurses-devel) and try again.
 *** 
make[1]: *** [scripts/kconfig/dochecklxdialog] 错误 1
make: *** [menuconfig] 错误 2


缺少ncurses库,安装
gavin@ubuntu:/usr/src/linux-source-2.6.35$ sudo apt-get install libncurses5-dev


重新编译成功。也可以使用系统原来的配置来编译,oldconfig

gavin@ubuntu:/usr/src/linux-source-2.6.35$ sudo make oldconfig    #编译内核

gavin@ubuntu:~/linux_驱动开发$ make modules                                  #编译模块

gavin@ubuntu:~/linux_驱动开发$ make modules_install                     #安装模块

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值