jump to navigation

Kanotix rt-preempt custom kernel February 20, 2006

Posted by oktyabr in debian, hacking, linux, realtime.
trackback


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: http://www.kernel.org/pub/linux/kernel/v2.6/ 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 http://people.redhat.com/mingo/realtime-preempt/ (matching means patch 2.6.15-rt16 in my case) to your new directory:
wget http://people.redhat.com/mingo/realtime-preempt/patch-2.6.15-rt16 (version will change over time)

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

*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-2.6.15.1-kanotix-3 .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:
./update-scripts-kanotix.sh
./install-nvidia-debian.sh
(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

Advertisements

Comments»

1. mozai - January 25, 2007

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.

This seems unnecessary

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.

You are installing your modules into a new location
by changing EXTRAVERSION so your nvidia driver will need reinstalling.

2. oktyabr - January 25, 2007

Hmmm… I never considered that adding extraversion would install my modules somewhere else (I thought they *always* got installed somewhere else!)

I tend to build several different versions of a kernel, when I get on a kernel building kick, to compare performance and benefits, then once I have settled on one I habitually build the latest nvidia drivers from scratch to fit. Extraversion simply helps me tell them apart.

Thanks for the comment though, good to know!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: