- 论坛徽章:
- 59
|
本帖最后由 renxiao2003 于 2010-04-29 09:08 编辑
1、到www.kernel.org上下载内核源码,目前最新的版本是2.6.34-rc5。
如果需要将内核编译成deb包,需要kernel-package fakeroot,用下面的命令安装
apt-get install kernel-package fakeroot (需要root身份用户)
2、将下载的文件放到/usr/src下,解压
tar -jxvf kernel-2.6.34-rc5.tar.bz2
解压后生成一个目录kernel-2.6.34-rc5,然后进入这个目录。
3、使用正在运行的配置文件:
make oldconfig
然后进行修改:
make menuconfig
生成新内核:
make-kpkg clean
make-kpkg --initrd --append-to-version=new --revision=1.0 kernel-image
在运行make menuconfig时,可能会遇到“'make menuconfig' requires the ncurses libraries”这个错误,没关系,安装需要的包:
apt-get install libncurses*
4、安装新内核
seabird-debian:/usr/src# dpkg -i linux-image-2.6.18lilin_1.0_i386.deb
选中了曾被取消选择的软件包 linux-image-2.6.18lilin。
(正在读取数据库 ... 系统当前总共安装有 119841 个文件和目录。)
正在解压缩 linux-image-2.6.18lilin (从 linux-image-2.6.18lilin_1.0_i386.deb) ...
Done.
正在设置 linux-image-2.6.18lilin (1.0) ...
Running depmod.
Finding valid ramdisk creators.
Using mkinitramfs-kpkg to build the ramdisk.
Running postinst hook script /sbin/update-grub.
You shouldn't call /sbin/update-grub. Please call /usr/sbin/update-grub instead!
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.18lilin
Found kernel: /boot/vmlinuz-2.6.18-6-686
Found kernel: /boot/vmlinuz-2.6.18-5-686
Found kernel: /boot/vmlinuz-2.6.18-4-686
Updating /boot/grub/menu.lst ... done
seabird-debian:/usr/src#
注意红色的那一行,按提示自己运行一下
seabird-debian:/usr/src# update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.18lilin
Found kernel: /boot/vmlinuz-2.6.18-6-686
Found kernel: /boot/vmlinuz-2.6.18-5-686
Found kernel: /boot/vmlinuz-2.6.18-4-686
Updating /boot/grub/menu.lst ... done
seabird-debian:/usr/src#
好了,新的kernel已经添加到启动列表了,reboot,你就可以使用新内核了!
PS:2010-04-28晚上终于把内核编译成功并安装上了。也正常。在kernel-2.6.34-rc5中已经不用运行update-grub这个了。
注意:上述命令都需要以root身份运行!
参考:http://blog.sina.com.cn/s/blog_40e5d1fb0100ek92.html
http://blog.csdn.net/ytu_cyc/archive/2009/09/22/4581522.aspx |
|