Download the Linux kernel https://www.kernel.org/on this website
After the download is complete, copy to the/USR/SRC directory and unzip
// Download the directory under the $ sudo cp linux*z/usr/src////USR/SRC directory under $ sudo tar xvjf linux*.xz
Copy the configuration file starting with config from the/boot directory to the/usr/src/linux* directory and rename it to. config
// /usr/src/linux* directory $ sudo cp/boot/config*. config
Enter the make Menuconfig command to start configuring the Compile kernel option
$ make Menuconfig
Load just copied the. config file, and then save
Go to > Kernel hacking > Compile-time checks and Compiler Options directory, will Compile the Kernel with debug Info option uncheck Cancel (press N) to do You can significantly reduce the size of the initrd.img file that is packaged behind it (too large to boot partition at all, so it's best to take this step)
Run the following commands sequentially
// start compiling $ make bzimage-jn // after adding-jn means that n processes compile at the same time, can also not write-jn, General n equals twice times the number of CPU cores // Compile module $ make modules-JN// Install module $ make Modules_install-JN// Install kernel $ make install
After the installation is complete, run the sudo update-grub command to update the startup item
linux-4.13.7 is my newly installed kernel, restart the default will start the latest kernel, you can use the uname-a command to view
If you want to replace the kernel, check the Ubuntu advanced options when rebooting
Linux compiled kernel