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.)