linux源码升级内核
当前环境:[[email protected] ~]# uname -r
2.6.18-348.el5
配置流程:
1、准备yum库安装g++ gcc[[email protected] ~]# cat /etc/yum.repos.d/rh_5.9.repo
[rhel-server]
name=Red server
baseurl=file:///misc/cd/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[[email protected] ~]# yum -y install gcc g++
2、解压安装xz-5.0.5.tar.gz[[email protected] ~]# tar -zxf xz-5.0.5.tar.gz /usr/
[[email protected] ~]# cd /usr/
[[email protected] ~]# cd /usr/xz-5.0.5/
[[email protected] xz-5.0.5]# ./configure --prefix=/usr/local/
[[email protected] xz-5.0.5]# make
[[email protected] xz-5.0.5]# make install
2、验证安装xz-5.0.5.tar.gz是否成功[[email protected] xz-5.0.5]# which xzcat
/usr/local/bin/xzcat
3、安装linux-2.6.32.61.tar.xz[[email protected] usr]# cd /root/
[[email protected] ~]# unxz linux-2.6.32.61.tar.xz
[[email protected] ~]# tar -xf linux-2.6.32.61.tar -C /usr/
4、把/boot/config-2.6.18-348.el5 .config复制到刚才解压的位置命名
为"config"加快速度,减少出错。[[email protected] ~]# cd /usr/
[[email protected] usr]# cp /boot/config-2.6.18-348.el5 .config
5、配置[[email protected] usr]# cd linux-2.6.32.61/
[[email protected] linux-2.6.32.61]# make menuconfig
*** Unable to find the ncurses libraries or the
*** required header files.
*** ‘make menuconfig‘ requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] 错误 1
make: *** [menuconfig] 错误 2
[[email protected] linux-2.6.32.61]# yum -y install ncurses-devel //出现如
上错误,安装这个包即可
[[email protected] linux-2.6.32.61]# make menuconfig
展开File systems ---> DOS/FAT/NT Filesystems ---> NTFS file system support,设为[M]
展开Device Drivers ---> IEEE 1394 (FireWire) supports ---> FireWire driver stack,设为[ ]
(Exit 回车,重复多次,最后选择yes确认,保存到.config 配置文件) //编辑模块,根据自我定义增加和删除
编辑“.config”在末行添加
CONFIG_DEBUG_SECTION_MISMATCH=y //查看更详细输出
CONFIG_SYSFS_DEPRECATED_V2=y //启用新版sysfs路径
下面编译内核时间较长大约40分钟,你可以去冲杯offce了[[email protected] linux-2.6.32.61]# make //编译内核
[[email protected] linux-2.6.32.61]# make modules //编译模块
[[email protected] linux-2.6.32.61]# make modules_install //安装内核
不要把make modules_install写成make modules install
[[email protected] lmake install
16、启用新内核,修改默认引导项
[[email protected] lvim /etc/grub.conf
调整配置文件中的default项,由1改为0,然后重启即可。[[email protected] ~]# uname -r
2.6.32.61
注意:如果内核版本差太多,可能会失败。
原文:http://8824130.blog.51cto.com/8814130/1405615