You are not logged in.

#1 2004-11-20 11:35:21

jochen
Member
From: Germany
Registered: 2004-06-01
Posts: 102

realtime-lsm

Hi,

if you want to run jack as normal user with realtime priority, you need the realtime linux security module.

I did a quick and dirty modification of the kernel 2.6.9 PKGBUILD. It sets some options needed for the realtime module, compiles the kernel and the realtime module.

After installing and booting the kernel you can load the module with an option  specifying the group of users that are allowed to use realtime priority.

modprobe realtime gid=92

now you can start jack with realtime priority as normal user, for example using qjackctl.

# $Id: PKGBUILD,v 1.32 2004/11/02 19:14:36 judd Exp $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=kernel26
pkgver=2.6.9
realtimelsmver=0.1.1
pkgrel=1
pkgdesc="The Linux Kernel and modules (IDE support)"
url="http://www.kernel.org"
backup=('boot/kconfig26')
depends=('module-init-tools')
install=kernel26.install
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$pkgver.tar.bz2 
  config cdburning.patch logo_linux_clut224.ppm 
  http://ck.kolivas.org/patches/2.6/2.6.9/2.6.9-ck2/patches/vm-pages_scanned-active_list.patch 
  http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/patches/release/26-latest-release/acpi-20041015-26-latest-release.diff.bz2 
    http://puzzle.dl.sourceforge.net/sourceforge/realtime-lsm/realtime-lsm-$realtimelsmver.tar.gz 
    )


build() {
  cd $startdir/src/linux-$pkgver
  patch -Np1 -i ../cdburning.patch || return 1
  patch -Np1 -i ../acpi-20041015-26-latest-release.diff || return 1
  # A nasty bug that caused kswapd to get stuck consuming heaps of cpu
  # which was in mainline 2.6.9, fixed by this patch
  patch -Np1 -i ../vm-pages_scanned-active_list.patch || return 1
  # Arch logo!
  cp ../logo_linux_clut224.ppm drivers/video/logo/
  # get rid of the 'i' in i686
  carch=`echo $CARCH | sed 's|i||'`
  cat ../config | sed "s|#CARCH#|$carch|g" >./.config
    
    # some options needed for realtime-lsm
    sed -i 's/# CONFIG_SECURITY is not set/CONFIG_SECURITY=ynCONFIG_SECURITY_CAPABILITIES=mnCONFIG_SECURITY_SELINUX=y/' ./.config

  # build the full kernel version to use in pathnames
  . ./.config
  _kernver="${pkgver}${CONFIG_LOCALVERSION}"
  # load configuration
  yes "" | make config
  # build!
  make clean bzImage modules || return 1
  mkdir -p $startdir/pkg/{lib/modules,boot}
  make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
    
    # build and install realtime-lsm
    cd $startdir/src/realtime-lsm-$realtimelsmver
    make KERNEL_DIR=$startdir/src/linux-$pkgver
    make INSTALL_MOD_PATH=$startdir/pkg modules_install -C $startdir/src/linux-$pkgver SUBDIRS=$PWD||return 1
    cd -
        
  cp System.map $startdir/pkg/boot/System.map26
  cp arch/i386/boot/bzImage $startdir/pkg/boot/vmlinuz26
  install -D -m644 Makefile 
    $startdir/pkg/usr/src/linux-${_kernver}/Makefile
  install -D -m644 .config 
    $startdir/pkg/usr/src/linux-${_kernver}/.config
  install -D -m644 .config $startdir/pkg/boot/kconfig26
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/arch/i386/kernel
  for i in acpi asm-generic asm-i386 config linux math-emu net pcmcia scsi video; do
    cp -a include/$i $startdir/pkg/usr/src/linux-${_kernver}/include/
  done
  # copy files necessary for later builds, like nvidia and vmware
  cp -a scripts $startdir/pkg/usr/src/linux-${_kernver}
  mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/.tmp_versions
  cp arch/i386/Makefile $startdir/pkg/usr/src/linux-${_kernver}/arch/i386/
  cp arch/i386/kernel/asm-offsets.s 
    $startdir/pkg/usr/src/linux-${_kernver}/arch/i386/kernel/
  # copy in Kconfig files
  for i in `find . -name "Kconfig*"`; do 
    mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
    cp $i $startdir/pkg/usr/src/linux-${_kernver}/$i
  done
  cd $startdir/pkg/usr/src/linux-${_kernver}/include && ln -s asm-i386 asm
  chown -R root.root $startdir/pkg/usr/src/linux-${_kernver}
  cd $startdir/pkg/lib/modules/${_kernver} && 
    (rm -f source build; ln -sf /usr/src/linux-${_kernver} build)
}

Offline

#2 2004-11-20 13:46:51

Michel
Member
From: Belgium
Registered: 2004-07-31
Posts: 286

Re: realtime-lsm

Heya,

this is an interesting patch. I'll maybe try it out whne I have time. Mayeb another solution is a Kon Colivas-patch. There is one that when a process request scheduling that needs root access or something it uses a specific scheduling-algorithm. I don't know the exact contents of the patch anymore ... but it could be interesting for this stuff.

Offline

Board footer

Powered by FluxBB