This version is CentOS5.5, and its original kernel version is 2.6.18-194. el5 is upgraded to 2.6.39.4. The Kernel used in this experiment is the last version of Series 2 downloaded from the official website [root @ localhost ~] # Yuminstallncurses-develncurses
The version used this time is CentOS 5.5, and the original kernel version is 2.6.18-194. The version to be upgraded to el5 is 2.6.39.4.
The kernel used in this experiment is the last version of Series 2 downloaded from the official website.
[Root @ localhost ~] # Yum installNcUrses-devel ncurses (install the kit required for the Panel for the next make menuconfig)
[Root @ localhost ~] #Cd/Usr/src/kerneLs/
[Root @ localhost kernels] # ll linux-2.6.39.4.tar.bz2 (new kernel source package)
-Rw-r -- 1 root 76097195 Oct 22 2011 linux-2.6.39.4.tar.bz2
[Root @ localhost kernels] # tar jxvf linux-2.6.39.4.tar.bz2
[Root @ localhost linux-2.6.39.4] # make mrproper (clear old target file and configuration)
[Root @ localhost linux-2.6.39.4] # make menuconfig (configure kernel options based on your system needs)
[Root @ localhost linux-2.6.39.4] # vi. config (find the line with the annotation, add the following sentence, pay attention to the version)
# CONFIG_SCHED_AUTOGROUP is notSet
CONFIG_SYSFS_DEPRECATED = y
Set the red font in the previous step to cope with the following problems during reboot:
Mount: cocould notFind FileSystem '/dev/root'
SetupRoot: moving/dev failEd: NoSuCh file or directory
Setuproot: error mounting/proc: No such file or directory
Setuproot: error mounting/sys: No such file or directory
Switchroot: mount failed: No such file or directory
Kernel panic-notSyncIng: AttemptedKillInit!
PId: 1. comm: init Not tainted 2.6.39.4 #1
[Root @ localhost linux-2.6.39.4] # make (compile the kernel)
[Root @ localhost linux-2.6.39.4] # make moDuLes (compile the kernel module)
[Root @ localhost linux-2.6.39.4] # make modules_install (install kernel module)
[Root @ localhost linux-2.6.39.4] # make install (install new kernel)
The following blue font settings are used to cope with the following two problems during reboot:
Insmod: Error inserting '/lib/dm-region-hash.ko':-1 FileExIsts
Insmod: error inserting '/lib/dm-mirror.ko':-1 Unknow symbol in module
Then modify the iniTrD-2.6.39.4.img (this part of the content is to pick up people, so do not make essential changes)
[Root @ localhost ~] # Mdkir-p/tmp/newinitrd
[Root @ localhost tmp] #Cp/Boot/initrd-2.6.39.4.img.
[Root @ localhost tmp] # cd newinitrd/
[Root @ localhost newinitrd] # zCat../Initrd-2.6.39.4.img |Cpio-I
[Root @ localhost newinitrd] # vi init (delete two rows in the four repeated rows and two rows with the keyword "mirror)
Echo "Loading dm-region-hash.ko module"
Insmod/lib/dm-region-hash.ko
Echo "Loading dm-region-hash.ko module"
Insmod/lib/dm-region-hash.ko
[Root @ vhost newinitrd] # find. | cpio-c-o> ../initrd (repackage initrd)
11282 blocks
[Root @ vhost newinitrd] # cd ..
[Root @ vhost tmp] # gZip-9 <initrd> initrd. img
[Root @ localhost tmp] # ll initrd. img (at this time, initrd. img is brand new)
-Rw ------- 1 root 3366619 Oct 16 00:44 initrd. img
The next step is to overwrite the initrd under boot.
[Root @ localhost tmp] #Mv/Boot/initrd-2.6.39.4.img/boot/initrd-2.6.39.4.img.bak (back up to prevent unexpected issues)
[Root @ localhost tmp] # cp initrd. img/boot/initrd-2.6.39.4.img.
The last step is to modify the startup settings.
[Root @ localhost ~] # Vi/boot/grub/menu. lst (set the default startup to the new kernel)
# 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/sda
Default = 0
TimeOut = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
HiDdEnmenu
Title CentOS (2.6.39.4)
Root (hd0, 0)
Kernel/vmlinuz-2.6.39.4 ro root =/dev/VolGroup00/LogVol00 rhgb quiet
Initrd/initrd-2.6.39.4.img
Title CentOS (2.6.18-194. el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-194.el5 ro root =/dev/VolGroup00/LogVol00 rhgb quiet
Initrd/initrd-2.6.18-194.el5.img
Last
[Root @ localhost ~] # Reboot)
Summary:
I have been in touch with Linux for a long time. After having some knowledge of the system, I decided to compile the Linux kernel for the first time today. After all, kernel compilation is a required course for network administrators. Of course, there are some minor problems in the middle, google solved the problem successfully and upgraded the kernel!