Linux Kernel Upgrade tutorial

Source: Internet
Author: User

A linux kernel upgrade record with some knowledge related to the IPVS kernel module and linux Startup sequence for future reference

OS information before Upgrade

# Lsb_release-
LSB Version: core-3.1-amd64: core-3.1-ia32: core-3.1-noarch: graphics-3.1-amd64: graphics-3.1-ia32: graphics-3.1-noarch:
Distributor ID: CentOS
Description: CentOS release 5.5 (Final)
Release: 5.5
Codename: Final
# Uname-r
2.6.18-194. el5
#



Upgrade procedure

The latest kernel. In this example, wget to/usr/src directly.
Http://www.kernel.org/

General installation steps, or check the "readme" in the directory to find the installation method.

Cd/usr/src
Wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.tar.bz2
Tar-jxvf linux-2.6.37.tar.bz2
Ln-s/usr/src/linux-2.6.37/usr/src/linux
Cd linux
Make clean
Cp/boot/config-2.6.18-194.32.1.el5. config
Make menuconfig
Make bzImage
Make modules
Make modules_install
Make install
#


Command Comprehension
Make menuconfig \ kernel customization (The. config file will be modified)
Make bzImage \ generate the kernel image file in/usr/src/linux/arch/xxx/boot/bzImage
Make modules \ compilation Module
Make modules_install \ installation module,/lib/modules/x Directory/additional module
Make install \ install new kernel to/boot/
Mkinitrd/boot/initrd-2.6.23.14.img 2.6.23.14 \ mkinitrd creates an image file for Linux to load ramdisk upon startup

In the above steps, I encountered two problems after the compilation is restarted.

Question 1

MOUNT: count not find filesystem '/dev/root'


The solution is as follows:

Question 2

Insmod: error inserting '/lib/dm-region-hash.ko:-1 file exists'


The solution is from the network.

1. decompress the initrd File
# Cp/boot/initrd-2.6.37.img/tmp/
# Cd/tmp/
# Mkdir newinitrd
# Cd newinitrd/
# Zcat ../initrd-2.6.37.img | cpio-I

2. Edit init and delete the two rows in the four repeated rows.
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
3. Repackage initrd
# Find. | cpio-c-o> ../initrd
# Cd ..
# Gzip-9 <initrd> initrd. img
OK, initrd. img is the re-packaged initrd, and then copy initrd. img to/boot, change the initrd-2.6.37.img in grub. conf to initrd. img.


Attached, The IPVS module's Boot Loading Method (from the Network)

I. First, let's take a look at http://linux.vbird.org/#start the machine process and loader ":
The entire boot process is
(1) load the BIOS hardware information and obtain the code of the first boot device
(2) read the boot information of the boot Loader (grub) of the mbr of the first boot device.
(3) load the OS Kernel information, decompress the Kernel, and try to drive the hardware.
(4) The Kernel executes the init program and obtains the run-lebel information (such as 3 or 5)
(5) run/etc/rc. d/rc. sysinit in init.
(6) Start the kernel plug-in Module (/etc/modprobe. conf)
(7) init executes various run-level Scripts and starts the service
(8) run/etc/rc. d/rc. local in init.
(9) run/bin/login and wait for the user Login
(10) log in to Shell

2. Follow the Loading Method of other modules in rc. sysinit to expand the script file and add the following section at the end:

             
             
  1. # load LVS IPVS modules

  2. if [ -d /lib/modules/2.6.18-194.el5/kernel/net/ipv4/ipvs ]; then

  3. for module in /lib/modules/2.6.18-194.el5/kernel/net/ipv4/ipvs/* ; do

  4. module=${module##*/}

  5. module=${module%.ko}

  6. modprobe $module >/dev/null 2>&1

  7. done

  8. fi

Restart and view


# Lsmod | grep ip_vs
Ip_vs_wrr 35905 0
Ip_vs_wlc 34881 1
Ip_vs_sh 35649 0
Ip_vs_sed 34881 0
Ip_vs_rr 35009 0
Ip_vs_nq 34881 0
Ip_vs_lc 34881 0
Ip_vs_lblcr 40136 0
Ip_vs_lblc 39241 0
Ip_vs_ftp 39109 0
Ip_vs_dh 35649 0
Ip_vs 122113 23 ip_vs_wrr, ip_vs_wlc, ip_vs_sh, ip_vs_sed, ip_vs_rr, ip_vs_nq, ip_vs_lc, scheme, scheme, ip_vs_ftp, ip_vs_dh


If statement to check whether the directory of ipvs module exists
The for loop traverses all files in the directory.
Module =$ {module ### */}: where # indicates to delete the character from the front, */indicates to delete the character to the last /, if one # is used, only the first/is deleted /. If the variable is followed by #, the string after # gets the longest (until the end). If the variable is followed by #, the smallest segment is obtained.
Module =$ {module %. ko}: indicates to delete. ko from the backend. If the variable is followed by %, the string after % gets the longest (until the beginning). If % is followed, the smallest segment is obtained.
In this way, the module name is obtained after two modifications of multiple modules, that is, the file name does not contain the path or. ko suffix.
Modprobe $ module>/dev/null 2> & 1: load the module. The output points to an empty device.

This article from the "simple, concise" blog, please be sure to keep this source http://dadaru.blog.51cto.com/218979/499629


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.