October 23, 2011 · Android Technical Notes

Using ALSA audio drivers in Android

While working on a port of the Gingerbread (2.3.7) userland of Android for the N810, I had to figure out how to add support for an audio chip with a working ALSA driver in an Android build. The information was out there but it took me a while to figure everything out, so here’s a brief summary of the process.

First, of course, ALSA drivers for the chip must be enabled in the kernel; to check whether they are working, see if /dev/snd is properly populated. If not, check if the driver has been compiled into the kernel and not as a module.

There are three libraries that act as intermediate layers between an ALSA sound device and the Android userland. Due to the recent relocation of the Android source tree, I used alternative URLs for the three libraries. The code (shamelessly stolen and modified from this Armadeus Wiki page) is as follows, assuming $ANDROID_SOURCE points to the root of the checked-out Android source tree:

cd $ANDROID_SOURCE/external
git clone git://git.omapzoom.org/platform/external/alsa-lib.git
git clone git://git.omapzoom.org/platform/external/alsa-utils.git

cd $ANDROID_SOURCE/hardware
git clone git://git.omapzoom.org/platform/hardware/alsa_sound.git

However, a bogus commit to the last library in platform/hardware/alsa_sound breaks the build (as explained in this thread), hence:

cd $ANDROID_SOURCE/hardware/alsa_sound
git checkout ece3f1b6f1e6a67d02e42490eca6c7de62220b57

Then, modify the BoardConfig.mk of your build to include:


And that should do the trick.

  • LinkedIn
  • Tumblr
  • Reddit
  • Pinterest
  • Pocket