---------------------------------------------------------------------------------------------------------------------------------
目标版:TQ2440,天嵌s3c2440开发板
目标版系统:Linux2.6.30.4,已经整合了alsa驱动。
交叉编译器版本:arm-linux-gcc 4.3.3
开发平台:ubuntu10.04
alsa-lib版本:1.0.22
---------------------------------------------------------------------------------------------------------------------------------
准备工作:
(1)下载alsa-lib和alsa-utils
http://www.alsa-project.org/main/index.php/Download
(2)建立相关目录
---------alsa
|-------libs (存放源码)
|-------output (输出文件)
|----------arm-linux
---------------------------------------------------------------------------------------------------------------------------------
编译alsa-lib
(1)解压alsa-lib-1.0.22.tar.bz2
(2)进入alsa-lib-1.0.22目录
./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-static --enable-shared --disable-python --with-configdir=/usr/local/share --with-plugindir=/usr/local/lib/alsa_lib
(3)make
(4)make install
----------------------------------------------------------------------------------------------------------------------------------
编译alsa-utils
(1)同上
./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-static --enable-shared --with-configdir=/usr/local/share CFLAGS="-I$PWD/../../output/arm-linux/include" LDFLAGS="-L$PWD/../../output/arm-linux/lib -lasound " --disable-alsamixer --disable-xmlto
(2)make
(3)make install
------------------------------------------------------------------------------------------------------------------------------------
将库和可执行文件拷贝到开发板上:
(1)将/output/arm-linux/lib下libiconv.so.2.5.0,libasound.so.2.0.0及其软链接拷贝到目标版上的/lib目录下。将/usr/local/share目录下的文件拷贝到目标板上同样的目录下。
(2)拷贝/output/arm-linux/bin/目录下的aplay到目标版上,同时可以拷贝一个wav测试文件/output/arm-linux/share/sounds/alsa/Front_Center.wav到目标板。
(3)在目标板上,ls -l /dev/snd 看看系统是否已经有了设备节点,如果没有,手动建立。
mkdir /dev/snd mknod /dev/snd/controlC0 c 116 0 mknod /dev/snd/hwC0D0 c 116 4 mknod /dev/snd/pcmC0D0c c 116 24 mknod /dev/snd/pcmC0D0p c 116 16 mknod /dev/snd/seq c 116 1 mknod /dev/snd/timer c 116 33
在TQ2440板子上,只需建立pcmC0D0c,pcmC0D0p,timer三个节点即可。
(4)播放声音文件
./aplay Front_Center.wav
------------------------------------------------------------------------------------------------------------------------------------
参考文章
http://cgy136652.blog.163.com/blog/static/36168728201027105324523/
http://blog.csdn.net/reille/archive/2010/08/28/5845913.aspx
http://blog.chinaunix.net/u3/114374/showart_2278278.html