欢迎来到麦麦的不老阁

记录一些关于自己在linux、网络应用、个人心情故事的文字...

关于我

我喜欢搬个小板凳坐在马路边看MM,喜欢把双手插裤兜...更多机密资料... »

Member Login

Lost your password?

麦麦的不老阁

关注互联网,关注Linux,关注社会,关注生活…

Fedora10下编译内核

环境:fedora10,内核包:linux-2.6.29.3.tar.bz2 (F)完整的内核包。

1、将linux-2.6.29.3.tar.bz2复制到/usr/src/kernel
解压索内核包:

tar -jxvf linux-2.6.29.3.tar.bz2

解压后生成一个名为linux-2.6.29.3的目录。

2、将旧内核中config文件复制到linux-2.6.29.3目录下。

cp usr/src/kernel/`uname -r`/.config /usr/src/kernle/linux-2.6.29.3

为什么要这么做?因为.config是旧内核的配置文件,编译新内核并非要完全重来,在模块选择一些参数,基本上是相同的,所以可以沿用前一版本的内核来做小调整即可!

3、重头戏开始了,用什么工具呢?make menuconfig?make xconfig?make gconfig?
当然用make menuconfig了,字符模式,不需要X的支持,make xconfig、make gconfig都需要X支持,make gconfig还需要GDK支持。

执行[root@fedora ~]# make menuconfig

执行后,menuconfig工具读取的就是.config文件,所以现在应该明白刚才那个.config到底是什么了。现在可以通过menuconfig中简单的三个菜单“ “来选择内核模块了,当所有的内核模块都选择完毕后,就保存.config文件。

[root@fedora linux-2.6.29.3]#make clean
这个步骤是清理旧的*.o文件,我这里是编译全新下载的内核,所以等于是多此一句的步骤。

[root@fedora linux-2.6.29.3]#make bzImage
制作核心档案,过程漫长,你现在要做的事情就是冲杯咖啡,看看电影,听听音乐…

[root@fedora linux-2.6.29.3]#make modules
制作内核中选择需要的模块文件。

[root@fedora linux-2.6.29.3]#make modules_install
安装模块,安装的位置当然是/lib/modules中。

[root@fedora linux-2.6.29.3]# make install
sh /usr/src/kernels/linux-2.6.29.3/arch/x86/boot/install.sh 2.6.29.3 arch/x86/boot/bzImage System.map “/boot”
The default plymouth plugin (.so) doesn’t exist
遇到错误了:The default plymouth plugin (.so) doesn’t exist,缺少plymouth plugin的库文件,这好办,立马安装!

[marco.chan@fedora kernels]$ sudo yum install -y plymouth-plugin-solar
中间显示过程省略~

重新执行make install。
[root@fedora linux-2.6.29.3]# make install
sh /usr/src/kernels/linux-2.6.29.3/arch/x86/boot/install.sh 2.6.29.3 arch/x86/boot/bzImage System.map “/boot”
好了,顺利安装。

[root@fedora linux-2.6.29.3]# 查看一下grub.conf文件。[quote]# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,1)
# kernel /boot/vmlinuz-version ro root=/dev/sda2
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.29.3) #这就是刚才新编译内核后,产生的启动项目。
root (hd0,1)
kernel /boot/vmlinuz-2.6.29.3 ro root=UUID=0ed5871a-4675-4365-ab8c-375324900450 quiet
initrd /boot/initrd-2.6.29.3.img
title Fedora (2.6.27.21-170.2.56.fc10.i686)
root (hd0,1)
kernel /boot/vmlinuz-2.6.27.21-170.2.56.fc10.i686 ro root=UUID=0ed5871a-4675-4365-ab8c-375324900450 quiet
initrd /boot/initrd-2.6.27.21-170.2.56.fc10.i686.img
title Fedora (2.6.27.5-117.fc10.i686)
root (hd0,1)
kernel /boot/vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=0ed5871a-4675-4365-ab8c-375324900450 quiet
initrd /boot/initrd-2.6.27.5-117.fc10.i686.img
title Other
rootnoverify (hd0,0)
chainloader +1[/quote]
reboot系统,测试能否正常启动。内核编译后,有些软件需要重新编译的,比如说VBOX,NVIDIA等,请在系统重启后重新编译一次即可。

本文评论 2 comments

  1. Yousri 奋力的盖起一层楼:

    想了解下 内核编译大致需要多长时间啊?! 45分钟能编译完么?

    ps:晕倒 评论竟然不能首字换行 也不能首字空格 这啥原则丫
    [reply=LinuxHobby,2009-05-10 08:52 AM]根据自己电脑的性能,以及选择模块的多少,所需时间是不一样的!45分钟应该是不够的!我的电脑不算差,前后加起来也花了将近一个多小时。[/reply]

  2. falcon 奋力的盖起一层楼:

    楼主为什么不用make xconfig呢?

Wordpress

Wordpress 程序应用

玩转Linux

把Linux当玩具

博客相关

主流博客程序

Twitter

Twitter,我唉推特

游荡互联网

在网上做点啥?

废话互联网

个人观点类文章

Fedora

我最喜欢的Linux发行版

Arch

Archlinux相关

应用笔记

Linux应用笔记

业界资讯

互联网资讯

有点胸闷

有点胸闷,苟延残喘!

软件快递

收集软件资讯