LFS Alsa

From VDR Wiki
Revision as of 12:59, 27 November 2004 by Wirbel (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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


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

The ALSA driver

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 \
make install

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


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
depmod -a

The ALSA library

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

The ALSA utilities

tar jxvf alsa-utils-<VERSION>.tar.bz2
cd alsa-utils-<VERSION>
make install

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.

# 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
  echo "Starting ALSA...    Restoring volumes..."
  loadproc /usr/sbin/alsactl restore
  #echo "                    Loading MIDI font..."
  #loadproc sfxload /path/to/soundfont

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

  $0 stop
  sleep 1
  $0 start

  echo "Usage: $0 {start|stop|restart}"
  exit 1

# 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

The first start

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


[1] http://www.alsa-project.org/download.php ALSA Homepage