Blog Archives

Slackware 14: JACK Installation Notes

I was trying to set up a digital audio workstation using Ardour on Slackware Linux and the professional sound server JACK (JACK Audio Connection Kit), the latter will  basically allow us to manipulate streams between audio applications in a pattern that would redirect the output of App 1 to the input of App 2 ( a bit  à la ReWire under Windows if you’ve ever used Ableton or Reason).

A more thorough definition would be (snatched off jackaudio.org)

JACK is system for handling real-time, low latency audio (and MIDI). It runs on GNU/Linux, Solaris, FreeBSD, OS X and Windows (and can be ported to other POSIX-conformant platforms). It can connect a number of different applications to an audio device, as well as allowing them to share audio between themselves. Its clients can run in their own processes (ie. as normal applications), or can they can run within the JACK server (ie. as a “plugin”). JACK also has support for distributing audio processing across a network, both fast & reliable LANs as well as slower, less reliable WANs.

Here are some useful tips, hope someone will benefit from them!

First of all I’ve grabbed  jack-audio-connection and its Qt front-end qjackctl then I had to create limits.conf and write the following lines:

vim /etc/security/limits.conf
@audio          -  rtprio                   99
@audio          -  nice                    -10
@audio          -  memlock             unlimited

(The “unlimited” allocated memory could be replaced by half the RAM size)

Next, and since JACK needs real time privileges, on Slackware a workaround is available by executing the following command:

setcap cap_ipc_lock,cap_sys_nice=ep /usr/bin/jackd

or

setcap cap_ipc_lock,cap_sys_nice=ep /usr/bin/qjackctl

It depends whether you run jackd or qjackctl

Add your normal user to the “audio” group by executing

usermod -G -a audio “yourusename”

 

Adjust your kernel (from the Gentoo wiki:)

* General setup  --->
      Control Group Support --->
            [ ] Group CPU scheduler

* Processor types and features  --->
      Preemption Model (Preemptible Kernel (Low-Latency Desktop))  
      Timer frequency (1000Hz)

Log out and log back in, should work fine.
Links:

Real-time audio workstation on Slackware

Kernel Recompilation

Kernel Recompilation“. Man! what a dreadful name, there’s been a lot of hype surrounding the 3.0 kernel  and as the saying goes “you’re virgin until you compile your first kernel” so all you trekkies out there know what to do now.

I’m using my favorite distro: Slackware 13.37

Why and when do we need to recompile a kernel ?

  • Add new features to the kernel  (ie: Hardware support for a particular device)
  • Security updates and patches
  • upgrade to the latest version

I- Download the kernel source code

From www.kernel.org, it’s the HQ for the latest kernels and upstream fixes, but It’s down for the time being so we’re gonna make our way with a different mirror. I’ve picked up V 3.0.4 but you can choose whatever suits you.

/usr/src/ is the preferred location, however, you can untar and install wherever you want, for other distros like Red Hat, you can directly install in /usr/src/linux)

# cd /usr/src  

#wget http://ftp.ntu.edu.tw/linux/kernel/v3.0/linux-3.0.4.tar.gz            

#tar -xzvf  linux-3.0.4.tar.gz

At this point, we’ve downloaded and uncompressed the source code, the next step is to remove the symbolic link to the old kernel and create a new one pointing to the kernel we’ve just downloaded:

#rm linux

#ln -s linux-3.0.4 linux

II- Configuration:

Since we don’t wanna configure the kernel from scratch we’re gonna copy the old configuration  and then tweak it a bit to meet our requirements :

#cd linux

#cp /boot/config   .config

#make oldconfig

Now, here’s the interesting part; configuration, this can be done in three ways:

  • make menuconfig (command line)
  • make xconfig (X Window based graphical environment)
  • make config (this is a yes/no based process and it’es very tedious, don’t choose unless you’ve lost a bet or something)

Tip: To help identify your hardware to enable the right features when configuring, you can run cat /proc/cpuinfo to retrieve information regarding your processor family, I’ll go with the core 2/newer xeon here . Use the libpci-based command lspci to display information regarding all PCI devices on the system including Network, Graphic Cards, etc.

For the purpose of this guide here, we’ll go on with xconfig, you can add some features like High-Memory support if you have more than 4GB of RAM, KVM support, SCSI device support, preemption model, special drivers etc

After you’re done, save and close the config window.

III- Installation:

If you’re using a 2.4 kernel you might need to build a list of dependencies with make dep, otherwise skip this to the next step:

# make bzImage

This will compile the kernel, and place it as a compressed file under arch/i386/boot then to compile the modules and install them:

#make modules

#make modules_install

This will copy the modules in /lib/modules/ .

Tip: The compilation process might take an important amount of time. Another compilation algorithm is  faster then the one used with “make bzImage” but less effective (it might generate some errors if the kernel is too large), you can give it a try by running make zImage . Another technique is to use make -j<number> bzImage where “number” is the number of your processors, so in my case since i Have two processors I would process make -j2 bzImage , make -j2 modules, make -j2 modules_install

Next, move the recently compiled kernel to the boot directory ( it will be later on loaded into the memory at start up)

#cp arch/i386/boot/bzImage /boot/vmlinuz-3.0.4

If you’re recompiling the same kernel version then don’t forget to add -custom to the EXTRAVERSION (so it will look like this vmlinuz-3.0.4-custom)  this way it won’t interfere with the old kernel.

Copy the System.map (this is an optional step for this file which is used by the kernel to map symbol names to their addresses in  memory.)

#cp System.map /boot/System.map-3.0.4

Delete the link to the old System.map:

#rm /boot/System.map

Make a symbolic link for that specific kernel :

#ln -s /boot/System.map-3.0.4 /boot/System.map

At this point we’re done, still we should make an entry for that new kernel in lilo. Open the file /etc/lilo.conf

you’ll find the old entry, use it as template for the new one for example the old entry looked like this

image = /boot/vmlinuz

      root = /dev/sda2

      label = Linux

      read-only

The new one would look like this

image = /boot/vmlinuz-3.0.4

      root = /dev/sda2

      label = CustomKernel

      read-only

Save and close, to update the bootloader run:

#lilo

 Now reboot into your new kernel and check its version with uname -r. That’s it!

Tip: it’s always safe to keep an entry for the old kernel until you’re sure that the new one is working fine, this way, if anything goes wrong, you can always use the old kernel for recovery.

Follow

Get every new post delivered to your Inbox.

Join 63 other followers

%d bloggers like this: