I. Compile the environment kernel: the original version (RedHatAS4.2) (Kernel 2.6.9-22). The target version is 2.6.18. All environments here are as4.2 and have not been upgraded. I also tried to upgrade gcc to 4.5 to kernel 2.6.33, but gcc4.5 was not successfully upgraded. Update to 2.6.182.1.download to www.kernel.orgto linux-2.6.18.tar.gz 2. cpli
I. compiling environment
Kernel: original version (RedHat AS4.2) (Kernel 2.6.9-22) target version: 2.6.18
All of my environments here are as4.2 versions without any upgrades. I also tried to upgrade gcc to 4.5 to kernel 2.6.33, but gcc4.5 was not successfully upgraded. I had to upgrade to 2.6.18 honestly.
Ii. compilation process
1. Download linux-2.6.18.tar.gz to www.kernel.org.
2. cp linux-2.6.18.tar.gz/usr/src // copy the downloaded kernel to the/usr/src directory
3. tar zvxf linux-2.6.18.tar.gz // unzip the file
4. cd linux-2.6.18 // to the directory of the file
5. ln-s linux-2.6.18 linux // establish a symbolic connection, do not do this, you can also, the purpose is to make the directory easier to remember, easy to spell
6. cd linux // to the directory of the file, that is, to the linux-2.6.18 directory
7. make mrproper // preparations before configuration. You can skip this command when you upgrade the kernel for the first time.
8. make menuconfig // can be changed. It can be changed by default, but it must be saved.
9. make
10. make modules_install // module Installation
11. make install // install
12. Set the 2.9.18 kernel startup to start by default.
The following is my Startup File: vi/boot/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/VolGroup00/LogVol00
# Initrd-version.img/initrd
# Boot =/dev/hda
Default = 0 // here the default value is 1. After the value is changed to 0, the 2.6.18 kernel can be used.
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux AS (2.6.18)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18 ro root =/dev/VolGroup00/LogVol00
Initrd/initrd-2.6.18.img
Title Red Hat Enterprise Linux AS (2.6.9-22.EL)
Root (hd0, 0)
Kernel/vmlinuz-2.6.9-22.EL ro root =/dev/VolGroup00/LogVol00
Initrd/initrd-2.6.9-22.EL.img
Then reboot.
OK !!
I have not encountered the following errors during installation. However, you can use it for reference.
Iv. kernel compilation errors and Solutions
Error 1:
Error message: Kernel panic-not syncing: vfs: unable to mount root fs on unkown-block (0, 0)
Error analysis: The initrd-*. *. imgfile has a problem. The real root file system cannot be mounted successfully.
Solution: Please confirm that you have executed the make install command. I wasted a week because I didn't execute this command (which will be detailed later)
Error 2:
Error message: Create root device
Mkrootdev: label/not found
Mounting root filesystem
Mount: error 2 mounting ext3
Mount: error 2 mounting none
Switchroot mount failed: 22
Umount/initrd/dev failed: 2
Kernel panic-not synicncing: Attempted to kill init.
(Is the error prompt a little long? It seems that there are many errors, which may be caused by one reason)
Error Analysis: 1. the mount point cannot be found in the root file system. Change the grub. conf file to root =/dev /*
2. Hard drive cannot be found. Please check whether your machine's hard drive is a SATA disk. If yes, congratulations! This article is helpful to you.
Solution:
1. Try to modify the grub. conf file. The specific modification point root =/dev/** indicates the mount point of/partition in the original system. After the modification, restart the system to enter the new kernel system. It is estimated that the following error will occur again:
Mounting root filesystem
Mount: error 6 mounting ext3
Mount: error 2 mounting none
Switchroot mount failed: 22
Umount/initrd/dev failed: 2
Kernel panic-not synicncing: Attempted to kill init.
If it's unfortunate to me, let's take a look.
2. The hard drive fails to be found, and the SCSI driver is faulty. I encountered this problem during kernel compilation and upgrade. I chose and selected the kernel options and tried many methods. The general manager did it several times in person and the error persists. In the end, I did not intend to select the correct option to successfully upgrade the kernel.
The specific options are: Device Drivers -------- SCSI device support ------ SCSI low-level drivers ---- Serial ATA (SATA) support, select M, and then select the corresponding sub-options, after I select Intel PIIX/ICH SATA support (new), the machine starts successfully.
Error 3:
Error message: Enforcing mode requested but no policy loaded. Halting now.
Kernel panic-not syncing: Attenpted to kill init!
Error Analysis: selinux is enabled in the original kernel. selinux is not selected in the new kernel and cannot be started successfully.
Solution: Modify the grub. conf file and add enforcing = 0 after root = LABEL = /.