CentOS 6.x kernel Upgrade tutorial

Source: Internet
Author: User

CentOS 6.x kernel Upgrade tutorial

I want to run docker on CentOS6.2. The official kernel version is 3.8.0 or later, so I downloaded the source code from the Linux kernel official website and compiled it myself.

1. Prepare for checking the kernel and version information
Select All copies and put them into Notes [root @ hostname ~] # Uname-r2.6.32-220.el6.x86_64 [root @ hostname ~] # Cat/etc/centos-releaseCentOSrelease6.2 (Final)
Install software

Compile and install the new kernel, depending on the development environment and development library

Select All copies and put them in your note # yumgrouplist // check the installed and uninstalled Software Package groups to determine whether the corresponding development environment and development library are installed; # yumgroupinstall "DevelopmentTools" // generally, these two software packages are installed, this will determine that you have all the tools required for compilation # yuminstallncurses-devel // You must so that the make * config command can be correctly executed # yuminstallqt-devel // if you do not X environment, this one does not need # yuminstallhmaccalczlib-develbinutils-develelfutils-libelf-devel // they are needed when creating the CentOS-6 Kernel

If the Software workstation is selected, almost all the installation packages above are included.

2. Compile the kernel to obtain and decompress the kernel source code and configure the compilation items.

Go to the http://www.kernel.org home page, you can see stable, longterm and other versions, longterm is a more stable version than stable, will be updated for a long time, so I choose 3.10.58.

Select All copies and put them into Notes [root @ sean ~] #Tar-xflinux-3.10.58.tar. xz-C/usr/src/[root @ sean ~] # Cd/usr/src/linux-3.10.58/[root@seanlinux-3.10.58] # cp/boot/config-2.6.32-220.el6.x86_64.config

We create a new compilation option based on the original Kernel configuration file of the system, so copy it to the current directory and name it. config. Continue with the Configuration:

Select All copy into Notes [root@seanlinux-3.10.58] # sh-c 'yes "" | makeoldconfig 'hostccscripts/basic/fixdepHOSTCCscripts/kconfig/conf. oSHIPPEDscripts/kconfig/zconf. tab. cSHIPPEDscripts/kconfig/zconf. lex. cSHIPPEDscripts/kconfig/zconf. hash. cHOSTCCscripts/kconfig/zconf. tab. oHOSTLDscripts/kconfig/confscripts/kconfig/conf -- oldconfigKconfig. config: 555: warning: symbolvalue 'M' invalidforPCCARD _ NONSTATIC. config: 2567: warning: symbolva Lue 'M' invalidforMFD _ WM8400.config: 2568: warning: symbolvalue 'M' invalidforMFD _ WM831X. config: 2569: warning: symbolvalue 'M' invalidforMFD _ WM8350.config: 2582: warning: symbolvalue 'M' invalidforMFD _ usage: 2584: warning: symbolvalue 'M' invalidforAB3100 _ CORE. config: 3502: warning: symbolvalue 'M' invalidforMMC _ RICOH_MMC ** Restartconfig... * ** Generalsetup *...... XZdecompressortester (XZ_DEC_TEST) [N/m/y/?] (NEW) Averagingfunctions (AVERAGE) [Y/?] (NEW) yCORDICalgorithm (CORDIC) [N/m/y/?] (NEW) JEDECDDRdata (DDR) [N/y/?] (NEW) # configurationwrittento. config #

Make oldconfig reads the. config file in the current directory. If no options are found in the. config file, the system prompts the user to fill in. Some documents introduce the use of make memuconfig, Which is customized as needed, similar to the following interface: (we do not need)

Make oldconfig will be backed up as. config. old before new. config is generated, and a new. config file will be generated.

Start Compilation
Select All copy into Notes [root@seanlinux-3.10.58] # make-j4bzImage // generate Kernel File [root@seanlinux-3.10.58] # make-j4modules // compile module [root@seanlinux-3.10.58] # make-j4modules_install // compile installation Module

-The number after j is the number of threads used to speed up compilation. Generally, the logic CPU is used to enter that number. For example, if there is 8 cores, it is-j8. (The module takes more than 30 minutes)

Install

[Root@seanlinux-3.10.58] # make install
When this step is actually executedERROR: modinfo: could not find module vmware_balloonBut does not affect kernel installation. Because the modules required by vsphere are not compiled, to avoid this problem, you need to modify the. config file before make and add
HYPERVISOR_GUEST = y
CONFIG_VMWARE_BALLOON = m
(This part is prone to problems. Refer to the exception section below)

Modify grub boot and restart

After the installation is complete, you need to modify the Grub boot sequence and use the newly installed kernel as the default kernel.
Edit the grub. conf file,

Select All and copy them to the Notes vi/etc/grub. conf # boot =/dev/sdadefault = 0 timeout = 5 splashimage = (hd0, 0)/grub/splash.xpm.gz hiddenmenutitleCentOS (3.10.58) root (hd0, 0 )...

Count the position of the newly installed kernel, starting from 0, and then set default to the number. Generally, the newly installed kernel is in the first position, so set default to 0.
Restartreboot:

Confirm the current kernel version
Select All copies and put them into Notes [root @ sean ~] # Uname-r3.10.58

Kernel upgraded!

3. Abnormal compilation failed (for example, the dependency package is missing)

You can clear it first and then re-compile it:

Select All copies and put them into your notes # makemrproper # If the installation process is completed or an error occurs, you can clear the last compiled site # makeclean
Compile on the vmwarevm and the following error occurs:
Select All copy into Notes [root@seanlinux-3.10.58] # makeinstallsh/usr/src/linux-3.10.58/arch/x86/boot/install. sh3.10.58arch/x86/boot/bzImage \ System. map "/boot" ERROR: modinfo: couldnotfindmodulevmware_balloon

You can ignore it. If you have obsessive-compulsive disorder, try the following methods:
To install VMWARE_BALLOON on vmware, you can directly modify the. config file.CONFIG_VMWARE_BALLOON=mStill ineffective, because it depends onHYPERVISOR_GUEST=y. If you do not know the dependencymake menuconfigAfter Device Drivers-> MISC devices, the VMware Balloon Driver cannot be found. (Manually modify HYPERVISOR_GUEST in vi. config, you can find this item). In addition, whether it is through make menuconfig or directly vi. config, runsh -c 'yes "" | make oldconfig'Get the final compilation configuration option at a time.
Then, considering that vmware_balloon may have changed its name to vmw_balloon in this version, use the following methods to ensure the safety:

Select All copy put into notes # cd/lib/modules/3.10.58/kernel/drivers/misc/# ln-svmw_balloon.kovmware_balloon.ko # establish soft connection

In fact, the best choice for installing the docker Kernel Compiling environment is to use sciurus to help us configure the. config file.
We recommend that youmake bzImagePreviously, run the script check-config.sh to check the module missing for the current kernel running docker.
If you are prompted that other modules are missing, such as NF_NAT_IPV4, you can also solve the problem by using the above method and re-compile it.

5. TO-DO
  • How to clear the original Kernel

  • Whether yum update is required for existing software

6. References
  • CentOS 6.5 upgrade kernel to 3.10.28

  • Linux Kernel configuration

Original article link: http://seanlook.com/2014/10/24/upgrade-centos6_kernel-to-3.10.x/

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.