ITPub博客

首页 > 自动化运维 > > 升级2.6内核的经验与心得

升级2.6内核的经验与心得

作者:飘絮絮絮丶 时间:2020-05-19 16:36:35 0 删除 编辑

1.准备:
下载2.6内核linux-2.6.2-rc2.tar.gz
http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.2-rc2.tar.gz
不需要下载http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.2-rc2.gz
这个补丁是给以前的内核版本升级到2.6.2-rc2用的

2.本人系统为redhat8.0
解压到目录/usr/src
#cp linux-2.6.2-rc2.tar.gz /usr/src
#cd /usr/src
#tar -zxvf linux-2.6.2-rc2.tar.gz

建立链接文件
#cd /usr/src
#ln –s linux-2.6.2-rc2 linux-2.6
#ln –s linux-2.6 linux

检查原代码
#cd /usr/src/linux
#make mrproper
这步是为确保原代码目录下没有不正确的.o文件及文件的相互依赖。

配置核心选项
#make menuconfig
基本上保持默认选项就可以了,但是要注意的是必须把ext2和ext3文件系统支持编进内核,否则升级内核重新启动是会有错误:
Kernel panic: No init found. Try passing init= option to kernel
ext2和ext3文件系统配置为:
File systems -
<*>; Second extended fs support
Ext2 extended attributes
Ext2 POSIX Access Control Lists
Ext2 Security Labels
<*>; Ext3 journalling file system support
Ext3 extended attributes
Ext3 POSIX Access Control Lists
Ext3 Security Labels
JBB (ext3) debugging support

编译内核

确保所有文件都处于最新的版本状态下
#make clean

编译模块
#make modules

安装模块
#make modules_install
此时在/lib/modules下出现新内核模块文件夹2.6.2-rc2

使用新内核
#cp System.map /boot/System.map-2.6.2-rc2
#rm /boot/System.map
#ln –s /boot/System.map-2.6.2-rc2 /boot/System.map
#cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.2-rc2
#rm /boot/vmlinuz
#ln –s /boot/vmlinuz-2.6.2-rc2 /boot/vmlinuz
#new-kernel-pkg –install –mkinitrd –depmod 2.6.2-rc2
执行完new-kernel-pkg命令后在/boot下生成新印象文件initrd-2.6.2-rc2,同时/etc/grub.conf中增加了新核心的启动项,
例如:
Tilte linux (2.6.20-rc2)
Root(hd0,0)
Kernel /boot/vmlinuz-2.6.2-rc2 ro root=LABEL=/
Initrd /boot/initrd-2.6.2-rc2
将kernel项中的root=LABEL=/ 改成 root=/dev/hda7 (/dev/hda7是本人linux的根分区),否则重启动后会有错误:
Kernel panic: No init found. Try passing init= option to kernel

#reboot
重启后Grub中出现2.6内核的启动项,现在就用新的核心试试吧。

文章来源CU社区:升级2.6内核的经验与心得

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69946831/viewspace-3156612/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 8.6 优化 MyIASM 表
请登录后发表评论 登录
全部评论

注册时间:2019-09-09

  • 博文量
    2646
  • 访问量
    42285