Compiling the Linux Kernel version 5.19.8 in Ubuntu 22.04
First we need to install the following:
sudo apt install git libncurses-dev gawk openssl libssl-dev dkms libudev-dev libpci-dev libiberty-dev autoconf llvm
sudo apt install libncurses5-dev libncursesw5-dev
sudo apt install pkg-config
sudo apt install bison
sudo apt install flex
sudo apt install libelf-dev
sudo apt install openssl
sudo apt-get install libssl-dev
sudo apt-get install liblz4-tool
After downloading and decompressing the Kernel file, under a Terminal go to that directory and run the configuration script:
MyPC:~/Downloads/LinuxKernel/linux-5.19.8$ make menuconfig
We can check our hardware characteristics using the following commands:
lshw
lscpu
lsmod
lspci
lsusb
With that information we can set the configuration file properly.
The compilation process can be started with the command:
make -j 8
The number 8 means that 8 threads will be used for the compilation process. You can check with the command lscpu how many cores and threads your computer support. If you have 4 cores and every core can support 2 threads that makes a total of 8. Using all your threads will speed up the compilation process, in average using 8 threads the compilation would be over in about 30 minutes. If you use just one core or thread it would take over 2 hours to finish the compilation.
If you get the following error:
make[1]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'. Stop.
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1847: certs] Error 2
make: *** Waiting for unfinished jobs....
You can fix it editing your ".config" file and changing the line:
CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"
to
CONFIG_SYSTEM_TRUSTED_KEYS=""
and run again the command for compilation.