RT Kernel Instructions

From openSUSE

(Redirected from Rt Kernel Instructions)

RT Kernel Instructions Ver.2 for SuSE 10.0


A little guide how to switch your linux-system to an audio-workstation.

This is an update of the HowTo from gimpel (gimpel.funpic.de), translated by oc2pus. Updated by metasymbol.

The main goal in audio-processing is the latency. The latency is the delay beetween signal-creating and reaching the processing in the system (e.g time between pressing a key on the keyboard and hearing the tone). The standard kernels have the disadvantage that the processing is slower (~11ms) as in Windows or using a MAC . The faster the system, means the lower the latency, the more things can happen simular on a the system (e.g. more synths ..) Ingo Molnar, a RedHat developer and some others have started a project to minimize the latency in Linux: Realtime Preemption. By using excellent audio-hardware the JACK demon (Jack Audio Connection Kit) reach latency < 1ms, similar to the MacOS X „coreaudio“ system. For interested people follows a little step-by-step HowTo to patch a vanilla kernel with Realtime Preemption stuff and how to compile and install this new kernel.

Note:

This is only an experimental kernel. From the developers view the rt-lsm is obsolent. The "official" Audio RT Kernel for openSUSE will use PAM for SCHED_FIFO priorities.

Comparing to the actual SuSE-kernel you are loosing the some features:

- Support for ide-disk sis5513 processor thermal fan control UPDATE This could be maybe fixed: (untestet) edit /[path to current kernel sources]/arch/i386/kernel/tsc.c, looking for the following lines:

void tsc_c3_compensate(unsigned long usecs)
{
       u64 cycles = (usecs * tsc_khz)/1000;
       tsc_c3_offset += cycles;
}

After that one insert the following code:

EXPORT_SYMBOL_GPL(tsc_c3_compensate)

- reiser4 filesystem (IMHO it's not usefull for audio applications –) (?)

- lirc (IR remotecontrol) (?)

- submount (not needed, SuSE 9.2 uses udev, hal/dbus/ivman for automounting. You can build the automount features later, when the new kernel is running) (?)

- some ipv6 stuff and some other "small things" (?)


Sample kernel is the stable 2.6.13.4 kernel.

UPDATE: Some users reported that they could successfully build the current kernel 2.6.14.3 with the actual rt patch 20/21.


Step 1: download kernel-sources and necessary patches


  • download actual vanilla kernel
~> wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.13.4.tar.bz2
  • download Realtime Preemption patch
~> wget http://people.redhat.com/mingo/realtime-preempt/older/patch-2.6.13-rt14
  • download realtime-lsm patch

this feature allows users to work with realtime priority (this patch isn't in development anymore, because of the upcoming “rt-limits�?. We use the last version made for the 2.6.11.7, and it's still working well on 2.6.13.4)

~> wget http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11/2.6.11-mm4/broken-out/rt-lsm.patch
  • if you like bootsplashes
~> wget http://www.bootsplash.de/files/bootsplash-3.1.6-2.6.13.diff



Step 2: unpack and patch kernel


~> cd /usr/src/linux
~> su
<passwort>
# tar -xvjf /path/to/linux-2.6.13.4.tar.bz2
# mv linux-2.6.13.4 linux-2.6.13.4-realtime
# cd linux-2.6.13.4-realtime
# patch -p1 < /path/to/patch-2.6.13-rt14
# patch -p1 < /path/to/rt-lsm.patch
# patch -p1 < /path/to/bootsplash-3.1.6-2.6.13.diff
  • change release information for your own kernel:
# vi Makefile

..add as EXTRAVERSION=.4-jad3 and save the file.



Step 4: Configuration of kernel


  • start with cloning

the actual configuration of the kernel, this will assure that everything will run fine:

# zcat /proc/config.gz > .config
  • make some adjustions in the configuration:
# make menuconfig
  • activate rt full preempt
Processor type and features --->
Preemption Mode (Complete Preemption (Real-Time)) --->
( ) No Forced Preemption (Server)
( ) Voluntary Kernel Preemption (Desktop)
( ) Preemptible Kernel (Low-Latency Desktop)
(X) Complete Preemption (Real-Time)
  • activate realtime-lsm
Security options  --->
     <M>   Realtime Capabilities

Leave the menu with "Exit" and save configuration.



Step 5: Compile and install new kernel


  • compile the kernel:
# make rpm

This can take a long time ...


  • install the kernel:

Check which kernel runs:

# rpm -qa | egrep kernel kernel-2.6.13-14-default

Erase default from the data base:

# rpm -e --justdb kernel-2.6.13-14-default

JAD kernel install:

# rpm -ivh 2.6.13.4-jad3-default.i386.rpm

create initrd

# cd /boot
# mkinitrd -k vmlinuz-2.6.13.4-jad3-default -i initrd-2.6.13.4-jad3-default

create symbolic links:

# ln -s initrd-2.6.11.7-jad.1 initrd-jad
# ln -s vmlinuz-2.6.11.7-jad1 vmlinuz-jad

Configure the bootloader

# vi /boot/grub/menu.lst

Copy the existing entry for your old kernel and edit the names. The name should match your new kernel (symbolic links initrd-jad and vmlinuz-jad)

  • pray and reboot...



Step 6: activate and testing audio RT


  • after reboot

it's time to activate the user real-time module:

determine ID users of the audio (as a user)

~> ID uid=1000(metasymbol) gid=100(users) Gruppen=16(dialout), 17(audio), 33(video), 100(users)
~> su
password:
# modprobe commoncap
# modprobe real-time gid=17

Now the normal user is able to run audio realtime capabilities.

# lsmod|grep real-time
real-time 5512 0
commoncap 7040 1 real-time

if realtime is working OK, a:

# echo "modprobe real-time gid=17" > >/etc/init.d/boot.local

will automate the start of the real-time user module.


  • testing audio RT

with qjackctl and zynaddsubfx

Start “qjackctl�? make your config, press “Start�? -> if JACK starting successfull, start “zynaddsubfx�?, in qjackctl open “Connect�? and make your connections. Hopefully the beautiful sound of ZynAddSubFX appears.

Have fun AND give feedback :) core at jacklab dot net



Known Bugs


when initializing mkinitrd -k:

/Driver modules: ide-disk sis5513 processor thermal fan/
/Filesystem modules:/
/WARNING:
/var/tmp/mkinitramfs.a11783/mnt/lib/modules/2.6.13.4-jad3--default/kernel/drivers/acpi/processor.ko
needs unknown symbol tsc_c3_compensate/
/Including: klibc initramfs udev/
/Bootsplash: SuSE (1024x768)/
/6568 blocks/