Environment:
CentOS-6.9
Pre-compilation Preparation work:
(1) Prepare the development environment.
~]# Yum Groupinstall Server Platform Development development Tools #安装所需要的软件包组
(2) Get information about hardware devices on the target host
~]# Cat/proc/cpuinfo #CPU
~]# X86info-a
~]# LSCPU
~]# Lsusb #USB设备
~]# Lspci #PCI设备
~]# lsblk #块设备相关信息
~]# Hal-device #获取当前系统所有的硬件设备信息
(3) Get information about the capabilities of the target host system, such as the file system to be enabled
(4) Get kernel source package htts://www.kernel.org
Linux-3.2.94.tar.xz
Compiling using existing templates, not manually writing config files
~]# tar-xflinux-3.2.94.tar.xz-c/usr/src #将内核文件解压值/usr/src Directory
~]# CD/USR/SRC
~]# ln-sv linux-2.6.39 Linux #创建连接文件, many applications find a directory called Linux in the/USR/SRC directory
~]# CD Linux
~]# cp/boot/config-$ (uname-r). config file in the/boot/directory is copied to the current directory and named. config #将
~]# make Menuconfig #选择所需的模块即可, compile into a module or compile into the kernel, select and then Exit and save
#make支持很多的方式, use make Help to view #
Now you need to modify the/boot/grub/grub.conf file to change default=1 to Default=0
~]# vim/boot/grub/grub.conf
~]# Make-j 4 #启动多线程进行编译
#因为是远程连接的, the compile kernel time is slightly longer, for the sake of insurance, we recommend using screen to open a virtual display #
~]# screen If you do not have this command, install Yum install-y screen
~]# Screen-ls #当连接断开之后重新连接上时可查看当前的屏幕在哪儿
~]# screen-r Number #恢复到当前屏幕
After the compilation is complete, you can install:
~]# make Modules_install #先安装模块
~]# make install #安装内核文件
Wait for the installation to complete, reboot the system, manually select the kernel to compile and install to start, feel the new kernel
At this point, a simple kernel compilation installation is complete
Linux kernel simple compilation installation process