虛擬機下redhat內核升級到2.6.16的成功經驗

虛擬機下redhat內核升級到2.6.16的成功經驗

弄了好幾天,終於成功編譯了Linux的新內核,相信很多人在編譯內核時,也會遇到和我類似的問題,現我就將我的成功步驟和大家共享,這些內容是綜合了很多關於在虛擬機下編譯內核的帖子:

1、首先必須對一些相關軟件進行升級。
1。1  device-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


     配置內核是大多數新手編譯內核時最大的難點,只要將以上選項編譯進內核,成功的機會是大大的。
   以上是本人這幾天來的經驗總結,相信對大多數人都有指導作用,不足之處還請高手們指點。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章