当前位置:网站首页>arm架构移植alsa-lib和alsa-utils一路畅通
arm架构移植alsa-lib和alsa-utils一路畅通
2022-07-25 13:04:00 【江麟】
目录
引言
- 基本上移植alsa-lib和alsa-utils的移植问题在这篇博文都能找到,如果没有在正文找到,请看目录中的疑难杂症
- 首先本文默认你的根文件系统是由网络引导的
获取源码
下载地址为https://www.alsa-project.org/main/index.php/Main_Page
最新版本是1.2.7.2,本文使用的版本是1.2.2
编译试错
- 注:这里并没有成功,只是慢慢复现我昨天遇到的坑,告诉读者我是怎么解决这些错误的,如果想一次成功请掠过编译试错这一步
新建文件夹(默认在刚才下载好的源码目录)
首先需要新建一些文件夹,以提供我们编译结果目录。
sudo mkdir /usr/share/arm-alsa
mkdir alsa-lib
mkdir alsa-utils
解压压缩包(默认在刚才下载好的源码目录)
tar -xvjf alsa-lib-1.2.2.tar.bz2
tar -xvjf alsa-utils-1.2.2.tar.bz2
编译alsa-lib
cd alsa-lib-1.2.2/
/* 注意这里的alsa-lib文件夹是我们新建文件夹那一步做的 */
./configure --host=arm-linux-gnueabihf --prefix=源码存放目录/alsa-lib --with-configdir=/usr/share/arm-alsa
make
sudo make install

如果出现这个错误,是因为 sudo 会切换到 root 用户下,但是此
时 root 用户下的环境变量中没有交叉编译器路径,因此会提示找不到“arm-linux-gnueabihf-gcc”,从而导致 libatopology.la 编译失败,按如下方法操作
sudo -s //切换到 root 用户
source /etc/profile //执行/etc/profile
make install //安装,此时已经工作在 root 下,因此不需要加“sudo”
su zuozhongkai //编译完成以后回原来的用户
编译alsa-utils
cd alsa-utils-1.2.2/
/*
--prefix=指定alsa-utils输出文件在哪个文件夹
--with-alsa-inc-prefix=由于alsa-utils依赖alsa-lib,所以指定alsa-lib的头文件目录
--with-alsa-prefix=由于alsa-utils依赖alsa-lib,所以指定alsa-lib的库目录
*/
./configure --host=arm-linux-gnueabihf --prefix=源码存放目录/alsa-utils --with-alsa-inc-prefix=源码存放目录/alsa-lib/include/ --with-alsa-prefix=源码存放目录/alsa-lib/lib/ --disable-alsamixer --disable-xmlto
make
sudo make install
复制alsa-lab和alsa-utils到开发板根目录
复制alsa-lab
cd alsa-lib //进入 alsa-lib
sudo cp lib/* 根文件系统目录/rootfs/lib/ -af
cd /usr/share/arm-alsa //进入 arm-alsa 目录,拷贝配置文件
mkdir 根文件系统目录/rootfs/usr/share/arm-alsa/
sudo cp * 根文件系统目录/rootfs/usr/share/arm-alsa/ -raf
复制alsa-utils
cd alsa-utils
sudo cp bin/* 根文件系统目录/rootfs/bin/ -rfa
sudo cp sbin/*根文件系统目录//rootfs/sbin/ -rfa
sudo cp share/* 根文件系统目录//rootfs/usr/share/ -rfa
打开开发板根文件系统中的/etc/profile 文件,加入以下内容
export ALSA_CONFIG_PATH=/usr/share/arm-alsa/alsa.conf
在开发板上运行amixer工具测试
amixer --help

看样子是在32位系统上运行了64位的程序,且架构不兼容,我们去查看一下我们编译出来的文件属性
cd 源码存放目录/alsa-utils/bin
file amixer
这个文件是给x86架构编译的?
在ubuntu运行试一下,果然
./amixer --help

进入makefile看看交叉编译链是否配置成功
cd alsa-utils-1.2.2/
vi Makefile
看起来没问题啊,host指定正常
那我们想一下,我们执行安装的时候是用的sudo make install,因为生成文件有一些是需要在被系统保护的目录生成的,所以必须加sudo,sudo是管理员模式下运行的,那么我们管理员模式是否指定了交叉编译链目录?测试一下
编译成功
sudo -s
arm-linux-gnueabihf-gcc -v
果然没有,那么我们添加一下目录
export PATH=$PATH:交叉编译链目录/bin
清除刚才编译的文件目录
rm -rf alsa-lib/*
rm -rf alsa-utils/*
rm -rf /usr/share/arm-alsa/*
重新编译alsa-lib
cd alsa-lib-1.2.2/
make clean
/* 注意这里的alsa-lib文件夹是我们新建文件夹那一步做的 */
./configure --host=arm-linux-gnueabihf --prefix=源码存放目录/alsa-lib --with-configdir=/usr/share/arm-alsa
make
make install
随便检查一个输出文件,果然,arm架构,32位了
编译alsa-utils
cd alsa-utils-1.2.2/
make clean
/*
--prefix=指定alsa-utils输出文件在哪个文件夹
--with-alsa-inc-prefix=由于alsa-utils依赖alsa-lib,所以指定alsa-lib的头文件目录
--with-alsa-prefix=由于alsa-utils依赖alsa-lib,所以指定alsa-lib的库目录
*/
./configure --host=arm-linux-gnueabihf --prefix=源码存放目录/alsa-utils --with-alsa-inc-prefix=源码存放目录/alsa-lib/include/ --with-alsa-prefix=源码存放目录/alsa-lib/lib/ --disable-alsamixer --disable-xmlto
make
make install

