Installing real time patch for Ubuntu 20.04
I am trying to install Real time patch on ubuntu 20.04 I followed many steps and for each trial it took about 4 hours to complete. Unfortunately none of these trials worked (in the links below). I really appreciate if you could advice me with exact steps to follow as I am new guy in using Linux. Thank you very much.
https://docs.ros.org/en/foxy/Tutorials/Building-Realtime-rt_preempt-kernel-for-ROS-2.html
https://stackoverflow.com/questions/51669724/install-rt-linux-patch-for-ubuntu/51709420#51709420
https://hmenn.github.io/pages/UbuntuRT_patch.html https://lists.debian.org/debian-kernel/2016/04/msg00579.html
John
Solution 1:
I was able to build the PREEMPT-RT kernel on Ubuntu 20.04 mostly based on this guide as follows:
sudo apt install build-essential git libssl-dev libelf-dev flex bison
Download kernel source and patch for that version:
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.4.143.tar.xz
wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/patch-5.4.143-rt64-rc2.patch.xz
Unpack and apply patches:
tar -xf linux-5.4.143.tar.xz
cd linux-5.4.143
xzcat ../patch-5.4.143-rt64-rc2.patch.xz | patch -p1
Configure, and when asked for Preemption Model select the Fully Preemptible Kernel. Accept the default value for the rest:
cp /boot/config-5.4.0-81-generic .config
make oldconfig
Edit the .config
file and change CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"
to CONFIG_SYSTEM_TRUSTED_KEYS=""
Build kernel:
make -j8 deb-pkg
Install the generated packages, and reboot your system.
sudo dpkg -i ../linux-headers-5.4.143-rt64-rc2_5.4.143-rt64-rc2-1_amd64.deb ../linux-image-5.4.143-rt64-rc2_5.4.143-rt64-rc2-1_amd64.deb ../linux-libc-dev_5.4.143-rt64-rc2-1_amd64.deb
After reboot you should be able to see something like this:
# uname -a
Linux vod 5.4.143-rt64-rc2 #1 SMP PREEMPT_RT Tue Sep 7 20:19:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
The guide suggests a few other steps but I haven't tested them yet.