ALSA Setup

From OMAPpedia

(Difference between revisions)
Jump to: navigation, search
(ALSA library: Replaced copying libraries with make install)
(Undo revision 14920 by VikramNarayanan (talk))
 
Line 63: Line 63:
Cross-compile the ALSA library:
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
+
  CC=arm-none-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux
 +
make
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
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
+
  CC=arm-none-linux-gnueabi-gcc ./configure --target=arm-linux --host=i686-linux --disable-python
The above works well for testing command line applications which directly uses alsa-lib calls.  
The above works well for testing command line applications which directly uses alsa-lib calls.  
'''Disclaimer:''' This ''may not'' work for GUI based applications.
'''Disclaimer:''' This ''may not'' work for GUI based applications.
-
After successfully configuring, invoke
+
Now copy these libraries to your target filesystem:
-
make
+
-
make install
+
-
This will install the necessary header files and libraries to your prefix PATH.
+
cp src/.libs/libasound.* /PATH/TO/TARGET/lib/
-
Then you can start compiling a sample application using the libasound that is just compiled.
+
In order to continue with the next section, you will need to also copy the libraries to your arm toolchain path. For example in saslin:
-
  arm-none-linux-gnueabi-gcc -o alsa_test alsa_test.c -lasound
+
  cp src/.libs/libasound.* /data/omapts/linux/arm-tc/arm-2009q1/arm-none-linux-gnueabi/libc/usr/lib/
=== ALSA utilities ===
=== ALSA utilities ===

Latest revision as of 11:54, 8 February 2012

Contents

[edit] 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:

http://tldp.org/HOWTO/Alsa-sound-4.html
http://monespaceperso.org/blog-en/2009/10/29/upgrade-alsa-1-0-21-on-ubuntu-karmic-koala-9-10/

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

[edit] Installing ALSA

[edit] 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

[edit] ncurses

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:

http://ftp.gnu.org/pub/gnu/ncurses/

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:

BUILD_CCFLAGS   = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) -I$(INCDIR) $(BUILD_CPPFLAGS)

and append -D_GNU_SOURCE to it. Like the following:

BUILD_CCFLAGS   = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) -I$(INCDIR) $(BUILD_CPPFLAGS) -D_GNU_SOURCE

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.

[edit] 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:

http://www.alsa-project.org/main/index.php/Download

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.

[edit] 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
make

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

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

Now copy these libraries to your target filesystem:

cp src/.libs/libasound.* /PATH/TO/TARGET/lib/

In order to continue with the next section, you will need to also copy the libraries to your arm toolchain path. For example in saslin:

cp src/.libs/libasound.* /data/omapts/linux/arm-tc/arm-2009q1/arm-none-linux-gnueabi/libc/usr/lib/

[edit] 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
make

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

[edit] Complete filesystem for testing audio

A ready made filesystem with ALSA libraries in-built can be created from http://narcissus.angstrom-distribution.org/

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
Namespaces
Variants
Actions
Navigation
Toolbox