LFS Alsa: Difference between revisions

From VDR Wiki
Jump to navigation Jump to search
(initial)
 
(singular => plural)
 
Line 21: Line 21:
</pre>
</pre>


If DevFS is not used on the system, the devices has to be created with
If DevFS is not used on the system, the devices have to be created with
<pre>
<pre>
./snddevices
./snddevices

Latest revision as of 10:59, 27 November 2004

Description

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

Installation

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

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

The ALSA library

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

The ALSA utilities

cd $SOURCEDIR
tar jxvf alsa-utils-<VERSION>.tar.bz2
cd alsa-utils-<VERSION>
./configure
make
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.

#!/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

The first start

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

Links

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