1.编译环境Doker
2.按照这个介绍搭建自己交叉编译环境
3.源码路径下载路径:
https://www.alsa-project.org/wiki/Main_Page

我这边下载的是
alsa-lib-1.2.6.1
alsa-utils-1.2.6
4.解压,然后交叉编译
5.先编译alsa-lib-1.2.6.1
如下指令:
root@6ad7969cbf4e:/home/3.l-tools/alsa-lib-1.2.6.1# ./configure --prefix=/home/3.l-tools/alsa-lib-1.2.6.1 --host=arm-linux-musleabi
。。。。
。。。。
root@6ad7969cbf4e:/home/3.l-tools/alsa-lib-1.2.6.1# make -j8
。。。
。。。
make install DESTDIR=/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang(我这边自己再创建了一个编译产物安装目录 绝对路径)

如下编译alsa-lib编译产物:
root@6ad7969cbf4e:/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home# cd 3.l-tools/alsa-lib-1.2.6.1/
root@6ad7969cbf4e:/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home/3.l-tools/alsa-lib-1.2.6.1# ls -l
total 16
drwxr-xr-x 2 root root 4096 Feb 26 10:14 bin
drwxr-xr-x 4 root root 4096 Feb 26 10:14 include
drwxr-xr-x 3 root root 4096 Feb 26 10:14 lib
drwxr-xr-x 4 root root 4096 Feb 26 10:14 share
root@6ad7969cbf4e:/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home/3.l-tools/alsa-lib-1.2.6.1# cd bin/

再编译alsa-utils-1.2.6
root@6ad7969cbf4e:/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6# ./configure --host=arm-linux-musleabi --prefix=/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6 --with-alsa-inc-prefix=/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home/3.l-tools/alsa-lib-1.2.6.1/include --with-alsa-prefix=/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home/3.l-tools/alsa-lib-1.2.6.1/lib --disable-alsamixer --disable-xmlto
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for arm-linux-musleabi-strip… arm-linux-musleabi-strip
checking for a thread-safe mkdir -p… /usr/bin/mkdir -p
checking for gawk… no
checking for mawk… mawk


备注:
这里需要注意:
–with-alsa-inc-prefix=/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home/3.l-tools/alsa-lib-1.2.6.1/include --with-alsa-prefix=/home/3.l-tools/alsa-lib-1.2.6.1/alsalibyang/home/3.l-tools/alsa-lib-1.2.6.1/lib
==》这两个路径需要指向刚才alsa-lib编译后的产物路径否则会找不到报错
(如:checking for snd_ctl_open in -lasound… no
configure: error: No linkable libasound was found.
错误)

root@6ad7969cbf4e:/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6# make -j8
Making all in include
。。。。
root@6ad7969cbf4e:/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6# make install DESTDIR=/home/alsa-util (安装编译产物指定路径)
Making install in include
。。。。
。。。。

alsa-util编译后的测试工具:
root@6ad7969cbf4e:/home/alsa-util# cd home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6/
root@6ad7969cbf4e:/home/alsa-util/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6# ls -l
total 12
drwxr-xr-x 2 root root 4096 Feb 26 10:30 bin
drwxr-xr-x 2 root root 4096 Feb 26 10:30 sbin
drwxr-xr-x 6 root root 4096 Feb 26 10:30 share
root@6ad7969cbf4e:/home/alsa-util/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6# cd bin/
root@6ad7969cbf4e:/home/alsa-util/home/3.l-tools/alsa-utils-1.2.6/alsa-utils-1.2.6/bin# ls -l
total 1616
-rwxr-xr-x 1 root root 34600 Feb 26 10:30 aconnect
-rwxr-xr-x 1 root root 122384 Feb 26 10:30 alsabat
-rwxr-xr-x 1 root root 204556 Feb 26 10:30 alsaloop
-rwxr-xr-x 1 root root 178312 Feb 26 10:30 alsatplg
-rwxr-xr-x 1 root root 66116 Feb 26 10:30 alsaucm
-rwxr-xr-x 1 root root 55760 Feb 26 10:30 amidi
-rwxr-xr-x 1 root root 137508 Feb 26 10:30 amixer
-rwxr-xr-x 1 root root 208428 Feb 26 10:30 aplay
-rwxr-xr-x 1 root root 58576 Feb 26 10:30 aplaymidi
lrwxrwxrwx 1 root root 5 Feb 26 10:30 arecord -> aplay
-rwxr-xr-x 1 root root 65524 Feb 26 10:30 arecordmidi
-rwxr-xr-x 1 root root 33336 Feb 26 10:30 aseqdump
-rwxr-xr-x 1 root root 41896 Feb 26 10:30 aseqnet
-rwxr-xr-x 1 root root 307116 Feb 26 10:30 axfer
-rwxr-xr-x 1 root root 32312 Feb 26 10:30 iecset
-rwxr-xr-x 1 root root 81940 Feb 26 10:30 speaker-test

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