Chinaunix

标题: 升级你的Debian Linux内核 [打印本页]

作者: heavyrain    时间: 2006-04-27 21:37
标题: 升级你的Debian Linux内核
关键词: Linux kernel compile 内核 升级
本文经验基于如下环境:
原Debian版本为:Debian GNU/Linux 3.1
原内核版本为:2.6.8-2-686
下载的新内核版本为:2.6.15.6
下载文件的存放路径为:/tmp
参考了文档:/usr/share/doc/kernel-package/README.gz
关于本文档:
/*********************************************************************
*filename: 六步升级你的Debian Linux内核到当前最新稳定版本
*purpose: 内核升级经验总结
*wrote by: zhoulifa(
zhoulifa@163.com
) 周立发(
http://zhoulifa.bokee.com
)
Linux爱好者 Linux知识传播者 SOHO族 开发者 最擅长C语言
*date time:2006-03-16 23:55:00
*Note: 任何人可以任意复制代码并运用这些文档,当然包括你的商业用途
* 但请遵循GPL
*********************************************************************/
The latest stable version of the Linux kernel is: 2.6.15.6
第一步,你得去
http://www.kernel.org
下载最新的Linux内核,2.6.15.6的下载地址是
http://www.kernel.org/pub/linux/ker....6.15.6.tar.bz2
,其它版本都可以从这里
http://www.kernel.org/pub/linux/kernel
下载到。
第二步,解压你的内核,假设你下载的内核文件存放在/tmp目录下面,那么你输入如下命令:
cd /tmp
tar -xjvf linux-2.6.15.6.tar.bz2


解压完毕后会生成/tmp/linux-2.6.15.6目录
第三(a)步,复制当前配置文件到新内核所在的目录,输入如下命令:
安装build-essential 包。否则报错:make[1]: *** [scripts/basic/fixdep] Error 1

cd /tmp/linux-2.6.15.6
cp /boot/config-2.6.8-2-686 .config


第三(b)步,重新编译你的内核,输入如下命令:
make-kpkg clean
make-kpkg kernel_image


此命令运行过程比较长,最后会在/tmp目录下生成一个deb文件
kernel-image-2.6.15.6_10.00.Custom_i386.deb
第四步,安装新内核,输入如下命令:
cd /tmp
dpkg -i kernel-image-2.6.15.6_10.00.Custom_i386.deb


此命令也会生成/lib/modules/2.6.15.6目录
第五步,生成initrd.img文件,输入如下命令:

mkinitrd -o initrd.img-2.6.16.11 /lib/modules/2.6.16.11
此时如果报错:
-bash: mkinitrd: command not found
就需要:apt-get install initrd-tools
报错
find: warning: you have specified the -mindepth option after a non-option argument -type, but options are not positional (-mindepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.
...*3
解决办法:
修改:
--- /usr/sbin/mkinitrd  
-               find /proc/scsi -type d -mindepth 1 -maxdepth 1 \
+               find /proc/scsi -mindepth 1 -maxdepth 1 -type d \
此命令会在/boot目录下生成initrd.img-2.6.15.6文件
第六步,更新Grub,输入如下命令:
update-grub


OK,重新启动你的电脑欣赏你的成果吧。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16009/showart_105750.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2