Sunday, July 24, 2011

Building the Real Time Linux Kernel

We are going to use the linux-3.0.0 kernel and Ubuntu/Debian based system in this example.

1. Download the linux-3.0.0 kernel sources from kernel.org
$wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.bz2

2. Extract the kernel sources in the current directory (around 530 MB)
$tar jxvf linux-3.0.tar.bz2

3. Install the quilt tool using apt-get or synaptic
$sudo apt-get install quilt

4. Download the quilt based patches for the Real Time Linux from kernel.org
$wget http://www.kernel.org/pub/linux/kernel/projects/rt/patches-3.0-rt3.tar.bz2

5. Extract the RT kernel patches in the "patches" directory in the Linux kernel source tree. Please make sure the quilt patches are present in the "patches" directory inside the root of the Linux kernel source tree that we extracted in the above step 2.
$cd linux-3.0
$tar jxvf ../patches-3.0-rt3.tar.bz2

6. Now its time to apply the patches using quilt. Run the quilt tool from inside the root of the Linux kernel source tree.
$quilt push -a
The -a option will apply all the patches from the "patches" directory automatically. You can navigate inside the "patches" directory to see the list of all the patches and also use "quilt pop" to remove a particular patch.

This step should not show any errors. If all the patches applies correctly you can proceed to the next step.

7. Configure the real time kernel options in the kernel configuration.
$make menuconfig

Inside the "Processor type and features" you will get a item for "Preemption Model (current option that is selected)". Inside that you will have two options
1. Preemptible Kernel (Basic RT)
2. Fully Preemptible Kernel (RT)
Select the second option.



Now go ahead and compile your Real Time Patched Linux kernel...

Links :
http://forums.debian.net/viewtopic.php?t=17035

1 comment:

  1. i want to patch kernel v 2.6.32.2 with a real time kernel?
    Which patch version should be used ? Used many version of rt kernel
    "https://www.kernel.org/pub/linux/kernel/projects/rt/" but still getting errors. Please help !

    ReplyDelete