How to install Real Time Kernel patch on Linux(Ubuntu 16.04)
- Install Ubuntu on Virtual box or Real hardware.
- Download a kernel
https://www.kernel.org/
- What means Number/version 4.13.15
- 4: Kernel version
- 13: Major revision
- 15: Minor revision
- ! Kernel version and major revision number must be the same.
- Create Kernel directory and download kernel source into the directory.
mkdir Kernel && cd Kernel wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.13.15.tar.xz
- What means Number/version 4.13.15
- Download RT-Patch into the Kernel directory.
https://wiki.linuxfoundation.org/realtime/preempt_rt_versions https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.13/
Download it
wget https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.13/patch-4.13.13-rt5.patch.gz
- Extract Kernel source and patch it.
tar xvf linux-4.13.15.tar.xz cd linux-4.13.15
Patch it
gzip -cd ../patch-4.13.13-rt5.patch.gz | patch -p1 --verbose
- Install libncurses5-dev and libssl-dev to enable real time processing and compiling packages.
sudo apt-get install libncurses5-dev sudo apt-get install libssl-dev sudo apt-get install libelf-dev
- Configure Makefile before compiling kernel. This configure will open Real time preemt options.
make menuconfig
Select Fully Preemtible Kernel option from
- Processor type and features
- Preemption Model (Voluntary Kernel Preemption (Desktop))
- Fully Preemptible Kernel (RT)
Go upper menu with ESC-ESC key. Deselect stack overflows if selected.
- Kernel hacking –> [Enter]
- Memory Debugging [Enter]
- Check for stack overflows Go upper menu and save(RIGHT_ARROW) .config file.
- Compile Kernel source file
make
NOTE: You can use “make -jX” option if you have thread support. X is number of core + 1. It will compile faster. For VirtualBox use this.
make -j2
Wait until compilation done. It can take 3-4 hour on VirtualBox.
- Make modules and install
sudo make modules_install -j2 sudo make install -j2
- Check new kernel file and update grub boot loader to start Linux with new RT-Kernel.
cd /boot ls
- You will see new kernel.
- Now update grub and reboot machine.
sudo update-grub sudo reboot
- Check kernel version to be sure.
uname -a
- Old Kernel(Ubuntu SMP 4.10.0)
- New Kernel(PREEMPT RT 4.13.15)