This document introducing how to install PREEMPT RT on ubuntu 18.04.
I got the information from here.
$ sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev gitDownload the linux-5.4.193 kernel and the RT patch from kernel.org.
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.4.193.tar.xz
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/patch-5.4.193-rt74.patch.xzExtract the file and apply the patch.
$ xz -cd linux-5.4.193.tar.xz | tar xvf -
$ cd linux-5.4.193
$ xzcat ../patch-5.4.193-rt74.patch.xz | patch -p1Copy the old config file.
$ cp -v /boot/config-$(uname -r) .configYou may have to edit the .config file.
$ vim .configSearch the CONFIG_SYSTEM_TRUSTED_KEYS and erase the contents inside the double quotation marks.
You have to set the menu configuration.
$ make menuconfigGeneral setup -> Preemption Model -> Fully Preemptible Kernel (Real-Time)
Processor type and features -> Timer frequency -> 1000 HZ
If you want to use the kernel as a uniprocessor, follow the instructions below.
Processor type and features -> Symmetric multi-processing support -> [OFF]
Now save the menuconfig and exit.
Save -> Exit
$ make -j $(nproc) deb-pkg$ sudo dpkg -i ../linux-headers-5.4.193-rt74_5.4.193-rt74-1_amd64.deb
../linux-image-5.4.193-rt74_5.4.193-rt74-1_amd64.deb
../linux-libc-dev_5.4.193-rt74-1_amd64.debReboot your system and check the kernel.
$ sudo reboot
$ uname -a
