inux 内核升级 2011-03-25 23:13:28 

分类: LINUX

因要测试一些软件,需要2.6.30以上的内核,安装好CentOS 5.5,内核是2.6.18-194.el5.这次的升级还算比较顺利,具体的过程如下:
[root@localhost ~]# uname -r
2.6.18-194.el5
1.下载linux-2.6.30内核包到/usr/src目录
cd /usr/src
wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.gz
tar -xzvf linux-2.6.38.tar.bz2 -C /usr/src
cd linux-2.6.38
make mrproper 清除环境变量,即清除配置文件
make menuconfig 在菜单模式下选择需要编译的内核模块: networking support—>networking options—>network packet filtering framework(netfilter) (1).core netfilter configuration
A 勾中”Netfilter connection tracking support” -m state相关模块是依赖它的,不选则没有。
B 将netbios name service protocal support(new) 编译成模块,不然后面升级iptables后启动时会出错
C 勾中“Netfilter Xtables support (required for ip_tables)”
(2).IP: Netfilter Configuration
A 将 “IPv4 connection tracking support (require for NAT)” 编译成模块。
B 勾中IP tables support (required for filtering/masq/NAT) 。
C 将 “Full NAT” 下的 “MASQUERADE target support” 和 “REDIRECT target support” 编译成模块 如果要安装iotop工具,在编译内核的时候一定要把:General setup ——Enable per-task storage I/O accounting这个选项选上。 (3).其它模块可以根据自己的需要进行选择,若不懂可以参考内核配置手册. 如果是LVM文件系统 需要注意的是:在2.6.xx版的内核中在配置文件中有部分配置需要手动修正: CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y 否则在使用LVM的linux系统下,内核编译成功但是会提示找不到VolGroup00等错误,并直接导致内核启动失败,文件系统挂载出错。 开始升级: make clean 确保所有东西均保持最新状态.
make bzImage 生成内核文件
make modules 编译模块
make modules_install 安装模块
make install 安装 2.并把default=1改为default=0
[root@localhost ~]# cat /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/rootvg/rootvol
# initrd /initrd-version.img
#boot=/dev/sda
default=0 timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.38)
root (hd0,0)
kernel /vmlinuz-2.6.38 ro root=/dev/rootvg/rootvol
initrd /initrd-2.6.38.img
title CentOS (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/rootvg/rootvol
initrd /initrd-2.6.18-194.el5.img 3.此步若没有操作,重启会报错”insmod: error inserting ‘/lib/dm-region-hash.ko’: –1 File exits”,原因是重复了,根据网上查到的资料,2.6.x自编译内核会有这个小bug,我测试过不修改直接重启,虽然有报错,但仍然可以进入系统的.
[root@localhost]cp /boot/initrd-2.6.38.img /tmp
[root@localhost]cd /tmp/
[root@localhost tmp]mkdir newinitrd
[root@localhost tmp]cd newinitrd/
[root@localhost newinitrd]zcat ../initrd-2.6.38.img |cpio -i
[root@localhost newinitrd]vi init 删掉重复的如下两行:
echo “Loading dm-region-hash.ko module”
insmod /lib/dm-region-hash.ko [root@localhost newinitrd]# find .|cpio -c -o > ../initrd
14765 blocks
[root@localhost newinitrd]# cd ..
[root@localhost tmp]# gzip -9 < initrd > initrd-2.6.38.img
[root@localhost tmp]# ls
gconfd-root initrd initrd-2.6.38.img mapping-root newinitrd scim-panel-socket:0-root
[root@localhost tmp]# mv /boot/initrd-2.6.38.img /home/
[root@localhost tmp]# cp initrd-2.6.38.img /boot/
[root@localhost tmp]#reboot 4.重启成功后,再看看内核,是2.6.38,ok了。
[root@localhost ~]# uname -r
2.6.38 -------------------------------------------------------------------- 先需要升级到 Linux 2.6.32, 由于 2.6.3x 的内核编译步骤基本相似,所以本文标题写的是 2.6.32x . (1) 下载标准内核 2.6.32,并解压至目录下,如 /usr/src (2) make menuconfig 选择相关内核模块 cd /usr/src/linux-2.6.32 cp /usr/src/kernels/2.6.18-194.el5-x86_64/.config . <将当前内核的 .config 复制过来> make menuconfig 注意一定要选择 General Setup-> enable deprecated sysfs features to support old...
(即生成的新 .config文件中的 CONFIG_SYSFS_DEPRECATED_V2=y ),若不如此选择,编译完内核重新启动时会报错“mount:could not find filesystem ‘/dev/root’。 这是新版内核特有的选项,老内核没有 CONFIG_SYSFS_DEPRECATED_V2 选项,老内核的.config也和新内核不一样,但是使用新内核的 make menuconfig 产生的 .config 不仅包含了复制过来的 .config 文件中的相关选项,还包含一些新选项. networking support—–>networking options—->network packet filtering framework(netfilter) 1 —->core netfilter configuration
A 勾中”Netfilter connection tracking support” -m state相关模块是依赖它的,不选则没有。
B 将netbios name service protocal support(new)编译成模块,不然后面升级iptables后启动时会出错
C 勾中“Netfilter Xtables support (required for ip_tables)” 2 —–>IP:Netfilter Configuration
A 将 “IPv4 connection tracking support (require for NAT)” 编译成模块。
B 勾中IP tables support (required for filtering/masq/NAT) 。
C 将 “Full NAT” 下的 “MASQUERADE target support” 和 “REDIRECT target support” 编译成模块 这个地方也可以下载热点内核标准配置文件
1.wget http://vbets.googlecode.com/files/config
2.mv config .config 保存 .config (3) 编译内核
make clean 确保所有东西均保持最新状态.
make bzImage 生成内核文件
make modules 编译模块
make modules_install 安装模块
make install 安装 (4) 修改/etc/grub.conf,选择新内核,重启系统。

linux 内核升级 转的更多相关文章

  1. linux 内核升级

    LINUX 内核升级 linux 内核官网 https://www.kernel.org/ POST BIOS(boot sequence) 所选择的启动设备次序的MBR中是否有引导程序, ----& ...

  2. linux内核升级图文攻略(转)

    一.Linux内核概览Linux是一个一体化内核(monolithic kernel)系统.设备驱动程序可以完全访问硬件.Linux内的设备驱动程序可以方便地以模块化(modularize)的形式设置 ...

  3. linux内核升级图文攻略

    Linux内核概览 Linux是一个一体化内核(monolithic kernel)系统. 设备驱动程序可以完全访问硬件. Linux内的设备驱动程序可以方便地以模块化(modularize)的形式设 ...

  4. linux 内核升级2 转

    linux内核升级 一.Linux内核概览 Linux是一个一体化内核(monolithic kernel)系统. 设备驱动程序可以完全访问硬件. Linux内的设备驱动程序可以方便地以模块化(mod ...

  5. Linux内核升级修复系统漏洞-RHSA-2017:2930-Important: kernel security and bug fix update

    公司使用的阿里云服务器(Centos7.4 x86_64bit)内核版本为:3.10.0-693.21.1.el7.x86_64, 2019年3月4日 02:07:58通过云盾安骑士-->漏洞管 ...

  6. Redhat Linux内核升级全记录(转)

        http://www.sina.com.cn 2001/06/15 15:38 中国电脑教育报 李红   Redhat Linux因为比较容易上手,所以用户很多.它系统配置完善,预装了丰富的应 ...

  7. linux内核升级(ubuntu12.04从3.13.0升级到3.4.0 )

    花了一天的时间,终于把ubuntu12.04 的linux内核版本从3.13.0升级到3.4.0 升级后,系统更加稳定.具体步骤:# wget http://www.kernel.org/pub/li ...

  8. Linux内核升级导致无法启动,Kernel panic - not syncing Unable to mount root fs on unknown block(0,0)

    问题原因:内核的某次升级,导致系统无法启动. 首先进入recovery模式:引导界面选择-->Ubuntu高级-->出现的选项中选择能够启动的recovery模式(几个内核版本分别试一下) ...

  9. 从Linux内核升级的必要性说开去

    Linux内核更新超级频繁,可是有必要时刻升级吗?个人感觉没有必要,可是你要时刻关注新特性列表,然后把自己的内核升级到离最新版本号差一两个月公布的版本号而不是最新版本号.以保证稳定性,由于一两个月的时 ...

随机推荐

  1. Java 学习札记(一)JDK安装配置

    Windows上配置JDK 1.下载windows版JDK 网址:http://www.oracle.com/technetwork/java/javase/archive-139210.html 2 ...

  2. SpringBoot 构建RestFul API 含单元测试

    相关博文: 从消费者角度评估RestFul的意义 SpringBoot 构建RestFul API 含单元测试 首先,回顾并详细说明一下在快速入门中使用的  @Controller .  @RestC ...

  3. Linux硬盘的检测(原创)

    http://czmmiao.iteye.com/blog/1058215 概述 随着硬盘容量.速度的快速发展,硬盘的可靠性问题越来越重要,今天的单块硬盘存储容量可轻松达到1TB,硬盘损坏带来的影响非 ...

  4. makefile 中 foreach

    四.foreach 函数 foreach函数和别的函数非常的不一样.因为这个函数是用来做循环用的,Makefile中的foreach函数几乎是仿照于Unix标准Shell(/bin/sh)中的for语 ...

  5. 解决chrome运行报错unknown error: cannot get automation extension

    今天把默认浏览器改成chrome,结果一运行脚本就报错,具体错误信息如下. FAILED CONFIGURATION: @BeforeClass beforeClassorg.openqa.selen ...

  6. Kotlin 语言下设计模式的不同实现

    偶然在 Github 上看到 dbacinski 写的 Kotlin 语言下设计模式的不同实现(这里的不同是相对于 Java 语言的),有些实现非常好,但是有些实现的例子不是很赞同.所以自己写了 Ko ...

  7. 修复 Tween.JS 的 onStop 设置无效

    Tween.js 个人认为还是一个比较不错的 缓动动画库,给作为学渣的我实现一些酷酷的动画带来了极大的遍历. 但是,今天突然发现特么设置onStop的回调函数居然没反应...... 作为一个渣渣只能一 ...

  8. VC++一些开发心得与调试技巧

         1.如何在Release状态下进行调试 Project->Setting=>ProjectSetting对话框,选择Release状态.C/C++标签中的Category选Gen ...

  9. 记一些使用PyQt的问题

    本文自用,日常记录,不断更新 环境 1.使用 PyCharm IDE 2.PyQt5 3. 扩展配置 PyUIC转换后的代码处理 PyUIC 用于 将 QtDesigner 生成的 .ui 文件转换为 ...

  10. Ueditor结合七牛云存储上传图片、附件和图片在线管理的实现和最新更新

    最新下载地址: https://github.com/widuu/qiniu_ueditor_1.4.3 Ueditor七牛云存储版本 注意事项 老版本请查看 : https://github.com ...