1. Preparations 1.1 download the source code package
Go to the http://www.kernel.org home page, download the source package
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.11.6.tar.xz
1.2 decompress
tar xf linux-3.11.6.tar.xz
1.3 update the current system
sudo yum updatesudo yum upgrade
1.4 install necessary software
Sudo yum groupinstall "Development Tools" # install sudo yum install ncurses-devel #, all the Tools required during compilation in one breath, so that the command make * config can be correctly executed. Sudo yum install qt-devel # If you do not have an X environment, this one does not need sudo yum install hmaccalc zlib-devel binutils-devel elfutils-libelf-devel # They are needed when creating the CentOS-6 Kernel
2. Check the current system kernel in configuration file 2.1.
uname -r2.6.32-358.11.1.el6.x86_64
2.2 copy the configuration file of the current system to the current directory
cp /boot/config-2.6.32-358.11.1.el6.x86_64 .config
2.3 use the old Kernel configuration and automatically accept the default settings for each new option
sh -c 'yes "" | make oldconfig'
make oldconfigWill read.configFile, in.configIf the option is not found in the file, the system prompts the user to fill in and back up.configThe file is.config.oldAnd generate a new.configFile, reference http://stackoverflow.com/questions/4178526/what-does-make-oldconfig-do-exactly-linux-kernel-makefile
3 compile
Sudo make-j200 bzImage # generate the Kernel File sudo make-j200 modules # compile the module sudo make-j200 modules_install # compile and install the module
Compile in strict order
-jThe following number is the number of threads used to speed up compilation. The general experience is to fill in the number when there is a lot of memory. For example, if there is 8 GB memory, it is-j8.
4 installation
sudo make install
IfERROR: modinfo: could not find module xxxIf the number is small, ignore it.
5. Modify the Grub boot sequence
After the installation is complete, you need to modify the Grub boot sequence and use the newly installed kernel as the default kernel.
Editgrub.confFile,
sudo vim /etc/grub.conf
Count the position where the newly installed kernel is located, starting from 0, and then set default to that number. Generally, the newly installed kernel is in the first position, so setdefault=0.
6. Restart
After restarting, check the current kernel version number,
uname -r3.11.6
Success !!
7. If it fails, reloop
If it fails to start again, you need to clear the site of the last compilation.
Make mrproper # clean up the last compiled site
Go to step 2 and start again.