歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> 關於Unix >> linux 2.6.10內核升級手記

linux 2.6.10內核升級手記

日期:2017/3/6 15:25:28   编辑:關於Unix
年初寫的,今天有個同事也要編譯內核,滿世界找了一遍,結果在cu翻出來了^_^ 序言:首先感謝我的兩位同事,最近兩天給我的無私幫助,如果沒有他們,我也許不會有時間來做2。6。10的內核。當然也不會有此文。也希望這篇文章能給遇到相同問題的CU朋友帶來幫助

年初寫的,今天有個同事也要編譯內核,滿世界找了一遍,結果在cu翻出來了^_^

序言:首先感謝我的兩位同事,最近兩天給我的無私幫助,如果沒有他們,我也許不會有時間來做2。6。10的內核。當然也不會有此文。也希望這篇文章能給遇到相同問題的CU朋友帶來幫助。


一。現有的軟硬件情況。
1。硬件: hp760g2 8cpu 8g Ram hp smart array 5i +72g hddisk
*2 raid 1 nc7170 intel Ge
2。系統: linux7.2 內核已升級到2.4.20-28.7smp
二。升級步驟




1. 下載2.6.10源碼

2. 按照Documents/Changes升級必須的實用工具

2.1 binutils-2.13.90.0.2-2.i386.rpm

[root@cnus1 patch]# rpm -Uvh binutils-2.13.90.0.2-2.i386.rpm
Preparing... ########################################### [100%]
1:binutils ########################################### [100%]

2.2 cpq_cciss-2.4.50-18.rh72.i686.rpm

rpm -Uvh cpq_cciss-2.4.50-18.rh72.i686.rpm

2.3 dietlibc-0.21-4.i386.rpm

[root@cnus1 patch]# rpm -ivh dietlibc-0.21-4.i386.rpm
Preparing... ########################################### [100%]
1:dietlibc ########################################### [100%]

2.4 e2fsprogs-1.29.tar.gz

編譯參見INSTALL文件

2.5 lvm-1.0.3-4.i386.rpm ,本次系統安裝時沒有安裝,所以裝上

[root@cnus1 patch]# rpm -ivh lvm-1.0.3-4.i386.rpm
Preparing... ########################################### [100%]
1:lvm ########################################### [100%]

2.6 rpm -ivh mkinitrd-3.5.14-1.src.rpm
mkinitrd-3.5.14-1.src.rpm 源代碼編譯安裝升級
a. rpm -ivh mkinitrd-3.5.14-1.src.rpm
1:mkinitrd ########################################### [100%]
b. rpmbuild -bb /usr/src/redhat/SPECS/mkinitrd.spec
c. [root@cnus1 patch]# rpm -Uvh /usr/src/redhat/RPMS/i386/mkinitrd-3.5.14-1.i386.rpm
Preparing... ########################################### [100%]
1:mkinitrd ########################################### [100%]

2.7 module-init-tools-0.9.10.tar.gz

一定按照README的要求進行編譯升級

2.8 nfs-utils-1.0.6-1.src.rpm

a. [root@cnus1 patch]# rpm -ivh nfs-utils-1.0.6-1.src.rpm
1:nfs-utils ########################################### [100%]
b. rpmbuild -bb /usr/src/redhat/SPECS/nfs-utils.spec
c. [root@cnus1 patch]# rpm -Uvh /usr/src/redhat/RPMS/i386/nfs-utils-1.0.6-1.i386.rpm
Preparing... ########################################### [100%]
1:nfs-utils ########################################### [100%]
2.9 procps-3.2.0.tar.gz

按照README編譯升級

2.10 quota-3.09-1.src.rpm

a. [root@cnus1 patch]# rpm -ivh quota-3.09-1.src.rpm
1:quota ########################################### [100%]
b. rpmbuild -bb /usr/src/redhat/SPECS/quota.spec
c. [root@cnus1 patch]# rpm -Uvh /usr/src/redhat/RPMS/i386/quota-3.09-1.i386.rpm
Preparing... ########################################### [100%]
1:quota ########################################### [100%]
3. 配置內核選項

make menuconfig

1. 配置Loadable module support --->
[*] Enable loadable module support x x
x x [*] Module unloading x x
x x [*] Forced module unloading x x
x x [*] Module versioning support (EXPERIMENTAL) x x
x x [*] Source checksum for all modules x x
x x [*] Automatic kernel module loading

2. 配置Processor type and features --->

Subarchitecture Type (PC-compatible) ---> x x
x x Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon) ---> x x
x x [ ] Generic x86 support (NEW) x x
x x [ ] HPET Timer Support (NEW) x x
x x [*] Symmetric multi-processing support x x
x x (32) Maximum number of CPUs (2-255) x x
x x [*] SMT (Hyperthreading) scheduler support x x
x x [*] Preemptible Kernel x x
x x [*] Machine Check Exception x x
x x Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4 x x
x x [*] check for P4 thermal throttling interrupt. x x
x x < > Toshiba Laptop support x x
x x < > Dell laptop support x x
x x /dev/cpu/microcode - Intel IA32 CPU microcode support x x
x x /dev/cpu/*/msr - Model-specific register support x x
x x /dev/cpu/*/cpuid - CPU information support x x
x x Firmware Drivers ---> x x
x x High Memory Support (64GB) ---> x x
x x [ ] Allocate 3rd-level pagetables from highmem (NEW) x x
x x [ ] Math emulation x x
x x [*] MTRR (Memory Type Range Register) support x x
x x [*] Enable kernel irq balancing (NEW) x x
x x [ ] Use register arguments (EXPERIMENTAL) (NEW) x x
x x

3. Block devices --->

x

x x <*> Normal floppy disk support x x
x x XT hard disk support x x
x x Parallel port IDE device support x x
x x --- Parallel IDE high-level drivers x x
x x Parallel port IDE disks x x
x x Parallel port ATAPI CD-ROMs x x
x x Parallel port ATAPI disks x x
x x Parallel port ATAPI tapes x x
x x Parallel port generic ATAPI devices x x
x x --- Parallel IDE protocol modules x x
x x ATEN EH-100 protocol x x
x x MicroSolutions backpack (Series 5) protocol x x
x x MicroSolutions backpack (Series 6) protocol x x
x x DataStor Commuter protocol x x
x x DataStor EP-2000 protocol x x
x x FIT TD-2000 protocol x x
x x FIT TD-3000 protocol x x
x x Shuttle EPAT/EPEZ protocol x x
x x [*] Support c7/c8 chips (EXPERIMENTAL) x x
x x Shuttle EPIA protocol x x
x x Freecom IQ ASIC-2 protocol x x
x x FreeCom power protocol x x
x x KingByte KBIC-951A/971A protocols x x
x x KT PHd protocol x x
x x OnSpec 90c20 protocol x x
x x OnSpec 90c26 protocol x x
x x Compaq SMART2 support x x
x x Compaq Smart Array 5xxx support x x
x x [*] SCSI tape drive support for Smart Array 5xxx x x
x x Mylex DAC960/DAC1100 PCI RAID Controller support x x
x x Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL) x x
x x Loopback device support x x
x x < > Cryptoloop Support (NEW) x x
x x Network block device support x x
x x < > Promise SATA SX8 support (NEW) x x
x x < > Low Performance USB Block driver (NEW) x x
x x <*> RAM disk support x x
x x (16) Default number of RAM disks (NEW) x x
x x (4096) Default RAM disk size (kbytes) x x
x x [*] Initial RAM disk (initrd) support x x
x x () Source directory of cpio_list (NEW) x x
x x [ ] Support for Large Block Devices (NEW) x x
x x < > Packet writing on CD/DVD media (NEW) x x
x x IO Schedulers --->

4. File systems --->

<*> Second extended fs support x x
x x [ ] Ext2 extended attributes (NEW) x x
x x Ext3 journalling file system support x x
x x [*] Ext3 extended attributes x x
x x [*] Ext3 POSIX Access Control Lists x x
x x [ ] Ext3 Security Labels (NEW) x x
x x [ ] JBD (ext3) debugging support x x
x x Reiserfs support x x
x x [ ] Enable reiserfs debug mode x x
x x [*] Stats in /proc/fs/reiserfs x x
x x [ ] ReiserFS extended attributes (NEW) x x
x x JFS filesystem support x x
x x [ ] JFS POSIX Access Control Lists (NEW) x x
x x [ ] JFS debugging x x
x x [ ] JFS statistics x x
x x < > XFS filesystem support (NEW) x x
x x Minix fs support x x
x x ROM file system support x x
x x [*] Quota support x x
x x < > Old quota format support x x
x x <*> Quota format v2 support x x
x x Kernel automounter support x x
x x Kernel automounter version 4 support (also supports v3) x x
x x CD-ROM/DVD Filesystems ---> x x
x x DOS/FAT/NT Filesystems ---> x x
x x Pseudo filesystems ---> x x
x x Miscellaneous filesystems ---> x x
x x Network File Systems ---> x x
x x Partition Types --->

5. 其他都是默認設置,保存配置。
6. make;make modules_install;make install
7. 重新以新的內核重新啟動即可。


三。需要注意的地方,或者疑難解答。

1. mkinitrd

make install 會自動調用mkinitrd 來生成initrd-.img文件,如果第一次編譯內核的沒有正常啟動的話,以後每次執行
make install後,一定要手動執行mkinitrd -f -v /boot/initrd-.img ,來重新生成initrd.img文件。-f是強
制生成並覆蓋已有的initrd.img文件;-v是詳細輸出。

2. modules.conf

modules.conf 文件包含的模塊在執行mkinitrd -f -v /boot/initrd-.img 時,會搜索/etc/modules.conf文件,
並按照該文件中的條目從/lib/modules//尋找相應的modules(也就是.o或者.ko文件),如果找不到就會報:No xxx module
not found的錯誤。

有2個方法避免這個錯誤,一是把modules.conf裡面的模塊全部編譯成module,另一種方法是在modules.conf刪除相應的module條目,
前提是已經把這個module編譯進內核了。

3。關於mount: xx error的錯誤的說明,xx 為數字,曾經遇到過 3,6 ,22 。因為找不到這些錯誤數字的具體含義,所以下面的結論都是根據我的經驗推斷出來的,僅供大家參考。
新內核啟動的時候出現這類錯誤,一般都是因為不能mount ext3 類型的 root filesystem。網上很多資料都說要把ext3 filesystem編譯進內核,按照我的經驗,編譯成動態加載的module也是可行,我的理論依據來自red hat,君不見它的7.2 ,9.0,as3等版本裡面lsmod 都會發現
ext3 132868 8
jbd 64244 1 ext3
這說明ext3的支持是可以動態加載的,既然redhat能做到了,我們應該也能吧。這次編譯後系統的lsmod結果如下:[root@enuss2 linux-2.6.10]# lsmod
Module Size Used by
autofs 20444 0
e1000 90844 0
parport_pc 31652 0
parport 40096 1 parport_pc
usbcore 121320 0
ext3 132868 8
jbd 64244 1 ext3
cciss 48900 10
sd_mod 20796 0
scsi_mod 130744 2 cciss,sd_mod
[root@enuss2 linux-2.6.10]# uname -a
Linux XXXX 2.6.10 #8 SMP Tue Jan 11 16:00:41 CST 2005 i686 unknown


Copyright © Linux教程網 All Rights Reserved