按照复制alsa-lab和alsa-utils到开发板根目录这一步复制文件,即可成功。
疑难杂症
关于configure: error: No linkable libasound was found
1.如果出现以上错误,首先检查目录、命令是否无误
2.alsa-lib和alsa-utils不是同一个用户下编译的,这个坑昨天晚上我踩了,如果lib编译出来是x86运行的,那么alsa-utils配置就没问题,如果lib编译出来的是arm架构运行,那么alsa-utils配置就会出这个错误,保持在同一用户编译,由于可能输出文件夹需要超级用户模式,所以保持在root下编译,并且在root用户下配置一下交叉编译链,具体参考目录中的编译成功这一小节
关于单板运行不成功
/bin/amixer: line 1:ELF: not found
/bin/amixer: line 2: H
: not found
/bin/amixer: line 3: P: not found
/bin/amixer: line 4: syntax error: unexpected ")"
如果报了这个错误,只有一种可能,你编译出来的文件不是单板使用的而是x86使用的,在ubuntu上找到这个文件,file一下,目录是alsa-utils编译目标目录/bin/amixer,你一定是如下的:
参考目录中的编译成功小节即可解决
边栏推荐
- 业务可视化-让你的流程图'Run'起来(3.分支选择&跨语言分布式运行节点)
- 0717RHCSA
- 零基础学习CANoe Panel(15)—— 文本输出(CAPL Output View )
- web安全入门-UDP测试与防御
- [ai4code final chapter] alphacode: competition level code generation with alphacode (deepmind)
- 卷积核越大性能越强?一文解读RepLKNet模型
- 【视频】马尔可夫链原理可视化解释与R语言区制转换MRS实例|数据分享
- Connotation and application of industrial Internet
- Shell common script: check whether a domain name and IP address are connected
- Common operations for Yum and VIM
猜你喜欢
![[300 opencv routines] 239. accurate positioning of Harris corner detection (cornersubpix)](/img/a6/c45a504722f5fd6e3c9fb8e51c6bb5.png)
[300 opencv routines] 239. accurate positioning of Harris corner detection (cornersubpix)

【GCN-RS】Region or Global? A Principle for Negative Sampling in Graph-based Recommendation (TKDE‘22)

卷积神经网络模型之——AlexNet网络结构与代码实现

OAuth,JWT ,OIDC你们搞得我好乱啊

如何理解Keras中的指标Metrics

Emqx cloud update: more parameters are added to log analysis, which makes monitoring, operation and maintenance easier

ECCV2022 | TransGrasp类级别抓取姿态迁移

"Wei Lai Cup" 2022 Niuke summer multi school training camp 2 supplementary problem solution (g, J, K, l)

Eccv2022 | transclassp class level grab posture migration

MLIR原理与应用技术杂谈
随机推荐
Shell common script: get the IP address of the network card
Shell常用脚本:判断远程主机的文件是否存在
Word style and multi-level list setting skills (II)
若依如何实现用户免密登录配置方法?
错误: 找不到或无法加载主类 xxxx
B tree and b+ tree
[machine learning] experimental notes - emotion recognition
The world is exploding, and the Google server has collapsed
从输入网址到网页显示
Go: Gin custom log output format
央行数研所穆长春:数字人民币可控匿名是维护公众利益和金融安全的客观需要
Cyberspace Security penetration attack and defense 9 (PKI)
0710RHCSA
Chapter5 : Deep Learning and Computational Chemistry
卷积神经网络模型之——LeNet网络结构与代码实现
Shell常用脚本:检测某域名、IP地址是否通
详解浮点数的精度问题
Pytorch creates its own dataset and loads the dataset
并发编程 — 内存模型 JMM
0717RHCSA