参考博客:Ubuntu内核源码树的构建与安装
简介
本文主要讨论在Ubuntu10.04 LTS环境下,构建内核代码树的流程。
构建环境
1. 使用Vmware安装Ubuntu10.04的光盘镜像,并配置好网络,WIFI下使用NAT模式,网线可以使用桥接模式
2. 更新sources.list,由于Ubuntu10.04属于比较古老的Ubuntu版本,目前官方已经不在支持此版本。在/etc/apt目录下打开sources.list,将源粘贴进去即可。源如下,测试可以使用,如果不好用或者速度不快的话可以去网上寻找其他源。
## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick main restricted
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ maverick universe
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick universe
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://old-releases.ubuntu.com/ubuntu/ maverick multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ maverick-updates multiverse
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.old-releases.ubuntu.com/ubuntu/ maverick-backports main restricted universe multiverse
# deb-src http://us.old-releases.ubuntu.com/ubuntu/ maverick-backports main restricted universe multiverse
#remastersys for backup installed system
deb http://www.remastersys.com/ubuntu maverick main
3. 安装编译工具
apt-get install kernel-package libncurses5-dev
kernel-package是Debian提供的一个编译Linux内核的一个工具集,安装kernel-package 会同时安装上build-essential、libncurses-dev、linux-source等一系列工具。libncurses5-dev是一个可视化的配置界面UI。主要是支持使用menuconfig配置内核。
4. 下载和安装源码包
使用
apt-cache search linux-source
命令可以查看可用的源码包:
然后使用apt-get install 安装linux-source-2.6.35,下载完成后,代码位于/usr/src目录下,将软件包解压出来:
tar -xjvf linux-source-2.6.35.tar.bz2
内核编译
1. 使用系统配置文件
进入当前系统的源码目录下:linux-headers-2.6.32-24-generic ,将其中的.config文件复制到解压后的源码目录中。
2. menuconfig
加载CONFIG文件选项框中,选择.config 然后退出menuconfig的界面。
3. make bzImage 编译内核
4. make modules 编译模块
5.make modules_install 安装模块
6.make install 安装系统
安装完成后,在lib/modules可以看到安装后的系统。
进入boot目录下,生成系统的boot信息: update-initramfs -c -k 2.6.35.14
然后将其加入到grub当中:update-grub
在VMWARE环境下如果需要调出GNU GRUB界面需要长按shift健
版权声明:本文为musicalspace原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。