old-www/HOWTO/Sound-HOWTO/x320.html

869 lines
21 KiB
HTML

<HTML
><HEAD
><TITLE
>Installation</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="The Linux Sound HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Supported Hardware"
HREF="x96.html"><LINK
REL="NEXT"
TITLE="Applications Supporting Sound"
HREF="x478.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux Sound HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x96.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x478.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN320"
>4. Installation</A
></H1
><P
>Configuring Linux to support sound involves the following steps:</P
><P
>&#13;<P
></P
><OL
TYPE="1"
><LI
><P
>Installing the sound card.</P
></LI
><LI
><P
>Configuring Plug and Play (if applicable).</P
></LI
><LI
><P
>Configuring and building the kernel for sound support.</P
></LI
><LI
><P
>Creating the device files.</P
></LI
><LI
><P
>Booting the Linux kernel and testing the installation.</P
></LI
></OL
>&#13;</P
><P
>Some Linux distributions provide a sound driver configuration utility
that will detect your sound card and set up all of the necessary
configuration files to load the appropriate sound drivers for your
card. Red Hat Linux, for example, provides the <TT
CLASS="LITERAL"
>sndconfig</TT
> utility. If your distribution provides
such a tool I suggest you try using it. If it works for you then you
can skip the rest of the instructions in this section.</P
><P
>If this fails or you want to follow the manual method in order to
better understand what you are doing, then the next sections will
cover each of these steps in detail.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN338"
>4.1. Installing the Sound Card</A
></H2
><P
>Follow the manufacturer's instructions for installing the hardware or
have your dealer perform the installation.</P
><P
>Older sound cards usually have switch or jumper settings
for IRQ, DMA channel, etc; note down the values used. If you are
unsure, use the factory defaults. Try to avoid conflicts with other
devices (e.g. ethernet cards, SCSI host adaptors, serial and parallel
ports) if possible.</P
><P
>Usually you should use the same I/O port, IRQ, and DMA settings that
work under DOS. In some cases though (particularly with PnP cards) you
may need to use different settings to get things to work under Linux.
Some experimentation may be needed.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN343"
>4.2. Configuring ISA Plug and Play</A
></H2
><P
>Some sound cards use the ISA Plug and Play protocol to configure
settings for i/o addresses, interrupts, and DMA channels. If you have
a newer PCI-bus type of sound card, or one of the very old ISA sound
cards that uses fixed settings or jumpers, then you can skip this
section.</P
><P
>The preferred way to configure Plug and Play cards is to use the
isapnp tools which ship with most Linux distributions (or you can
download them from Red Hat's web site <A
HREF="http://www.redhat.com/"
TARGET="_top"
>http://www.redhat.com/</A
>).</P
><P
>First check the documentation for your Linux distribution. It may
already have Plug and Play support set up for you or it may work
slightly differently than described here. If you need to configure it
yourself,the details can be found in the man pages for the isapnp
tools. Briefly the process you would normally follow is:</P
><P
>&#13;<P
></P
><UL
><LI
><P
>Use <TT
CLASS="LITERAL"
>pnpdump</TT
> to capture the possible settings for all
your Plug and Play devices, saving the result to the file
<TT
CLASS="FILENAME"
>/etc/isapnp.conf</TT
>.&#13;</P
></LI
><LI
><P
>Choose settings for the sound card that do not conflict with
any other devices in your system and uncomment the appropriate lines
in <TT
CLASS="FILENAME"
>/etc/isapnp.conf</TT
>. Don't forget to uncomment the
<TT
CLASS="LITERAL"
>(ACT Y)</TT
> command near the end.&#13;</P
></LI
><LI
><P
>Make sure that <TT
CLASS="LITERAL"
>isapnp</TT
> is run when your system boots
up, normally done by one of the startup scripts. Reboot your system or
run <TT
CLASS="LITERAL"
>isapnp</TT
> manually.&#13;</P
></LI
></UL
>&#13;</P
><P
>If for some reason you cannot or do not wish to use the isapnp tools,
there are a couple of other options. If you use the card under
Microsoft Windows 95 or 98, you can use the device manager to set up
the card, then soft boot into Linux using the LOADLIN program. Make
sure Windows and Linux use the same card setup parameters.</P
><P
>If you use the card under DOS, you can use the <TT
CLASS="LITERAL"
>icu</TT
> utility that comes with SoundBlaster16 PnP
cards to configure it under DOS, then soft boot into Linux using the
LOADLIN program. Again, make sure DOS and Linux use the same card
setup parameters.</P
><P
>True ISA PnP support is implemented in the 2.4 and later kernels.
Some of the sound card drivers now support automatically detecting and
configuring the cards without the isapnp tools. Check the
documentation for the card's driver for details.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN367"
>4.3. Configuring the Kernel</A
></H2
><P
>&#13;You need the appropriate device drivers for your sound card to be
present in the kernel. The kernel running on your system may already
include the drivers for your sound card. In most cases the drivers
would have been built as kernel loadable modules. You can check which
drivers are available as modules by looking in the
<TT
CLASS="FILENAME"
>/lib/modules</TT
> directories. For the 2.4.4 kernel,
the sound drivers would normally appear in
<TT
CLASS="FILENAME"
>/lib/modules/2.4.4/kernel/drivers/sound/</TT
>. If you
see the driver(s) for your sound card, you can try using the module
directory and skip recompiling the kernel.</P
><P
>If the sound drivers are not already built, you will need to configure
and build a new kernel. You can either build the sound drivers into
the kernel or build them as kernel loadable modules. In most cases
building as modules is preferred, as it allows you to easily
experiment with loading different drivers if unsure which one to use
and the drivers can be unloaded when not needed, freeing up memory.
Building the drivers into the kernel itself may be desirable if you
are unfamiliar with kernel modules and want a simpler solution.</P
><P
>The <A
HREF="http://www.ibiblio.org/LDP/HOWTO/Kernel-HOWTO.html"
TARGET="_top"
>Linux Kernel HOWTO</A
>
should be consulted for the details of building a kernel. I will just
mention here some issues that are specific to sound cards.</P
><P
>If you have never configured the kernel for sound support before it is
a good idea to read the relevant documentation included with the
kernel sound drivers, particularly information specific to your card
type. The files can be found in the kernel documentation directory,
usually installed in <TT
CLASS="FILENAME"
>/usr/src/linux/Documentation/sound</TT
>.
If this directory is missing you likely either have a very old kernel
version or you have not installed the kernel source code.</P
><P
>Follow the usual procedure for building the kernel. There are
currently three interfaces to the configuration process. A graphical
user interface that runs under X11 can be invoked using <TT
CLASS="LITERAL"
>make
xconfig</TT
>. A menu-based system that only requires text displays is
available as <TT
CLASS="LITERAL"
>make menuconfig</TT
>. The original method, using
<TT
CLASS="LITERAL"
>make config</TT
>, offers a simple text-based interface.</P
><P
>When configuring the kernel there will be many choices for selecting
the type of sound card you have and the driver options to use.
The on-line help within the configuration tool should provide
an explanation of what each option is for. Select the appropriate
options to the best of your knowledge.</P
><P
>After configuring the options you should compile and install the new
kernel as per the Kernel HOWTO.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN383"
>4.4. Creating the Device Files</A
></H2
><P
>For proper operation, device file entries must be created for the
sound devices. These are normally created for you during installation
of your Linux system. A quick check can be made using the command
listed below. If the output is as shown (the date stamp will vary)
then the device files are almost certainly okay.
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% ls -l /dev/dsp
crw-rw-rw- 1 root root 14, 3 Apr 25 1995 /dev/dsp</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>Note that having the right device files there doesn't guarantee
anything on its own. The kernel driver must also be loaded or compiled
in before the devices will work (more on that later).</P
><P
>In rare cases, if you believe the device files are wrong, you can
recreate them. Most Linux distributions have a <TT
CLASS="LITERAL"
>/dev/MAKEDEV</TT
>
script which can be used for this purpose.</P
><P
>Note that if you are using the devfs filesystem support in the 2.4
kernels, the sound device files are actually found in /dev/sound, but
there will be symbolic links to the older devices, such as /dev/dsp.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN391"
>4.5. Booting Linux and Testing the Installation</A
></H2
><P
>You should now be ready to boot the new kernel and test the sound
drivers. Follow your usual procedure for installing and rebooting the
new kernel (keep the old kernel around in case of problems, of
course).</P
><P
>If you are using loadable kernel modules for sound, you will need to
load them using the <TT
CLASS="LITERAL"
>modprobe command</TT
> for
the appropriate drivers, e.g. run the command
<TT
CLASS="LITERAL"
>modprobe sb</TT
> for a SoundBlaster card.&#13;</P
><P
>After booting, or loading the kernel modules, check for a message such
as the following using the <TT
CLASS="LITERAL"
>dmesg</TT
> command:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
sb: Creative SB AWE64 PnP detected
sb: ISAPnP reports 'Creative SB AWE64 PnP' at i/o 0x220, irq 5, dma 1, 5
SB 4.16 detected OK (220)
sb: 1 Soundblaster PnP card(s) found.
Crystal 4280/46xx + AC97 Audio, version 1.22.32, 10:28:40 Apr 28 2001
cs46xx: Card found at 0xf4100000 and 0xf4000000, IRQ 11
cs46xx: Thinkpad 600X/A20/T20 (1014:0153) at 0xf4100000/0xf4000000, IRQ 11
ac97_codec: AC97 Audio codec, id: 0x4352:0x5914 (Cirrus Logic CS4297A rev B)</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>The message should indicate that a sound card was found and match your
sound card type and jumper settings (if any). The driver may also
display some error messages and warnings if you have incorrectly
configured the driver or chosen the wrong one.</P
><P
>Previous versions of this HOWTO suggested checking the output of
/dev/sndstat. This is no longer supported in the 2.4 and later
kernels.</P
><P
>Now you should be ready to play a simple sound file. Get hold of a
sound sample file, and send it to the sound device as a basic check of
sound output, e.g.
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% cat endoftheworld &#62;/dev/dsp
% cat crash.au &#62;/dev/audio</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>(Make sure you don't omit the "&#62;" in the commands above).</P
><P
>Note that, in general, using <TT
CLASS="LITERAL"
>cat</TT
> is not the proper way to
play audio files, it's just a quick check. You'll want to get a proper
sound player program (described later) that will do a better job.</P
><P
>If the above commands return "I/O error", you should look at the
end of the kernel messages listed using the "dmesg" command. It's
likely that an error message is printed there. Very often the message
is "Sound: DMA (output) timed out - IRQ/DRQ config error?". The above
message means that the driver didn't get the expected interrupt from
the sound card. In most cases it means that the IRQ or the DMA channel
configured to the driver doesn't work. The best way to get it working
is to try with all possible DMAs and IRQs supported by the device.</P
><P
>Another possible reason is that the device is not compatible with the
device the driver is configured for. This is almost certainly the case
when a supposedly "SoundBlaster (Pro/16) compatible" sound card
doesn't work with the SoundBlaster driver. In this case you should try
to find out the device your sound card is compatible with (by posting
to the comp.os.linux.hardware newsgroup, for example).</P
><P
>Some sample sound files can be obtained from
<A
HREF="ftp://tsx-11.mit.edu/pub/linux/packages/sound/snd-data-0.1.tar.Z"
TARGET="_top"
>ftp://tsx-11.mit.edu/pub/linux/packages/sound/snd-data-0.1.tar.Z&#62;</A
></P
><P
>Now you can verify sound recording. If you have sound input
capability, you can do a quick test of this using commands such as the
following:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
># record 4 seconds of audio from microphone
% dd bs=8k count=4 &#60;/dev/audio &#62;sample.au
4+0 records in
4+0 records out
# play back sound
% cat sample.au &#62;/dev/audio</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>Obviously for this to work you need a microphone connected to the
sound card and you should speak into it. You may also need to obtain a
mixer program to set the microphone as the input device and adjust the
recording gain level.</P
><P
>If these tests pass, you can be reasonably confident that the sound
D/A and A/D hardware and software are working. If you experience
problems, refer to the next section of this document.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN415"
>4.6. Troubleshooting</A
></H2
><P
>If you still encounter problems after following the instructions in
the HOWTO, here are some things to check. The checks are listed in
increasing order of complexity. If a check fails, solve the problem
before moving to the next stage.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN418"
>4.6.1. Step 1: Make sure you are really running the kernel you compiled.</A
></H3
><P
>You can check the date stamp on the kernel to see if you are running
the one that you compiled with sound support. You can do this with the
<TT
CLASS="LITERAL"
>uname</TT
> command:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% uname -a
Linux fizzbin 2.2.4 #1 Tue Mar 23 11:23:21 EST 1999 i586 unknown</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>or by displaying the file <TT
CLASS="FILENAME"
>/proc/version</TT
>:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% cat /proc/version
Linux version 2.2.4 (root@fizzbin) (gcc version 2.7.2.3) #1 Tue Mar 23 11:23:21 EST 1999</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>If the date stamp doesn't seem to match when you compiled the kernel,
then you are running an old kernel. Did you really reboot? If you use
LILO, did you re-install it (typically by running
<TT
CLASS="FILENAME"
>lilo</TT
>)? If booting from floppy, did you create a
new boot floppy and use it when booting?</P
><P
>If you are using kernel loadable modules, use the lsmod command to
make sure the modules are loaded:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% /sbin/lsmod
Module Size Used by
sb 6320 0 (unused)
sb_lib 35040 0 [sb]
uart401 6544 0 [sb_lib]
sound 59888 0 [sb_lib uart401]
soundcore 4144 5 [sb_lib sound]
isa-pnp 28304 0 [sb]
...</PRE
></FONT
></TD
></TR
></TABLE
></P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN430"
>4.6.2. Step 2: Make sure the kernel sound drivers are compiled in.</A
></H3
><P
>The easiest way to do this is to check the output of
<TT
CLASS="LITERAL"
>dev/sndstat</TT
> as described earlier. If the output is not as
expected then something went wrong with the kernel configuration or
build. Start the installation process again, beginning with
configuration and building of the kernel.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN434"
>4.6.3. Step 3: Did the kernel detect your sound card during booting?</A
></H3
><P
>Make sure that the sound card was detected when the kernel booted. You
should have seen a message on bootup. If the messages scrolled off the
screen, you can usually recall them using the <TT
CLASS="LITERAL"
>dmesg</TT
> command:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% dmesg</PRE
></FONT
></TD
></TR
></TABLE
>&#13;</P
><P
>or
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>% tail /var/log/messages</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>If your sound card was not found then something is wrong. Make sure it
really is installed. If the sound card works under DOS then you can be
reasonably confident that the hardware is working, so it is likely a
problem with the kernel configuration. Either you configured your
sound card as the wrong type or wrong parameters, or your sound card
is not compatible with any of the Linux kernel sound card drivers.</P
><P
>One possibility is that your sound card is one of the
<EM
>compatible</EM
> type that requires initialization by the DOS
driver. Try booting DOS and loading the vendor supplied sound card
driver. Then soft boot Linux using <TT
CLASS="LITERAL"
>Control-Alt-Delete</TT
>. Make
sure that card I/O address, DMA, and IRQ settings for Linux are the
same as used under DOS. Read the <TT
CLASS="FILENAME"
>Readme.cards</TT
> file from
the sound driver source distribution for hints on configuring your
card type.</P
><P
>If your sound card is not listed in this document, it is possible that
the Linux drivers do not support it. You can check with some of the
references listed at the end of this document for assistance.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN447"
>4.6.4. Step 4: Can you read data from the dsp device?</A
></H3
><P
>Try reading from the <TT
CLASS="FILENAME"
>/dev/audio</TT
> device using the <TT
CLASS="LITERAL"
>dd</TT
>
command listed earlier in this document. The command should run
without errors.</P
><P
>If it doesn't work, then chances are that the problem is an IRQ or DMA
conflict or some kind of hardware incompatibility (the device is not
supported by Linux or the driver is configured for a wrong device).</P
><P
>A remote possibility is broken hardware. Try testing the sound card
under DOS, if possible, to eliminate that as a possibility.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN454"
>4.6.5. When All Else Fails</A
></H3
><P
>If you still have problems, here are some final suggestions for things
to try:</P
><P
>&#13;<P
></P
><UL
><LI
><P
>carefully re-read this HOWTO document</P
></LI
><LI
><P
>read the references listed at the end of this document
and the relevant kernel source documentation files</P
></LI
><LI
><P
>post a question to one of the <TT
CLASS="LITERAL"
>comp.os.linux</TT
> or other
Usenet newsgroups (comp.os.linux.hardware is a good choice; because of
the high level of traffic in these groups it helps to put the string
"sound" in the subject header for the article so the right experts
will see it)</P
></LI
><LI
><P
>Using a web/Usenet search engine with an intelligently selected
search criteria can give very good results quickly. One such choice is
<A
HREF="http://www.google.com"
TARGET="_top"
>http://www.google.com</A
></P
></LI
><LI
><P
>try using the latest Linux kernel (but only as a last resort,
the latest development kernels can be unstable)</P
></LI
><LI
><P
>send mail to the author of the sound driver</P
></LI
><LI
><P
>send mail to the author of the Sound HOWTO</P
></LI
><LI
><P
>fire up emacs and type <TT
CLASS="LITERAL"
>Esc-x doctor</TT
> :-)</P
></LI
></UL
>&#13;</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x96.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x478.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Supported Hardware</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Applications Supporting Sound</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>