Thursday, February 09, 2006

Kanotix rt-preempt kernel

I've got a rt-preempt kernel of my own running now! Still needs some tweaking but all my sound devices work, as does internet, graphics, etc. and I'm able to get 2.9ms latency in qjackctl without xruns (44100Hz, period = 64 frames, buffer = 2 periods).

Here is roughly how I did it in case anyone else wants to try and/or compare notes (if I've got something wrong or forgotten something please post and correct me! I'm still a n00b at kernel building.):

1) Download the latest vanilla kernel source from: In my case this was linux-2.6.15.tar.bz2

2)Switch to root, move the kernel source to /usr/src and unpack it there with tar jxf linux-2.6.15.tar.bz2

3)Remove old symbolic link "linux" and replace it with a new one going to your new directory and then cd to it:
rm linux
ln -s linux-2.6.15 linux
cd linux

4)Fire up your favorite text editor and edit the file "Makefile". The line that says "EXTRAVERSION=" simply add what you like to the end of it like your name, whatever. NO capital letters and NO underscores! Save the file.

5) Download the latest *matching* rt-preempt patch from (matching means patch 2.6.15-rt16 in my case) to your new directory:
wget (version will change over time)

6) Switch to the new kernel source directory and patch it:
cd linux-2.6.15
patch -p1 < patch-2.6.15-rt16

*Not really sure what to do here, what to answer 'yes' to etc. so I answered "n" or chose the default option on the patch questions EXCEPT where it wants to know what level of PREEMPT you want... then you entire "4" for 'complete preemption'.

7) Now I copied the config file from my current kernel (do ls /boot to see what to enter here) to use as a config for the new one:
cp /boot/config- .config

8) Run make menuconfig for console version or make xconfig (may require deps) for the graphical version of the configuration utility. Trim up the kernel by removing any drivers you are *sure* you don't need. If in doubt, leave it. Don't enable anything that you don't need. This may take some experimentation to get working right. I'm sure there is a more 'foolproof' way of doing this but I don't know what it is... yet. "Save" your new config when done.

9)Build the kernel, headers and modules:

make-kpkg clean
make-kpkg modules_clean
make-kpkg kernel_image kernel_headers modules_image

This will take quite awhile depending on the power of your machine... On my AMD64+3500 it took just about 30 minutes. NOTE: "make-kpkg modules_clean" is something I've read in other tutorials but it gave me an error and suggested I could fix it by running kpkg once in that directory... I skipped it and went to the next line. Maybe on the next build of this kernel it will work...

If you complete all of the above with no errors you should be able to cd back to /usr/src (cd ../) and you should find some new .deb packages there for the kernel, any modules you built, and the kernel headers. Install them as you would any .debs (I use dpkg -i name_of_package.deb) and reboot. In my Kanotix this kernel was automatically chosen as the default and identified itself simply as "Debian 2.6.15"

NOTES: My graphics was shot when I first booted into this new kernel, probably because I either missed an option in menuconfig or because I had a messed up xorg.conf from an earlier kernel. EIther way it was easily fixed by switching to root and running the scripts found in /usr/local/bin:
(I have an nvidia card! This won't work if YOU don't have an nvidia card!)

FINALLY I installed realtime-lsm with the following commands (might require deps on your machine):

apt-get install module-assistant
m-a update
m-a prepare
m-a get realtime-lsm
m-a get realtime-lsm-source
m-a build realtime-lsm-source
m-a install realtime-lsm
/sbin/modprobe realtime gid=29
/etc/init.d/realtime start


Post a Comment

Links to this post:

Create a Link

<< Home