Building the Linux kernel on Ubuntu

tested on ubuntu/focal

Requirements

look for the latest kernel package

apt search ^linux-image-5.9
apt search ^linux-image-5.8
apt search ^linux-image-5.4

and install the whole set

#kernel.org stable
apt install linux-image-5.8.0-31-generic \
    linux-headers-5.8.0-31-generic \
    linux-modules-5.8.0-31-generic

#kernel.org longterm
    apt install linux-image-5.4.0-54-generic \
            linux-headers-5.4.0-54-generic \
            linux-modules-5.4.0-54-generic

requirements

apt install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf
apt install bc screen

Ready to go

cd /usr/src/
screen -S kernel

cd linux-VERSION/
cp /boot/config-5.8.0-31-generic .config
make olddefconfig
make xen.config
make > ../dom0.log && echo BUILT
make modules_install >/dev/null && echo MODULES INSTALLED
mv -f /vmlinuz /vmlinuz.old
cp -f arch/x86/boot/bzImage /vmlinuz

Resources

https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel

https://help.ubuntu.com/community/Kernel/Compile

https://wiki.ubuntu.com/KernelTeam/GitKernelBuild

https://imil.net/blog/posts/2022/build-a-single-in-tree-linux-kernel-module-debian--clones/


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun