Ubuntu 23.10 - How to build a kernel package from kernel.org
First step is to install needed packages, open a terminal and type the following,
sudo apt install build-essential libncurses-dev flex bison debhelper libssl-dev libelf-dev
Now download your kernel source from kernel.org, you can do this using the terminal if you wish, for example;
wget https://git.kernel.org/torvalds/t/linux-6.6-rc5.tar.gz
This command will download the kernel to your current directory
Extract the kernel archive.
tar -xf linux-6.6-rc5.tar.gz
Go into the directory
cd linux-6.6-rc5
Customise your kernel
make menuconfig
Once you have finished save and exit.
Now it is time to build the kernel package.
time make -j $(($(nproc)+1)) bindeb-pkg
Depending on your processor this may take some time. When it has finished your kernel *.deb package will be in your home directory.
To install it,
sudo dpkg -i linux-image-6.6.0-rc5_6.6.0-rc5-4_amd64.deb
sudo dpkg -i linux-headers-6.6.0-rc5_6.6.0-rc5-4_amd64.deb
Then reboot and enjoy your newer kernel.
Notes
It is important you delete the 2x security keys specified by canonical, your kernel build will fail if you do not. These can be found under;
-*- Cryptographic API ---> Certificates for signature checking ---> (debian/canonical-certs.pem) Additional X.509 keys for default system keyring
-*- Cryptographic API ---> Certificates for signature checking ---> (debian/canonical-revoked-certs.pem) X.509 certificates to be preloaded into the system blacklist keyring
Additionally to speed up the build, disable debugging information
Kernel hacking ---> Compile-time checks and compiler options ---> Debug information (Disable debug information) ---> (X) Disable debug information
If you have an AMD Zen 3 processor you can use time make EXTRA_CFLAGS=-march=znver3 -j $(($(nproc)+1)) bindeb-pkg for extra performance optimizations.
Comments
Post a Comment
If you enjoyed this article please let me know!