how to compile and replace ubuntu kernel
0. environment
-ubuntu 1804 64bit
1. prepare source code
sudo apt-get install linux-source or wget https://git.kernel.org/torvalds/t/linux-4.17-rc2.tar.gz (replace to your version)
2. set up tools
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison
3. tar xvzf linux-4.17-rc2.tar.gz (replace to your version)
4. cp /boot/config-$(uname -r) .config
5. make menuconfig (can be ignored)
6. make modules_install
7. sudo make install
8. sudo mkinitramfs -o /boot/initrd.img-4.15.18
9. sudo update-initramfs -c -k 4.15.18 10. sudo update-grub2
11. result
reference
https://linux.cn/article-9665-1.html
https://blog.csdn.net/qq_36290650/article/details/83052315