linux内核从2.4.20升级到2.6.18
2010-12-02 09:34
369 查看
![](http://blog.51cto.com/image/skin/artType01.jpg)
linux内核从2.4.20升级到2.6.18
今天总结一下内核升级,我个人观点:升级
linux
还不如下载个高版本的
linux
来安装,升级高版本的
linux
内核还要升级
gcc
编译器,还有一些
gcc辅助
工具,编译一个
gcc
要一个钟左右,如果升级了,根文件系统又不支持,又要升级根文件系统,很麻烦。
一下,很多文章都有介绍,下面升级一个不要升级
GCC
的
2.6.18
的版本的
linux
内核,找内核可以到
http://www.kernel.org
官方网站下载。到 http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2下载
linux-2.6.18.tar.bz2
内核。
我做实验的是
linux-2.6.18.tar.bz2
稳定版,第一个数字
2
是主版本号,第二个数字
6
为次版本号,第三个是修订号。如果次版本号为偶数则是稳定版,如果是奇数则是开发版。一个操作系统至少有引导程序(
bootloader
)、内核
(kernel)
、根文件系统
(Rootfs).
现代的操作系统一般由进程管理、内存管理、文件系统、驱动程序和网络等几个功能模块组成。内核的源代码目录:
arch:
所有和体系结构相关的核心代码。
Include:
内核大部分头文件
Init:
内核的初始化代码(不是系统的引导代码)
Mm:
内存管理代码
Driver:
设备驱动代码
Ipc:
核心进程间的通信代码
Fs:
存放
linux
支持的文件系统代码
Kernel
:内核管理的核心代码
Net:
内核网络部分代码
Lib:
核心的库代码
Script:
用于配置核心的脚本文件
Documentation:
一些文档,是对每个目录作用的具体说明
辅助内核升级
工具下载,可以默认安装
http://ftp.ntu.edu.tw/linux/utils/kernel/module-init-tools/
http://rpm.pbone.net/index.php3/stat/4/idpl/1534750/com/mkinitrd-4.1.18-2.i386.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/1534711/com/lvm2-2.00.25-1.01.i386.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/1532769/com/device-mapper-1.00.19-2.i386.rpm.html
编译的大概流程是:
(1)Make menuconfig //
配置编译选项
(
2
)
make dep //
提供变量依赖关系信息
(
3
)
make clean //
删除生成的模板和目标文件
(
4
)
make zImage //
编译内核生成压缩的映像
(5) make modules //
编译安装
(
6
)
make modules_install //
安装编译完成的模板
编译完成之后最终在
linux-2.6.18/arch/i386/boot/bzImage
压缩内核映像。
(
7
)
make install //
安装
[root@localhost root]#cd /mnt/hgfs/linux
//
切换到共享目录
[root@localhost linux]#cp linux-2.6.18.tar.bz2 /usr/src/
//
拷贝内核文件到
/usr/src
目录下
[root@localhost src]#tar –xjvf linux-2.6.18.tar.bz2
//
解压内核
bz2
压缩包
![](http://img1.51cto.com/attachment/201003/201003301269957997296.jpg)
[root@localhost src]# cd linux-2.6.18
//
到内核目录
[root@localhost linux-2.6.18]# make mrproper
//
清理源代码树
[root@localhost linux-2.6.18]# make menuconfig
//
进入
menuconfig
配置菜单
![](http://img1.51cto.com/attachment/201003/201003301269958016234.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958032359.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958060843.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958070781.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958078328.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958085359.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958091890.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958098250.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958104203.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958111156.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958131968.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958139046.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958145718.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958151906.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958164328.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958176187.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958231765.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958249234.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958259671.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958267937.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958283921.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958299078.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958313375.jpg)
[root@localhost linux-2.6.18]#make clean
//
清除产生的生成的模板和目标文件
[root@localhost linux-2.6.18]#make bzImage
//
编译内核生成压缩的映像
![](http://img1.51cto.com/attachment/201003/201003301269958333671.jpg)
[root@localhost linux-2.6.18]#make modules
//
编译模块
![](http://img1.51cto.com/attachment/201003/201003301269958447218.jpg)
[root@localhost linux-2.6.18]#make modules_install
//
安装编译完成的模块
![](http://img1.51cto.com/attachment/201003/201003301269958458687.jpg)
[root@localhost linux-2.6.18]#make install
//
安装内核
![](http://img1.51cto.com/attachment/201003/201003301269958475046.jpg)
[root@localhost linux-2.6.18]# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.18
//
拷贝
bzImage
到
boot
目录,命名为
vmlinuz-2.6.18
cp
:是否覆盖‘
/boot/vmlinuz-2.6.18
’
? y
[root@localhost linux-2.6.18]# cp System.map /boot/System.map-2.6.18
//
拷贝
System.map
到
boot
目录,命名为
System.map-2.6.18
cp
:是否覆盖‘
/boot/System.map-2.6.18
’
? y
[root@localhost linux-2.6.18]# cd /boot
//
切换到
boot
目录
[root@localhost boot]# rm -rf System.map
//
删除源有的
System.map
连接名
[root@localhost boot]# rm -rf vmlinuz
//
删除源有的
vmlinuz
连接名
[root@localhost boot]# ln -s System.map-2.6.18 System.map
//
建立软连接
[root@localhost boot]# ln -s vmlinuz-2.6.18 vmlinuz
//
建立软连接
[root@localhost boot]# new-kernel-pkg --mkinitrd --depmod --install 2.6.18
//
执行
new-kernel-pkg
命令生成镜像文件
![](http://img1.51cto.com/attachment/201003/201003301269958512406.jpg)
这步做不做也没有多大的关系,直接修改
/boot/grub/grub.conf
文件就可以了
![](http://img1.51cto.com/attachment/201003/201003301269958529984.jpg)
[root@localhost boot]#df –h
//
查看根目录设备名称
![](http://img1.51cto.com/attachment/201003/201003301269958545453.jpg)
[root@localhost boot]# vim /boot/grub/grub.conf
//
编辑启动文件
![](http://img1.51cto.com/attachment/201003/201003301269958562296.jpg)
default=0
//
设置为第一启动程序
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.6.18)
root (hd0,0)
kernel /vmlinuz-2.6.18 ro root=/dev/sda2
//
修改设备名
initrd /initrd-2.6.18.img
title Red Hat Linux (2.4.20-8)
root (hd0,0)
kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
initrd /initrd-2.4.20-8.img
![](http://img1.51cto.com/attachment/201003/201003301269958591171.jpg)
![](http://img1.51cto.com/attachment/201003/201003301269958607078.jpg)
查看内核版本信息可以用
uname –a
或用
cat /proc/version
![](http://img1.51cto.com/attachment/201003/201003301269958625187.jpg)
参考文章:
http://blog.csdn.net/xqt8888/archive/2007/09/21/1795234.aspx
本文出自 “嵌入式技术
” 博客,请务必保留此出处/article/4506673.html
相关文章推荐
- (转)Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- linux内核从2.4.20升级到2.6.18
- Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- (原创)Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- vmware6.0 Redhat9.0下面 从内核2.4.20升级到2.6.18 (2.6.24) 常见问题
- Linux内核升级(2.4.20-8->2.6.10)
- VMware 下redhat 9.0内核升级(2.4.20-8到2.6.18)
- linux内核升级(2.6.18到3.9.3)
- Redhat9内核升级(2.4.20-8到2.6.18)
- Linux kernel内核升级全过程,教你一次成功(2.4.20-8到2.6.18)
- 升级linux2.4.20内核到2.6.18
- Linux内核升级手记(2.4.20-8 ~ 2.6.8)
- Linux内核升级2.4.20-8至2.6.24
- Linux内核从2.6.18升级到2.6.28(最新)全过程
- Linux内核升级全过程 手把手教你一次成功(2.4.20-8到2.6.18)
- Linux内核从2.6.18升级到2.6.28(最新)全过程
- linux内核从2.4.20-8升级到2.6.0版本步骤