整天捣鼓嵌入式,兼职搞搞iOS,这么折腾为了啥?都是为了俺的娃!
分类: LINUX
2010-07-21 21:25:37
-----------------------------------------------------------------------
良好的习惯是成功的开始。
EMail:cblock@126.com
QQ:57004294
-----------------------------------------------------------------------
Title:alsa体系移植
Author:FergusZeng
Date:20100713
-----------------------------------------------------------------------
tool version:
arm-linux-gcc 3.4.1
Fedora8
AT91SAM9260 ARM9开发板
software version:alsa 1.0.22
comment:参照蓝色IT工坊(bluedrum.cublog.cn)文档移植整理
-----------------------------------------------------------------------
1.首先建立移植目录树
结构如下:
---alsa
|------libs (存放库源码目录)
|------output (存放对应平台移植后的程序)
| |---arm-linux
| |---X86
|------docs (存放移植文档)
|------project (存放其他工程文件,如source insight工程)
-----------------------------------------------------------------------
2.解压所需库源码包到libs下。
所需三个源码包:
alsa-lib-1.0.22.tar.bz2 alsa库
alsa-utils-1.0.22.tar.bz2 alsa工具库,包括各类测试工具
libiconv-1.13.1.tar.gz 该库alsa需要,若原系统有,则可以不移植
结果如下
#tar zxvf ***.tar.gz
#ls
alsa-lib-1.0.22 alsa-utils-1.0.22 libiconv-1.13.1
alsa-lib-1.0.22.tar.bz2 alsa-utils-1.0.22.tar.bz2 libiconv-1.13.1.tar.gz
-----------------------------------------------------------------------
3.开始编译库
注意:每次configure之前请运行./configure --help
----------------------------------------
a.)移植alsa-lib
#./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
#make
#make install
b.)移植libiconv
#./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-static --enable-shared
#make
#make intall
c.)移植alsa-utils
#./configure --host=arm-linux --prefix=$PWD/../../output/arm-linux --enable-static --enable-shared --with-configdir=/usr/local/share --with-libiconv -
prefix=$PWD/../../output/arm-linux CFLAGS="-I$PWD/../../output/arm-linux/include" LDFLAGS="-L$PWD/../../output/arm-linux/lib -lasound -liconv" --disable-
alsamixer --disable-xmlto
#make
#make install
-----------------------------------------------------------------------
4.编译完成后将配置文件及可执行文件安装到目标板文件系统
------------------------------------------------
a.)将/output/arm-linux/lib下libiconv.so.2.5.0,libasound.so.2.0.0
及其链接文件copy到根文件系统libs目录下(/libs)
b.)将/output/arm-linux/config下的文件放到configdir目录下(/usr/local/share)
-----------------------------------------------------------------------
5.测试:
拷贝/output/arm-linux/bin下aplay,arecord测试程序
./aplay ***.wav
如果不能运行,请检查:
a.)是否缺少动态链接库,并指定正确路径.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:(*.so路径)
b.)设备驱动是否正常
c.)arm-linux-gcc 版本是否与你的系统兼容.
d.)可执行文件是否损坏,如strip工具是否不是用的arm-linux-strip.
e.)编译器用错成X86平台的,可用#file 确认一下.
-----------------------------------------------------------------------
6.附加技巧
为方便交叉编译器编译alsa应用程序,可将/output/arm-linux/lib下的库文件及/output/arm-linux/include下头文件复制到交叉编译器对应目录下(/usr/local/arm/3.4.1/arm-
linux/),这样在编译时可以不用指定-I和-L等参数
chinaunix网友2010-08-31 15:03:23
你好,我在编译alsa-lib时,总是不能编译出.so文件出来。。 ./configure时,有信息提示如下: checking if libtool supports shared libraries... no checking whether to build shared libraries... no checking whether to build static libraries... yes configure: creating libtool appending configuration tag "CXX" to libtool checking for ld used by /usr/local/arm-uclibc/bin/arm-uclibc-gcc... /usr/local/arm- uclibc/arm-linux/bin/ld checking if the linker (/usr/local/arm-uclibc/arm-linux/bin/ld) is GNU ld... yes 请问下这是什么原因呢?./conf