免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 988 | 回复: 0
打印 上一主题 下一主题

Compile Linux 2.6 Kernel [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-06 07:50 |只看该作者 |倒序浏览

                Compile Linux 2.6 Kernel
1.Download kernel:
http://www.kernel.org/pub/linux/kernel/v2.6/
2.Copy code to work directory:
#cp linux-2.6.18.1.tar.gz  /usr/src
#cd /usr/src
3.If there is an old edition,delete the symbol link:
#rm -f linux-2.4
4.decompress the packdge:
#tar -zxvf  linux-2.6.18.1.tar.gz
5.enter the compile directory:
#cd   /usr/src/linux-2.6.18.1
6.This command ensure there is no .o file & dependence between files in the directory
#make mrproper
7make a backup
#cp -r /boot /boot_bak
8.see the position of root directory
#df
以下是偶机器的部分输出:
Filesystem                                                  Size    Used   Avail   Use%   Mounted on
/dev/mapper/VolGroup00-LogVol00      22G    3.7G    17G    19%      /
/dev/hda3                                                    99M    12M     82M    13%      /boot
...
看看你的系统根目录装在哪里很重要,因为后面你将会看到系统安装编译好的内核时在grub.conf插入的命令中root=LABEL=/ hdc=ide-scsi
可能会引发系统引导时的如下错误:
VFS: Cannot open root device "" or 00:00
Please append a correct "root=" boot option
Kernel panic: VFS: Unable to Mount root fs on 00:00
所以要在grub.conf里可能会修改其命令为:root=/dev/VolGroup00/LogVol00
9.#cd   /usr/src/linux-2.6.18.1
#make menuconfig
8.3用以下命令读取刚才的配置数据使之生效:
#make dep
#make clean
9.开始编译内核和模块
#make bzImage
#make modules
#make modules_install
10.将编译好的文件移到/boot下;
#mv /usr/src/linux-2.6.18.1/System.map       /boot/System.map-2.6.18.1
#mv /usr/src/linux-2.6.18.1/arch/i386/boot/bzImage       /boot/vmlinuz-2.6.18.1
#mkinitrd   initrd-2.6.18.1.img   2.6.18.1      
//上面的命令是用来创新initrd映像的,不创建这个文件,有时是启动不起来的,比如提示VFS错误等;
11.修改/boot/grub/menu.lst文件,添加以下内容:
 title Fedora Core (2.6.18.1)
              root (hd0,2)
              kernel /vmlinuz-2.6.18.1 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              initrd /initrd-2.6.18.1.img
制作文件系统
制作文档
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/95345/showart_1919209.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP