Showing posts with label Compiling real-time kernel. Show all posts
Showing posts with label Compiling real-time kernel. Show all posts

08 March 2012

96. Building a real-time kernel (3.2.9) on debian testing

Building an RT kernel is not terribly different from building a vanilla kernel:http://verahill.blogspot.com.au/2012/03/debian-testing-kernel-329.html

The main differences are:
1. the application of the relevant RT kernel patch
2. the configuration of RT specific kernel options

The latter step requires reading up on what an RT kernel does differently from a vanilla kernel, and the configuration will depend on your application.

The value of this guide is fairly small, since you wouldn't typically use an RT kernel on a desktop, but on a dedicate server or embedded system. I'm still working on a cross-compiling guide for non-x86 architectures.

In addition, having an RT kernel is only the first step -- it needs to be used in the correct way to allow for prioritising processes/pre-emptive execution in an efficient way. An overview for a particular application is given here: http://wiki.linuxmusicians.com/doku.php?id=system_configuration

Briefly,
sudo apt-get install kernel-package fakeroot
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.2.9.tar.bz2
wget http://kernel.org/pub/linux/kernel/projects/rt/3.2/patches-3.2.9-rt17.tar.bz2
tar -xvf linux-3.2.9.tar.bz2
cd linux-3.2.9/
bzcat ../patches-3.2.9-rt17.tar.bz2 |patch -p1
cat /boot/config-`uname -r` .config
make oldconfig

You get to answer a number of questions relating to real-time OS execution

  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)
choice[1-5]: 4
[..]
 Testing module to detect hardware-induced latencies (HWLAT_DETECTOR) [M/n/y/?] (NEW)
[..]

Launch the build process
fakeroot make-kpkg -j7 --initrd --revision=3.2.9 --append-to-version=rt kernel_image kernel_headers 

where 7 is the number of cpu cores+1.

The deb-packages will be found in the folder above linux-3.2.9/ and can be installed using sudo pkg -i
.