Http://hi.baidu.com/vilight/blog/item/31f191d52288eb2406088be4.html
Redhat9 kernel upgrade (2.4.20-8 to 2.6.18)
Redhat9, whose kernel version is 2.4.20-8, can only be upgraded to 2.6.18 or 2.4.26, but cannot be directly upgraded to 2.6.3x, probably because the change is too big. An error occurs.
I personally think it is better to select an IDE hard disk when installing a VM...
Preparations
1. view the Linux kernel version
# Uname-
2. Download the 2.6 kernel source code and four kernel upgrade tools:
3, module-init-tools-3.2.tar.bz2 // note, it is best to use this version, with a higher, such as: 3.10, then make moveold is Will error.
Mkinitrd-4.1.18-2.i386.rpm
Lvm2-2.00.25-1.01.i386.rpm
Device-mapper-1.00.19-2.i386.rpm
Copy the downloaded kernel source code package and four upgrade tools to the/usr/src folder.
# Cd/usr/src (go to the/usr/src directory. If it is already in the/usr/src directory, do not execute this command)
# Rm-rf linux (delete the linux folder. It is worth mentioning that if the kernel has never been compiled before, there is no such folder, and this command line can be skipped)
# Tar jvxf linux-2.6.18.tar.bz2 (unzip new kernel)
# Ln-s linux-2.6.18 linux (regenerate linux folder)
Install module-init-Tools
In the/usr/src directory, execute the following commands in sequence:
# Tar jvxf module-init-tools-3.2.tar.bz2 (extract module-init-tools)
# Cd module-init-tools-3.2 (by the/usr/src directory to enter the module-init-tools directory)
#./Configure -- prefix =/
# Make moveold
# Make all install
#./Generate-modprobe.conf/etc/modprobe. conf
Install three other upgrade tools
Go back to the/usr/src directory and execute the following three commands to install the other three upgrade tools:
# Rpm-ivh -- nodeps mkinitrd-4.1.18-2.i386.rpm (note that -- nodeps parameters must be added here, the same below)
# Rpm-ivh -- nodeps lvm2-2.00.25-1.01.i386.rpm.
# Rpm-ivh -- nodeps device-mapper-1.00.19-2.i386.rpm.
Configure kernel options
# Cd linux-2.6.18 (to the/usr/src/linux-2.6.18 directory)
# Make mrproper (this command ensures that there is no incorrect. o file in the source code directory)
# Make menuconfig (Kernel configuration options)
9,You must select the following items:
(1) In the Loadable Module support option, select "Module unloading" and "Automatic kernel module loading;
(2) Device Drivers ---> select "Loopback device support" in Block Devices ";
Choose "Device mapper support" at device Drivers ---> Multi-device support (RAID and LVM ";
Device Drivers ---> Graphics support, be sure to select "Support for frame buffer devices ";
Device Drivers ---> USB support ---> select "USB Mass Storage support" (if you want more USB support in the real environment, select all. I am in a virtual machine. I don't need it anymore)
Device Drivers --->; Network device support ---> Ethernet (10 or 100 Mbit) ---> <*> AMD PCnet32 PCI support
(3) File system ---> (the following nine options are selected for the ext2 and ext3 File system configurations)
Second extended fs support
Ext2 extended attributes
Ext2 POSIX Access Control Lists
Ext2 Security Labels
Ext3 journalling file system support
Ext3 extended attributes
Ext3 POSIX Access Control Lists
Ext3 Security Labels
JBB (ext3) debugging support
File system ---> DOS/FAT/NT Filesystems ---> select "NTFS file system support ";
Note:
Ext2 and ext3 file system configurations are important and necessary. If you do not directly compile these files (*) into the kernel, the machine will be taken away during reboot and the following error message will appear:
Kernel panic: no init found, try passing init = option to kernel .....
Or:
VFS: Cannot open root device "hdxy" or unknow-block (0, 0)
Please append a correct "root =" boot option
Kernel panic: VFS: Unable to mount root fs on unknown-block (0, 0)
Or:
Mount: error 19 mounting ext3
Fail troot: effect_root (/sysroot,/sysroot/initrd) failed: 2
Umount/initrd/proc fail: 2
Freeing unused kernel memory: 244 k freed
Kernel panic-not syncing: No init found. Try passing init = option to kernel
(4) If you compile the kernel in vmware,The hard disk uses SCSI., The following three options are required:
Device Drivers ---> <*> SCSI device support (If this option is not selected, the following two options cannot be selected)
Device Drivers ---> <*> SCSI device support ---> <*> SCSI disk support
Device Drivers ---> <8> SCSI device support ---> SCSI low-level drivers ---> <M>; BusLogic SCSI support
Device Drivers ---> Fusion MPT device support --->
<M> Fusion MPT (base + ScsiHost) drivers
<M> Fusion MPT misc device (ioctl) driver (not sure)
3.1 Device Drivers-> Block devices->
<*> RAM disk support
(16) Default number xxxxx
(16384) the Default RAM disk size must be changed to 16384 or above.
[*] Initial RAM disk (initrd) Support
3.3 NIC Driver: Make sure to compile the driver corresponding to your Nic into the kernel. the commonly used Nic is RealTek 8139. The following figure shows the NIC configuration,
Device Drivers ---> networking support ---> Ethernet (10 or 100 Mbit) --->
<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 (Virtual Machine)
3.4 USB support
Device Drivers ---> USB support ---> <*> USB Mass Storage support
Device Drivers-> USB support-> USB hid Boot Protocol drivers->
[M] USB hidbp keyboard support
[M] USB hidbp mouse support
Required. Otherwise, USB mouse and USB keyboard are not supported.
3.5 CDROM support
Device Drivers --->
<*> ATA/atapi/MFM/rll support
<*> Intel piixn chipsets support
If this option is not selected, you cannot mount CDROM after the kernel is upgraded. (Depending on your CDROM type)
3.6 audio card driver sound card support, you also need to select the driver corresponding to your own sound card to compile into the kernel, the more common sound card is ac97, the following is the configuration of this sound card.
The key is to select the options in sound card support and advanced Linux sound architecture as modules (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/SIS/NVIDIA/AMD/Ali ac97 Controller
<*> (Creative) ensoniq audiopci 1371/1373 (Virtual Machine)
Open Sound system --->
<> Open Sound System (Deprecated)
You can select a new supported module, advanced Linux sound architecture. Do not select the old open sound system module.
3.7 File System
Make sure to select the ext3 file system,
File systems --->
[*] Ext3 Journalling File System Support
[*] Ext3 Security labels
[*] Jbd (ext3) debugging support
File systems ---> Except do file systems --->
[*] Devfs support (obsolete)
[*] Automatically mount at boot
In fact, as I often share files with Windows hosts, NTFS, vfat, and Samba systemfile are also selected in the file system to enable the kernel to support these file types. If not selected, you can add compilation in the new kernel. For details, see the end of the article.
Start Compilation
Under the/usr/src/linux-2.6.18 directory,
# Make Dep (create the dependent file required for compilation. Note: skip this step if the kernel has never been compiled)
# Make clean (clear the target file compiled by the kernel. Note: skip this step if the kernel has never been compiled)
# Make bzimage (case sensitive. This step truly compiles the kernel)
After the kernel is compiled, an image file bzImage of the new kernel is generated in the/usr/src/linux/arch/i386/boot directory. If you use make zImage to compile a large kernel, the system will prompt you to use the make bzImage command to compile it. Therefore, I will use make bzImage to compile it directly.
# Make modules)
# Make modules_install (installable module)
After the installation is successful, the system will generate a 2.6.18 subdirectory under the/lib/modules Directory, which stores all the loaded modules of the new kernel.
# Make install (new kernel installation)
Note:
The following error message may appear during make install:
No module BusLogic found for kernel 2.4.12
Mkinitrd failed
This problem occurs only in the SCSI hard drive + VMWARE + REDHAT architecture, because BusLogic is compiled into the kernel rather than a module (even if the Buslogic module of the 2.4 kernel is statically compiled into the kernel ). The solution is to copy the BusLogic. o file directly:
# Cp/usr/src/linux-2.6.18/drivers/scsi/BusLogic. o/lib/modules/2.6.18/kernel/drivers/scsi
But don't forget, run make install after the copy.
11. Start a new kernel
Copy the new kernel and System. map files to the/boot directory and execute the following commands in sequence:
# Cp/usr/src/linux-2.6.18/arch/i386/boot/bzImage/boot/vmlinuz-2.6.18
# Cp/usr/src/linux-2.6.18/System. map/boot/System. map-2.6.18
# Cd/boot (enter the boot directory)
# Rm-rf System. map (delete the original connection)
# Ln-s System. map-2.6.18 System. map (reconnect)
12. Modify the grub startup Manager
If there is no error, modify the grub configuration file (do not tell me the lilo you are using)
In the/boot directory, run the following command:
# New-kernel-pkg -- mkinitrd -- depmod -- install 2.6.18 (at this time, a initrd-2.4.18.img will be generated under your/boot, and your grub. conf file has been changed accordingly)
# Df (check the partition where the root directory is located and use it in the next step. Note that the root partition is the 50 m partition of boot from time to time, which is generally your largest partition, that is, "/". Do not make a mistake. My name is/dev/hda2)
# Vi/grub. conf
Go to the grub. conf file and find the following information:
Default = 1
Timeout = 10
Splashimage = (hd0, 0)/GRUB/splash.xpm.gz
Title Red Hat Linux (2.6.1
Root (hd0, 0)
Kernel/vmlinuz-2.6.18 Ro root = label =/
Initrd/initrd-2.6.18.img
Make two changes:
(1) Change "default = 1" to "default = 0" (if you do not change it, you can also change it, but the system will enter the 2.4 kernel by default after restart)
(2) Replace "label =/" of the kernel row with the partition of the root directory (as shown in the previous step)
This step is very important. The modification error may cause the system to be inaccessible. I will list the modified grub. conf file. If it is not clear, you can modify it as follows:
Default = 0
Timeout = 10
Splashimage = (hd0, 0)/GRUB/splash.xpm.gz
Title Red Hat Linux (2.6.1
Root (hd0, 0)
Kernel/vmlinuz-2.6.18 Ro root =/dev/hda2
Initrd/initrd-2.6.18.img
Title Red Hat Linux (2.4.20-
Root (hd0, 0)
Kernel/vmlinuz-2.4.20-8 ro root = LABEL =/
Initrd/initrd-2.4.20-8.img
Okay!
**************************************** ******
Possible problems and countermeasures when using the new kernel
**************************************** ******
1. The RedHat user rpm command cannot be used. Solution: declare the variable in the global configuration file.
This is a Bug in RPM. Especially for RH9 users, open the/etc/profile file and run the following command:
# Vi/etc/profile (Add the following sentence at the end of the file)
If ['uname-R' = "2.6.0"]; then
Export LD_ASSUME_KERNEL = 2.2.5
Fi
That is, add a global environment variable to the system, or directly type # export LD_ASSUME_KERNEL = 2.2.5.
2. The new kernel cannot be started at all. Solution: reconfigure the kernel (learning a lot). Maybe it is related to the root Boot Record (rarely );
3. the new kernel module cannot be loaded, which may cause many problems. For example, the firewall cannot work, and the disk cannot be mounted, the vfat and NTFS file systems. The solution is to upgrade the module-init-Tools Package,
The RedHat user may need to modify the/etc/rc. d/rc. sysinit file;