2.6.29 realtime kernel for Debian

I’ve finally sat down and tried to make a realtime kernel for Debian, for my 64bit machine.
I followed the instructions I found in this post on the Debian forums.

First, I got the Debian sources for 2.6.29, from my repository (so using synaptic).

It puts the sources in /usr/src.

Then I got the latest realtime patches from http://www.kernel.org/pub/linux/kernel/projects/rt/

Then I made a dir in my home directory


mkdir kernel
cd kernel
cp /usr/src/linux-source-2.6.29.tar.gz .
tar -xf linux-source-2.6.29.tar.gz
mv linux-source-2.6.29 linux-2.6.29-source-rt
cd linux-2.6.29-source-rt
bzcat ../patch-2.6.29.4-rt16.bz2 |patch -p1

I added this to the Makefile:

EXTRAVERSION = -rt16

To start from my current kernel configuration
make oldconfig

Then I got a whole bunch of questions, most of which I answered taking the default options. Only for the realtime-preemption question I chose option 4, the realtime option.

I looked at the options with menuconfig, but didn’t really change anything more there. The timer frequency mentioned in the post above seems to be preceded by the dynamic ticks option, which was turned on.
make menuconfig

I had to unselect “staging” and the “comedi” drivers as these caused errors during building, and according to some messages on LAU I don’t really need it.

Here is the configuration for the kernel, as I ended up with it (I also compiled ext3 support into the kernel, rather than as a module, since my main filesystem is ext3): .config

Build a kernel the Debian way:
make-kpkg clean
time fakeroot make-kpkg --initrd -rev mz1 kernel_image kernel_headers

To also build a source package:

time fakeroot make-kpkg --initrd -rev mz1 kernel_image kernel_headers kernel_source

This will take a while.

Your new kernel & headers now live in ../kernel Use dpkg -i to install (as root).
dpkg -i ../linux-headers-*.deb ../linux-image-*.deb

So good so far… but the kernel didn’t boot yet…
and the initrd file was missing

So with the initramfs-tools from the debian repository,
I did (as root)
mkinitramfs -o /boot/initrd.img-2.6.29-rt16 2.6.29-rt16
which created the initrd image.

Also editing it appropriately in grub (/boot/grub/menu.lst) so that the boot process knows about it.


The initramfs missing is due to this (thanks to Jan Weil, on the linux audio user list).

This might be related to a recent change in Debian’s kernel-package (are we talking about the unstable branch?). Check /usr/share/doc/kernel-package/NEWS.Debian.gz and /usr/share/doc/kernel-package/README.gz in particular:

“Note that you will have to arrange for the actual initrd creation to take place by installting a script like /usr/share/kerne-package/examples/etc/kernel/post{inst,rm}.d/yaird or, alternately, /usr/share/kerne-package/examples/etc/kernel/post{inst,rm}.d/initramfs
into the correspondung directories /etc/kernel/post{inst,rm}.d, since the kernel-postinst does not arrange for the initramfs creator to be called. You can thus select your own; initramfs-tools or yaird.”


In /etc/security/limits.conf you also need something like this:

Add the following lines to the bottom of the file: (Must do this as root, or with sudo)
@audio – rtprio 100
@audio – nice -10
@audio – memlock 400000

And add yourself and any other audio user to the group audio.


My RME multiface card did not work with this kernel yet.
Similar problems had been reported elsewhere, and a fix from Tim Blechmann can be found here.

Here is the patched file:
/sound/pci/rme9652/hdsp.c


Then Jan Weil also pointed out to me that this could be useful:

Did you tune your interrupt priorities yet? I use Rui’s rtirq
http://www.rncbc.org/jack/
along with this /etc/rtirq.conf
http://www.jawebada.de/bucket/rtirq.conf.

Actually Debian has a package for this, but that one is a bit outdated (the 2007 version). So I took the one from Rui’s website, and installed the script to /etc/init.d/, with a symbolic link to it from /etc/rc3.d/S99rtirq.

and the configuration file to:

/etc/default/rtirq.conf


(Note, comments are welcome, but they have to be authorized by me, before they appear online.)

