Contents
1- Introduction
Compiling a custom kernel has its advantages and disadvantages. knowing that new users and Linux administrators have trouble compiling the Linux kernel. to install and compile a new linux kernel version it requires little understanding and some commands.
In this tutorials I will explain step by step the procedure for the compilation of version 5.2.19 of the Linux kernel on Linux Ubuntu or Debian
2- Prerequisites
For this tutorial, you will require:
1 |
git commit -m "Add initial Jenkinsfile" |
And then push your chnges to uour remote github repository using the command below :
1 |
git push origin master |
3. Get the latest Linux kernel source code
You can visit the official project site and download the latest source code. Click on the big yellow button that read as “Latest Stable Kernel“:
You can use the wget command to download Linux kernel source code:

1 |
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz |
4. Extract tar.xz file
After downloading the tar file in your curruent directory you can extract it using the following unzx command or xz command
1 |
unxz -v linux-5.6.16.tar.xz |
OR
1 |
xz -d -v linux-5.6.16.tar.xz |
Verify Linux kernel tartball with pgp
First grab the PGP signature for linux-5.6.9.tar:
1 |
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.sign |
Try to verify it:
1 |
gpg --verify linux-5.6.16.tar.sign |
Sample outputs:
1 2 3 4 |
gpg: assuming signed data in 'linux-5.6.16.tar' gpg: Signature made Sun 12 Aug 2020 04:00:28 PM CDT gpg: using RSA key xxxxxxxxxxxxxxxxxxx gpg: Can't check signature: No public key |
Grab the public key from the PGP keyserver in order to verify the signature i.e. RSA key ID xxxxxxxxxxxxxxxxxxx (from the above outputs):
1 |
gpg --recv-keys xxxxxxxxxxxxxxxxxxx |
Sample outputs:
gpg: key xxxxxxxxxxxxxxxxxxx: 7 duplicate signatures removed gpg: key xxxxxxxxxxxxxxxxxxx: 172 signatures not checked due to missing keys gpg: /home/vivek/.gnupg/trustdb.gpg: trustdb created gpg: key xxxxxxxxxxxxxxxxxxx: public key “Linus Torvalds <torvalds@kernel.org>” imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 |
Now verify gpg key again with the gpg command:
1 |
gpg --verify linux-5.6.16.tar.sign |
Sample outputs:
gpg: assuming signed data in ‘linux-5.6.16.tar’ gpg: Signature made Sun 12 Aug 2019 04:00:28 PM CDT gpg: using RSA key xxxxxxxxxxxxxxxxxxx gpg: Good signature from “Linus Torvalds <torvalds@kernel.org>” [unknown] gpg: aka “Linus Torvalds <torvalds@linux-foundation.org>” [unknown] gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: ABAF 11C6 5A29 70B1 30AB E3C4 79BE 3E43 0041 1886 |
Step 3. Configure the Linux kernel features and modules
Before start building the kernel, one must configure Linux kernel features. You must also specify which kernel modules (drivers) needed for your system. The task can be overwhelming for a new user. I suggest that you copy existing config file using the cp command:
1 2 |
cd linux-5.6.16 cp -v /boot/config-$(uname -r) .config |
Sample outputs:
1 |
'/boot/config-4.15.0-30-generic' -> '.config' |