Install Patch linux kernel 5.0 with PREEMPT RT

From Lofaro Lab Wiki
Jump to: navigation, search

Patch linux kernel 5.0.21 with PREEMPT_RT for pseudo real time performance

Backup all important files before starting this process

Open a terminal

If you are working over a network start a screen

 $ screen

screen can be installed with

 $ sudo apt-get update
 $ sudo apt-get install screen

Install dependencies

 $ sudo apt-get update
 $ sudo apt-get install libncurses-dev libssl-dev bison flex

Download the 5.0 linux kernel to patch

 $ wget

Download the PREEMPT_RT patch

 $ wget

Extract the linux kernel

 $ tar -xzvf linux-5.0.tar.gz

Move into the kernel director and patch the kernel

 $ cd linux-5.0/
 $ gzip -cd ../patch-5.0.21-rt16.patch.gz | patch -p1 --verboses

configure the kernel

 $ make menuconfig

Use UI to configure the kernel

 General setup -->
 Preemption Model (Voluntary Kernel Preemption (Desktop)) [Enter]
 Fully Preemptible Kernel (RT) [Enter] #Select
 [Right Arrow][Right Arrow]
 <Save> [Enter]
 <Okay> [Enter]
 <Exit> [Enter]
 [Right Arrow]
 <Exit> [Enter]

Compile and install the configured kernel

 $ make -j20
 $ sudo make modules_install -j20
 $ sudo make install -j20

Verify the installation

 $ cd /boot
 $ ls
 $ sudo update-grub

Verify that there menuentry containing the text "menuentry 'Ubuntu, with Linux 5.0.21-rt16'" in grub.cfg

 $ vim /boot/grub/grub.cfg

To change default kernel in grub, edit the GRUB_DEFAULT value in /etc/default/grub to your desired kernel.

0 is the first menuentry.

 $ sudo vim /etc/default/grub

reboot and verify the kernel

 $ sudo reboot

This could take a couple of minutes Once rebooted check the kernel version

$ uname -a

If done properly you should see something like

Linux robotRT 5.0.21-rt16 #1 SMP PREEMPT RT Fri Mar 20 11:22:40 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux