jane0000 发表于 2006-4-24 10:05:06

虚拟机下redhat内核升级到2.6.16的成功经验

弄了好几天,终于成功编译了Linux的新内核,相信很多人在编译内核时,也会遇到和我类似的问题,现我就将我的成功步骤和大家共享,这些内容是综合了很多关于在虚拟机下编译内核的帖子:

1、首先必须对一些相关软件进行升级。
1。1device-mapper,在 ftp://sources.redhat.com/pub/dm下载   ÷cd /usr/src
tar -zxvf device-mapper.1.01.04.tgz
cd device-mapper.1.01.04
./configure --prefix=/usr   否则LVM2在配置时找不到libdevmapper.h
make all
make install

1。2. 安装 LVM2,在 ftp://sources.redhat.com/pub/lvm2下载cd /usr/src
tar -zxvf LVM2.2.01.14.tgz
cd LVM2.2.01.14
./configure --prefix=/
make all
make install


1。3. 升级 mkinitrd 在 http://rpm.pbone.net/ 下查找
rpm -Uvh mkinitrd-3.5.11-3.9.i386.rpm

1。4.update modutils 在 ftp://ftp.kernel.org/pub/linux/utils/kernel/modutils/下载   
cd /usr/src
tar -zxvf modutils-2.4.27.tar.gz
cd modutils-2.4.27
./configure --prefix=/
make all
make install

1。5.安装module-init-tools,在 ftp://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools 下载http://www.kernel.org/pub/linux/utils/kernel/module-init-tools
cd /usr/src
tar -zxvf module-init-tools-3.2-pre9.tar.gz
cd module-init-tools-3.2-pre9
./configure --prefix=/
make moveold
make
make install

2、下载内核
下载内核文件如:linux-2.6.16.tar.gz拷贝到/usr/src目录并解压缩。 注意一定要在Linux下解开,如果你是在Windows下解开Linux内核的话就会遇到这个问题,因为Windows不区分文件大小写,ipt_TOS.c和ipt_tos.c在Windows中是一回事,就被替换掉了,改在Linux下解开它就没有问题了。
# cd /usr/src
# tar zvxf linux-2.4.18-3.tar.gz

make mrproper
make menuconfig
make
make modules_install
make install

3、内核选项
配置2.6.16内核时如果你的主板是Intel芯片的话,你用默认配制也许就可以得到一个满意的内核哦。这里的难点是虚拟机下的SCSI选项,弄不好内核编译就必然失败。
  还有就是网卡,声卡芯片的型号了,他们的型号你都可以用lspci (非常重要的命令)查找到比如我的是。
你只要把你pci上的东西全部选择对了。 剩下就用默认的就可以了

1、Device Drivers -> Block devices ->
<*> RAM disk support
(16) Default number xxxxx
(16384) Default RAM disk size   一定要改为16384以上
[*] Initial RAM disk (initrd) support

2. 有SCSI卡(如VMware 中的BusLogic BT946C) 的要把它编译成模块(M) 不然会在make install 出错 。
(其它关于SCSI的选项为内核内建,Buslogic可以选择为模块,只是最后需要制作initrd模块)
Device Drivers--->SCSI device support---><*>   SCSI disk support
Device Drivers--->SCSI device support--->SCSI low-level drivers---> <*> BusLogic SCSI support

Device Drivers---> Fusion MPT device support---><M> Fusion MPT (base + ScsiHost) drivers和<M>   Fusion MPT misc device (ioctl) driver(这个不确定)

网卡驱动 :请务必把自己网卡对应的驱动编译进内核,常用的网卡是realtek 8139,以下就是这种网卡的配置,
Device Drivers---> Networking support---> Ethernet (10 or 100Mbit) --->
<M> RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support (EXPERIMENTAL)
<M> RealTek RTL-8139 PCI Fast Ethernet Adapter support
<M> AMD PCnet32 PCI support(虚拟机)

3、Device Drivers -> USB support ->USB HID Boot Protocol drivers ->
[ M ]USB HIDBP Keyboard support
[ M ]USB HIDBP Mouse support 必须选,否则不支持USB鼠标和USB键盘。

Device Drivers -><*> ATA/ATAPI/MFM/RLL support
<*> Intel PIIXn chipsets support

4、声卡驱动Sound card support ,也要选择自己声卡对应的驱动编译进内核,比较普遍的声卡是i810_audio,以下就是这种声卡的配置。
关键是把Sound card support 以及 Advanced Linux Sound Architecture 里面的选项选成模块(M)
Device Drivers ---> Sound --->
<*> Sound card support
Advanced Linux Sound Architecture --->
<*> Advanced Linux Sound Architecture
<*> Sequencer support
< > Sequencer dummy client
<*> OSS Mixer API
<*> OSS PCM (digital audio) API[*] OSS Sequencer API
<*> RTC Timer support
PCI devices --->
<*> Intel i8x0/MX440, SiS 7012; Ali 5455; NForce Audio; AMD768/8111
Open Sound System --->
< > Open Sound System (DEPRECATED)
可以选上新支持的模块Advanced Linux Sound Architecture ,至于旧的Open Sound System 模块就不要再选了。

5. 文件系统
请务必要选中ext3文件系统,
File systems--->
[*] Ext3 journalling file system support
[*] Ext3 Security Labels
[*] JBD (ext3) debugging support

File Systems --->Psedo File Systems --->
[ * ] devfs support (OBSOLETE)
[ * ] Automatically mount at boot


   配置内核是大多数新手编译内核时最大的难点,只要将以上选项编译进内核,成功的机会是大大的。
   以上是本人这几天来的经验总结,相信对大多数人都有指导作用,不足之处还请高手们指点。

wlbookwl 发表于 2006-4-27 13:55:07


明白了,我按你的方法一步步去做了,编译成功了!!

但现在还有一个小问题,就是nvidia驱动用不了,进不了X-window ,改配置文件后可以进入了,但总是报错,说什么kde崩溃。错误。

还有就是不能上网,再一个听歌也没有声音, 还一个是mount挂载不了fat、ntfs分区。

启动时选择老版本内核2.4 启动,进入系统一切正常。只是没声音了。

请问怎么才能完全恢复老版本内核,有没有卸载新内核功能???

jane0000 发表于 2006-4-27 17:47:06

内核实在太复杂了,尽管能编译运行,但是还是有很多问题。需要不断的学习,我估计在Redhat下新内核的问题太多,还是旧的经过redhat自己优化的内核才是最好的。

wlbookwl 发表于 2006-4-27 17:55:51

请问怎么才能完全恢复老版本内核?

有办法吗? 现在出不了声音了。

skyeye.Zeus 发表于 2007-8-23 09:51:21

谢谢,写得挺不错,很细。
:lol: :lol: :lol: :lol: :lol: :lol:
页: [1]
查看完整版本: 虚拟机下redhat内核升级到2.6.16的成功经验