ubuntu式的内核编译多少与其他方式有所不同在此记录一下,编译步骤
预备工作:
1.使用root账户登录系统。初始装的系统是不允许root登录的。
system->系统管理->登录窗口安全选项卡->选上allow local system administrator login
system->系统管理->用户和组->选root 点unlock,双击root,弹出对话框,更改root的密码
2.更新synaptic源,使用8.04的,请参考下面链接的文章
http://blog.chinaunix.net/u2/70469/showart_718273.html
3.必备工具,可用synaptic安装,synaptic基于apt-get的
apt-get install kernel-packagelibncurses5-dev fakeroot wget bzip2
4.下载2.6最新稳定版内核,我下载的是linux-2.6.25.7.tar.gz,我把它放在/usr/src/目录下
http://www.kernel.org/pub/linux/kernel/v2.6/
5.进下载的目录,解压(现在都支持图形界面解压方式了)
tar -zxvf linux-2.6.25.7.tar.gz
cd /usr/src/linux-2.6.25.7
cp /boot/config-`uname -r` ./
可以手动拷贝文件是/boot/config-2.6.24-16-generic,这个文件是2.6.24-16内核的配置文件,也是我安装好系统后的配置。使用这个配置,可以保证不出错误。
假设/usr/src下有补丁文件patch.bz2,你在/usr/src/linux-2.6.25.7目录下可以这样打补丁。
bzip2 -dc /usr/src/patch.bz2 | patch -p1 --dry-run(测试补丁,如果有误,请勿继续下一步)
bzip2 -dc /usr/src/patch.bz2 | patch -p1
6. make menuconfig
常见错误
1 *** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
安装libncurses5-dev,用synaptic安装
2 Your display is too small to run Menuconfig!
It must be at least 19 lines by 80 columns.
make[1]: *** [menuconfig] Error 1
make: *** [menuconfig] Error 2
将编译窗口拉大点,就行了
Load an Alternate Configuration File 行后选择.config文件(包含了当前工作内核的配置)做为配置文件:
然后浏览内核配置菜单, 选择你需要的功能. 完成配置后, 选择 Exit, 回答下面的问题( Do you wish to save your new kernel configuration? 你希望保存新的内核配置吗?), 选择 Yes:
7. 执行下面命令来构建内核:
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
阅读(863) | 评论(0) | 转发(0) |
<script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/buttonLite.js#style=-1&uuid=&pophcol=3&lang=zh"></script> <script type=text/javascript charset=utf-8 src="http://static.bshare.cn/b/bshareC0.js"></script>
预备工作:
1.使用root账户登录系统。初始装的系统是不允许root登录的。
system->系统管理->登录窗口安全选项卡->选上allow local system administrator login
system->系统管理->用户和组->选root 点unlock,双击root,弹出对话框,更改root的密码
2.更新synaptic源,使用8.04的,请参考下面链接的文章
http://blog.chinaunix.net/u2/70469/showart_718273.html
3.必备工具,可用synaptic安装,synaptic基于apt-get的
apt-get install kernel-packagelibncurses5-dev fakeroot wget bzip2
4.下载2.6最新稳定版内核,我下载的是linux-2.6.25.7.tar.gz,我把它放在/usr/src/目录下
http://www.kernel.org/pub/linux/kernel/v2.6/
5.进下载的目录,解压(现在都支持图形界面解压方式了)
tar -zxvf linux-2.6.25.7.tar.gz
cd /usr/src/linux-2.6.25.7
cp /boot/config-`uname -r` ./
可以手动拷贝文件是/boot/config-2.6.24-16-generic,这个文件是2.6.24-16内核的配置文件,也是我安装好系统后的配置。使用这个配置,可以保证不出错误。
假设/usr/src下有补丁文件patch.bz2,你在/usr/src/linux-2.6.25.7目录下可以这样打补丁。
bzip2 -dc /usr/src/patch.bz2 | patch -p1 --dry-run(测试补丁,如果有误,请勿继续下一步)
bzip2 -dc /usr/src/patch.bz2 | patch -p1
6. make menuconfig
常见错误
1 *** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
安装libncurses5-dev,用synaptic安装
2 Your display is too small to run Menuconfig!
It must be at least 19 lines by 80 columns.
make[1]: *** [menuconfig] Error 1
make: *** [menuconfig] Error 2
将编译窗口拉大点,就行了
Load an Alternate Configuration File 行后选择.config文件(包含了当前工作内核的配置)做为配置文件:
然后浏览内核配置菜单, 选择你需要的功能. 完成配置后, 选择 Exit, 回答下面的问题( Do you wish to save your new kernel configuration? 你希望保存新的内核配置吗?), 选择 Yes:
7. 执行下面命令来构建内核:
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
在--append-to-version= 后面你可以写上任何字符串来区别内核版本, 但是必须以" - "符号开始而且后面不包括任何空格.
保持耐心, 内核编译需要一定时间, 主要看你的内核配置和处理器速度.
8.安装内核
编译好内核后,在上一级目录下会出现两个.deb结尾的包,一个是以linux-image开头、一个以linux-header开头
安装所有deb包
cd ..
dpkg -i *.deb
9.启动菜单是/boot/grub/menu.list,可以根据需要进行编辑
相关热门文章
给主人留下些什么吧!~~
评论热议