LFS Alsa

From VDR Wiki

Jump to: navigation, search

Contents

[edit] Description

The ALSA sound driver is the standard sound driver in all modern distributions and in the kernel since 2.6.

[edit] Installation

The installation of ALSA consists of four steps. If only the driver itself is needed, some steps can be omitted.

[edit] The ALSA driver

cd $SOURCEDIR
tar xvfj alsa-driver-<VERSION>.tar.bz2
cd alsa-driver-<VERSION>
./configure \
    --with-moddir=/lib/modules/`uname -r`/kernel/drivers/sound \
    --with-kernel=/lib/modules/`uname -r`/build \
    --with-sequencer=yes \
    --with-oss=yes \
    --with-isapnp=no \
    --with-cards=all
make
make install

If DevFS is not used on the system, the devices have to be created with

./snddevices

Some lines have to be added to the /etc/modules.conf with

cat >> /etc/modules.conf << "EOF"
alias char-major-14 soundcore
alias char-major-116 snd
alias snd-card-0 snd-[soundcard-name]
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-midi
EOF
depmod -a

[edit] The ALSA library

cd $SOURCEDIR
tar xvfj alsa-lib-<VERSION>.tar.bz2
cd alsa-lib-<VERSION>
./configure --enable-static
make
make install

[edit] The ALSA utilities

cd $SOURCEDIR
tar jxvf alsa-utils-<VERSION>.tar.bz2
cd alsa-utils-<VERSION>
./configure
make
make install

[edit] The ALSA boot scripts

ALSA can be started throught start scripts of the system

The following script /etc/rc.d/init.d/alsa is part of the BLFS (Beyond Linux From Scratch). One can use the whole script, but that is unnecessary bloat for a VDR system.

#!/bin/sh
# Begin $rc_base/init.d/alsa

# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
# ALSA specific parts by Mark Hymers - markh@linuxfromscratch.org
# Stores mixer settings in the default location: /etc/asound.state

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
 start)
  echo "Starting ALSA...    Restoring volumes..."
  loadproc /usr/sbin/alsactl restore
  #echo "                    Loading MIDI font..."
  #loadproc sfxload /path/to/soundfont
  ;;

 stop)
  echo "Stopping ALSA...    Saving volumes..."
  loadproc /usr/sbin/alsactl store
  #echo "                    Removing MIDI font..."
  #loadproc sfxload -i
  ;;

 restart)
  $0 stop
  sleep 1
  $0 start
  ;;

 *)
  echo "Usage: $0 {start|stop|restart}"
  exit 1
  ;;
esac

# End $rc_base/init.d/alsa

The start and stop links for the runlevels has to be set, links for unneeded runlevels can be omitted

ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc0.d/K35alsa
ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc1.d/K35alsa
ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc2.d/S40alsa
ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc3.d/S40alsa
ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc4.d/S40alsa
ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc5.d/S40alsa
ln -sf  /etc/rc.d/init.d/alsa /etc/rc.d/rc6.d/K35alsa

[edit] The first start

touch /etc/asound.state
/etc/rc.d/init.d/alsa start
amixer Line 28 on
amixer CD 28 on
alsactl store

[edit] Links

[1] http://www.alsa-project.org/download.php ALSA Homepage
Personal tools
Participate
In other languages