Jun 18, 2015

Linux Kernel Real-time Patch

Look here how to apply the real-time Linux kernel patch, the process is the same for PC, ARM or any other architecture, just apply the changes in the kernel source and compile it. This example uses the Linux Ubuntu 14.04.2 LTS due the popularity.

First we need get the specific patch file of the target kernel version, this example was done using the kernel 4.0.5, the patches are available at kernel.org/pub/linux/kernel/projects/rt. Using the Ubuntu Linux Kernel Update as base, go to the kernel sources folder, download the patch and extract it:

cd /usr/src/linux-4.0.5/
wget https://www.kernel.org/pub/linux/kernel/projects/rt/4.0/patch-4.0.5-rt4.patch.gz
gunzip patch-4.0.5-rt4.patch.gz

Apply the patch and compile the kernel:

cat patch-4.0.5-rt4.patch | patch -p1
make 

At this point you will be asked some new questions, like the preemptive model, choose one:

Preemption Model
  1. No Forced Preemption (Server) (PREEMPT_NONE)
> 2. Voluntary Kernel Preemption (Desktop) (PREEMPT_VOLUNTARY)
  3. Preemptible Kernel (Low-Latency Desktop) (PREEMPT__LL) (NEW)
  4. Preemptible Kernel (Basic RT) (PREEMPT_RTB) (NEW)
  5. Fully Preemptible Kernel (RT) (PREEMPT_RT_FULL) (NEW

To keep the default option, number 2, just hit enter, and do the same for the remaining questions. When the compilations is done, make the modules, install them and update the GRUB boot loader:

make modules
make modules_install
make install

Now check your current kernel version:

uname -r
4.0.5

Reboot and check it again:

uname -r
4.0.5-rt4

That's all!

0 comentários :

Post a Comment