Build Linux RT KernelΒΆ
Install the libriaries needed to build the kernel.
sudo apt install wget
sudo apt install flex
sudo apt install bison
sudo apt install qtbase5-dev
sudo apt install libelf-dev
sudo apt install build-essential
sudo apt install libncurses-dev
sudo apt install libssl-dev
sudo apt install libelf-dev
sudo apt install dwarves
Make a directory to build in.
mkdir rtlinux
cd rtlinux
Go to https://www.kernel.org/pub/linux/kernel/projects/rt/ and see what the current real time patch is and use that version for the following or go to https://www.kernel.org/pub/linux/kernel/projects/rt/older and get the url for the version your building. Make sure you change the version of the kernel and the patch in the following instructions to match what you download.
wget https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.10.153.tar.xz
wget https://www.kernel.org/pub/linux/kernel/projects/rt/5.10/patch-5.10.153-rt76.patch.gz
tar -xpf linux-5.10.153.tar.xz
gunzip patch-5.10.153-rt76.patch.gz
cp patch-5.10.153-rt76.patch linux-5.10.153
cd linux-5.10.153
cat patch-5.10.153-rt76.patch | patch -p1
make xconfig
Press Ctrl F and type in preempt and make sure fully premptable is y. Save and quit. $(nproc) simply returns the number of processors.
make -j $(nproc)
sudo make INSTALL_MOD_STRIP=1 modules_install
os-prober has been disabled by default, you need to uncomment/add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub and run sudo update-grub.
sudo nano /etc/default/grub
Ctrl x, then y, then Enter to save and exit nano. Then update grub.
sudo update-grub
Finally install the kernel
sudo make install
You may have to reboot several times and maybe run sudo update-grub again before the grub menu shows up at boot up and allow you to pick the kernel you built.