linux 2.6.10内核升级手记

发表于:2007-07-04来源:作者:点击数: 标签:
年初写的,今天有个同事也要编译内核,满世界找了一遍,结果在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


原文转自:http://www.ltesting.net