ALSA Setup

From OMAPpedia

Revision as of 11:46, 8 February 2012 by VikramNarayanan (Talk | contribs)
Jump to: navigation, search


Useful links

The following tutorial is meant for ARM architecture. If you want to update ALSA in your host computer, refer to the following tutorials:

REMEMBER: Binaries created following these steps are meant for ARM architecture. Be carefull not to override the binaries on your host computer.

Installing ALSA

Preparing the install

To be able to compile ALSA driver, library and utilities, you will need xmlto utility and the ncurses libraries compiled for ARM.

To get xmlto on a Ubuntu machine:

sudo apt-get install xmlto


For the ncurses libraries, you will need to get the sources and compile them for ARM. You can get the sources from the following link:

We need to configure the source for cross-compiling:

tar -jxvf ncurses.tar.gz
cd ncurses-5.7/
CC=arm-none-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux --enable-widec --with-shared --prefix=/PATH/TO/ARM/TOOLCHAIN/arm-none-linux-gnueabi/libc/usr

The --enable-widec in the configuration a "w" will be appended to the library names indicating support for wide-characters. This is needed to compile the ALSA libraries. The path in --prefix option is where the resulting libraries will be installed.

Now, in the latest version of ncurses (5.7), there is an issue when you try to cross-compile with support for wide-characters. This issue should be solved by next version. For now, look for the following line in ncurses/Makefile:


and append -D_GNU_SOURCE to it. Like the following:


Now use:

make HOSTCC=gcc CXX=arm-none-linux-gnueabi-c++

The HOSTCC option is needed because some tools need to be compiled for the host machine.

And finally:

make install

This will install the libraries and headers inside the folder specified earlier in the --prefix option.

Build ALSA

Now we need to get the ALSA sources. There are several ways to get this sources, the easiest of which is to download them directly from:

We need to get the alsa-lib and alsa-utils. Optionally we can get alsa-plugins and alsa-tools but that won't be covered here.

Make sure all have the same version. In this case we will be using version 1.0.23.

ALSA library

alsa-lib is a userspace library that provides a level of abstraction over the /dev interfaces provided by the kernel modules.

Cross-compile the ALSA library:

CC=arm-none-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux --prefix=/PATH/TO/ARM/TOOLCHAIN/arm-none-linux-gnueabi/libc/usr

alsa-lib has a dependency on libpython and crosscompiling that is not an easier task. So, if you are compiling alsa-lib for testing purposes, you can very well disable python deps using

CC=arm-none-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux --disable-python --prefix=/PATH/TO/ARM/TOOLCHAIN/arm-none-linux-gnueabi/libc/usr

The above works well for testing command line applications which directly uses alsa-lib calls. Disclaimer: This may not work for GUI based applications.

After successfully configuring, invoke

make install

This will install the necessary header files and libraries to your prefix PATH.

Then you can start compiling a sample application using the libasound that is just compiled.

arm-none-linux-gnueabi-gcc -o alsa_test alsa_test.c -lasound

ALSA utilities

alsa-utils correspond to the utilities useful to test or configure audio in our target board. These utilities are necessary for our testcases.

After compiling the library, you should be able to build the utilities (aplay, amixer, etc.)

CC=arm-none-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux

You can now copy any binary like aplay, or amixer to you target filesystem and test audio.

Complete filesystem for testing audio

A ready made filesystem with ALSA libraries in-built can be created from

After downloading and extracting the filesytem, /etc/inittab should be edited to reflect the correct serial port.

At the time of this writing

S:2345:respawn:/sbin/getty 115200 ttyO0

for OMAP3.

After booting the kernel, login as "root" to run ALSA commands.

Also while building the kernel the following macros should be set to y.

-> Device Drivers
│ -> Sound card support
  │ -> Advanced Linux Sound Architecture
    │ -> ALSA for SoC audio support
      | -> SoC Audio for the Texas Instruments OMAP chips
      | -> SoC Audio support for Texas Instruments SDP3430
Personal tools