Linux Kernel is the core of the system, so upgrading the kernel is a basic skill of the Linux system administrator. So I shared an article on system O & M practices, of course, I have added some content to the source file, that is, I have added the problem and solution, and hope to help the Linux system administrators!
1. Download the kernel
Cd/usr/src
Wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.gz
Tar zxvf linux-2.6.38.tar.gz
Cd linux-2.6.38
2. Download the standard configuration file of the hotspot Kernel
Wget http://vbets.googlecode.com/files/config
Mv config. config
3. Compile the kernel
Make menuconfig
Select Load an Alternate Configuration File, and then select the. config File you just downloaded.
In addition, select:
1) Use make menuconfig to select the following options
General setup->
[*] Enable deprecated sysfs features to support old userspace tools
2) modify the. config file
Modify CONFIG_SYSFS_DEPRECATED_V2 in the. config file and comment out
Change CONFIG_SYSFS_DEPRECATED_V2 to CONFIG_SYSFS_DEPRECATED_V2 = y
Note: If the earlier version of mkinitrd and its nash does not have the CONFIG_SYSFS_DEPRECATED_V2 parameter in the kernel, the earlier version of sysfs path format is used by default, so that the hard disk information node in the/sys cannot be correctly accessed in the new kernel.
It mainly solves the "mount: cocould not find filesystem '/dev/root'" error.
Make bzImage
Make modules
Make modules_install
Make install
4. decompress and modify the kernel
Cp, boot, initrd-2.6.38.img, tmp
Cd/tmp/
Mkdir newinitrd
Cd newinitrd/
Zcat./initrd-2.6.38.img | cpio-I
Rm-rf/tmp/initrd-2.6.38.img
Vi init
If the two rows are the same, remove one row.
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
This mainly resolves errors like "insmod: error inserting '/lib/dm-region-hash.ko':-1 File exists"
5. Re-package the kernel
Find. | cpio-c-o> ../initrd
Cd ../
Gzip-9 <initrd> initrd-2.6.38img
Rm-rf/boot/initrd-2.6.38.img
Cpinitrd-2.6.38.img/boot
Rm-rf/cd/usr/src/linux-2.6.38.tar.gz
Rm-rf/cd/usr/src/linux-2.6.38
6. Set the new kernel to start
Vi/boot/grub. conf
Change default = 1 to default = 0
7. restart the system
Reboot