This article applies to CentOS 6.5, which is feasible and estimated to be applicable to other Linux distributions. 1. Prepare for work 1.1 download Source Package
There are two versions of the Linux kernel: stable and development, and the Linux kernel version number consists of 3 digits: r.x.y
R: Major Version number
X: Minor version number, even for stable version, odd to represent development version.
Y: Revision number, indicating the number of changes
To http://www.kernel.org home page, you can see stable, longterm and other versions, longterm is more stable than the stable version, a long time to update, so I choose 3.10.28,
wget Https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.28.tar.xz
1.2 Decompression
TAR-XF LINUX-3.10.28.TAR.XZ
1.3 Update the current system
sudo yum update
sudo yum upgrade
1.4 Package required to install the build kernel
sudo yum groupinstall "Development Tools" # at one breath install all the tools required at compile time
sudo yum install ncurses-devel #必须这样才能让 make *config this directive is Be carried out with certainty.
sudo yum install qt-devel #如果你没有 X Environment, this one can be used without
sudo yum install hmaccalc zlib-devel binutils-devel elfutils-libelf -devel #创建 CentOS-6 kernel needs them
2 configuration Files
2.1 View the current system kernel
Uname-r
2.6.32-358.11.1.el6.x86_64
2.2 Copy the current system's configuration file 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 oldconfig reads the. config file in the current directory, the option that is not found in the. config file prompts the user to fill it out, and then backs up the. config file to. config.old and generates a new. config file for reference http:// Stackoverflow.com/questions/4178526/what-does-make-oldconfig-do-exactly-linux-kernel-makefile 3 Compilation
sudo make-j8 bzimage #生成内核文件
sudo make-j8 modules #编译模块
sudo make-j8 modules_install #编译安装模块
To strictly follow this order to compile, can not be merged into a sentence, sudo make-j8 bzimage modules Modules_install.
-J number is the number of threads, used to speed up the compilation speed, the general experience is how much g memory, fill in that number, such as 8G memory, then-j8. 4 Installation
sudo make install
If there is a ERROR:modinfo:could not find module XXX, the number is negligible and can be ignored. 5 Modify Grub Boot order
After the installation is complete, you need to modify the grub boot sequence so that the newly installed kernel is the default kernel.
Edit the grub.conf file,
sudo vim/etc/grub.conf
Count the location of the newly installed kernel, start at 0, and then set default to that number, and generally the newly installed kernel is in the first position, so set default=0. 6 reboot
sudo reboot
After restarting, look at the current kernel version number,
Uname-r
3.10.28
Success. 7 If it fails, cycle again
If you fail to start again, clean up the last compiled scene
Then go to step 2nd and start again.