Compile your own kernel and install

I have updated my Ubuntu kernel from 5.0.* -> 5.6.13 This note is a backup of How to compile and install Linux Kernel 5.6.9 from source code. Environment: Ubuntu 18.04 Kernel: 5.0.*

Step 0. Install the required compilers and tools

$ sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev

Step 1. Get source code from kernel.org

$ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.13.tar.xz

Step 2. Extract tar.xz file

$ unxz -v linux-5.6.13.tar.xz

Step 3. Verify signature

$ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.13.tar.sign
$ gpg --verify linux-5.6.13.tar.sign 

output: using RSA key 7@%^*#^%^*

$ gpg --recv-keys 7@%^*#^%^*
$ gpg --verify linux-5.6.13.tar.sign 

Step 4. Configure the Linux kernel features and modules

$ cd linux-5.6.13
$ cp -v /boot/config-$(uname -r) .config
make menuconfig

Step 5. Compile

$ make -j4

Step 6. Install kernel modules

$ sudo make modules_install 

Step 7. Install kernel

$ sudo make install 

Step 8. Update grub config

$ sudo update-initramfs -c -k 5.6.13
$ sudo update-grub

Step 9. Reboot and check version

$ reboot
$ uname -mrs
Linux 5.6.13 x86_64

Ref. https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html Advanced: Trace kernel initializes: https://danielmaker.github.io/blog/linux/start_kernel.html http://reborn2266.blogspot.com/2013/11/linux-root-file-system.html?m=1 Build your own kernel: http://fichugh.blogspot.com/2016/02/buildroot-study.html?m=1

Last updated