Linux kernel compilation is a simple but cumbersome thing. But a standalone build Linux kernel will help you understand the Linux kernel's working mechanism well.
First compile the Linux kernel we need to install the GCC compiler under the current Linux operating system because I am centos distribution version
Yum Install GCC
Next Install dependent environment:
Yum Install Ncurses-devel
Now we compile with the linux-3.18.1 kernel as an example, assuming that my current system version is 2.6.32
Then I first download the corresponding kernel version on the official web http:/kernel.org Linux kernel
Then put it in the/usr/src folder and unzip it.
1; command make Menuconfig
Using the menu item configuration kernel, some modules can be directly compiled into the kernel of the module can be directly compiled into a module,
2 Command make
Compiling the kernel
3.make Modules_install
Install kernel module
At this point, you can see the corresponding version of the kernel module in/lib/modules
4.make Install
Install the kernel, you can see the corresponding version of the system.map and corresponding kernel files in the/boot file
5. Now we look at the vim/grub/grub.conf
See if the title item has the kernel version number we just compiled
By the time we restart the system we will see a newly compiled kernel version appearing in the boot entry.