9 Responses to “2.6.29 realtime kernel for Debian”

  1. 2.6.29 realtime kernel for Debian | Debian-News.net - Your one stop for news about Debian Says:

    [...] I’ve finally sat down and tried to make a realtime kernel for Debian, for my 64bit machine. I followed the instructions I found in this post on the Debian forums. More here [...]

  2. Alan Says:

    Thanks for the information. I’m just wondering if you could comment on the performance of the new kernel versus a Debian stock. I notice you posted this article in the “Linux Audio” section, which audio apps are you using?

    I’ve always though the real time patches were interesting since I saw Linus’ comment one time. From the realtime Linux wiki:

    “Controlling a laser with Linux is crazy, but everyone in this room is crazy in his own way. So if you want to use Linux to control an industrial welding laser, I have no problem with your using PREEMPT_RT.” — Linus Torvalds

    Haha, take care.

  3. Luca Bruno Says:

    How does the desktop compares now against normal kernels?

  4. nescivi Says:

    I really just posted this, so I am still testing things out, as it is not yet performing as well as I want.
    I started an email thread on the Linux-Audio-Users list on this too.

    The audio apps I am using are mainly jack and SuperCollider, with the occasional wave editor at times (mhwaveedit currently).

    My main purpose to build a realtime kernel is to get rid of xruns I am getting with the stock kernels, which are quite annoying during performances with about 500 or more people hearing them.

  5. The Great Sudoku Says:

    another EPIC fail of Debian’s was the tinkering with “kernel-package” as to NOT include an initrd image even when *I SPECIFY* in make-kpkg that I want one! How counter-intuitive can you get? At least Ubuntu hasn’t gone this route yet and still uses a SANE kernel-package that actually *GASP* creates and installs an init image when I tell it to. I love Debian to death, but come on!

  6. yeeking Says:

    Hello thought I’d drop in here since I’ve just spent a few days trying to get the ‘ultimate’ stable audio system going on a Thinkpad T400/ RME multiface expresscard combination… in conclusion, I’ve ended up running a stock, non-realtime kernel in stock Ubuntu 8.10 with no frill whatsoever. I tried all sorts – ubuntustudio 8.04.1, debian lenny + self built 2.6.29 rt kernel, 64stiudio, ubu 9.04. I have found that this is the most stable option for me. The problem was that I wanted to have the ATI card running quietly, which it did not do with the open source drivers ait/ radeonhd (fan on all the time), i wanted no xruns and I wanted the wifi to work. suspend to RAM was a bonus. Apart from the mystical 2.6.24-rt kernel in Ubu 8.04, no realtime kernel that I tried would work with the ATI proprietary drivers. I didn’t use 8.04 since the wifi did not work and it ended up being really unstable with the RME.

    With the stock 8.10 system, jockey-installed ati drivers I just run jack as root – sudo jackd -R -d alsa -d hw:1 and I can happily run my RME multiface at ~21ms latency with no xruns with supercollider and a heavy CPU load, which is find for me. I know that’s not 2ms… but at least it works, Don’t know why, but those realtime kernels make me feel like I’m somehow vilolating my system…

    - matthew

  7. Brian Findlay Says:

    Thanks for this.. I just got the RT patch running on my x86_64 Intel Atom 330 board with 2.6.31.4 release. I did a few things differently..

    ———————————————————————
    Your new kernel & headers now live in ../kernel Use dpkg -i to install (as root).
    dpkg -i ../linux-headers-*.deb ../linux-image-*.deb

    ME> I executed this from /usr/src rather than /usr/src/linux-2.6.31.4 which
    ME> may or may not explain below..

    So good so far… but the kernel didn’t boot yet…
    and the initrd file was missing

    ME> Mine did.. initrd file was created and installed.

    So with the initramfs-tools from the debian repository,
    I did (as root)
    mkinitramfs -o /boot/initrd.img-2.6.29-rt16 2.6.29-rt16
    which created the initrd image.

    ME> I didn’t have to do this step

    Thanks!!

    Brian

  8. Bas Says:

    Just to let you know: if you’re using Debian’s unstable or testing branch, one of the commands used in this page has changed :

    time fakeroot make-kpkg –initrd -rev mz1 kernel_image kernel_headers

    has become:
    time fakeroot make-kpkg –initrd –revision mz1 kernel_image kernel_headers

    i.e. make-kpkg’s -rev option is now –revision

    So if you get an error message like:
    Unknown option: r
    Unknown option: e
    Unknown option: v
    then use the –revision instead of -rev

  9. Bas Says:

    Erm, that should be revision with two dashes in front of it.

    Somehow all my double dashes have turned into single dashes, sorry for the confusion

Leave a Reply