Install RT Linux
RT linux is a patch of the linux kernel that allows real time scheduling.
You will need at leat 3GB of space and the following tools: git make gcc.
If you have any trouble following this tutorial you can go to the original tutorial here.
Get all the files
Open a terminal and go to where you want tu put your files (for example, in your home).
Then create the folders:
mkdir -p ./rpi-kernel/rt-kernel
cd ./rpi-kernel
You will have to clone the sources of the linux kernel for the raspberry pi and the toolchain in order to compile it:
We are assuming the current stable kernel version is 4.14. You can see all branches here and choose the one with the higher version ending with -rt and replace the argument after the -b in the command with your chosen version number:
git clone https://github.com/raspberrypi/linux.git -b rpi-4.14.y-rt
git clone https://github.com/raspberrypi/tools.git
The download can take a while.
Download the script: generate.sh in the rpi-kernel directory.
Your rpi-kernel directory should look like this:
silvanosky@GLaDOS_M rpi-kernel % ls
generate.sh linux rt-kernel tools
Compile the kernel
The generate.sh script will compile the kernel and install it on the raspberry pi through SSH. Thus, you need to be able to connect to the raspberry pi over SSH before launching the script and you also need to know the address of the raspberry pi (For example: pi@192.168.1.1).
Before compiling, the script will open the kernel setup menu. You can modify anything you want. You must also change the following parameter:
Set CONFIG_HZ to 1000Hz:Kernel Features -> Timer frequency = 1000Hz
To increase the responsiveness of the scheduler.
Then save the file without modifying the name and exit.
The script will compile the kernel and all modules and install it to your raspberry pi through SSH.
At the end of the script the raspberry pi will reboot.
Check that RT linux is installed
To check that all went correctly, connect to the raspberry pi and enter the following command:
uname -r
You should get something like this:
pi@raspberrypi:~ $ uname -r
4.14.66-rt40-v7+