zoukankan      html  css  js  c++  java
  • V3s录音 交叉编译alsa linux

    1.下载alsa-lib和alsa-utils 

    www.alsa-project.org/main/index.php/Download

    2.编译alsa-lib

    tar xvf alsa-lib-1.1.5.tar.bz2  #解压
    sync
    cd alsa-lib-1.1.5/
    MyDIR="/usr/local/alsa"
    ./configure --host=arm-linux --prefix=$MyDIR/build --enable-shared --disable-python --with-configdir=$MyDIR/build/alsa_lib/share --with-plugindir=$MyDIR/build/alsa_lib/lib CC=/usr/local/arm/arm-linux-gnueabihf-4.9/bin/arm-linux-gnueabihf-gcc
    sudo make
    sudo make install

    3.编译alsa-utils

    tar xvf alsa-utils-1.1.5.tar.bz2
    cd alsa-utils-1.1.5/
    MyDIR="/usr/local/alsa/build"
    ./configure --host=arm-linux --prefix=$PWD/build CC=/usr/local/arm/arm-linux-gnueabihf-4.9/bin/arm-linux-gnueabihf-gcc CFLAGS="-I$MyDIR/include" LDFLAGS="-L$MyDIR/lib -lasound" --disable-alsamixer --disable-xmlto
    sudo make
    sudo make install

    4.把文件拷贝到开发板

    1.把/usr/local/alsa/build/lib 中的libasound.la  libasound.so  libasound.so.2  libasound.so.2.0.0 拷贝到目标板上的/lib目录

    2.将/usr/local/alsa/build/alsa_lib/share文件复制到开发板的同样的文件位置(即在开发板上也要这样一个位置)

    3.把~/lichee/alsa/alsa-utils-1.1.5/build/bin中的可执行文件拷贝到开发板的/bin目录

    4.还可以把~/lichee/alsa/alsa-utils-1.1.5/build/share/sounds/alsa目录下的一些wav文件到开发板供测试。

    5.在开发板上ls -l /dev/snd看看系统是否已经有了设备节点,如果没有,需要手动创建。

    mkdir /dev/snd 
    mknod /dev/snd/controlC0 c 116 0 
    mknod /dev/snd/pcmC0D0p c 116 16 
    mknod /dev/snd/pcmC0D0c c 116 24 
    mknod /dev/snd/seq c 116 1 
    mknod /dev/snd/hwC0D0 c 116 4 
    mknod /dev/snd/timer c 116 33
    # ls -l /dev/snd/
    total 0
    crw-------    1 root     root      116,   0 Jan  1 00:00 controlC0
    crw-------    1 root     root      116,  24 Jan  1 00:00 pcmC0D0c
    crw-------    1 root     root      116,  16 Jan  1 00:00 pcmC0D0p
    crw-------    1 root     root      116,  33 Jan  1 00:00 timer

    6.播放文件

    /bin/aplay Front_Center.wav

     7.存在问题

    我发现我这个编译出来没有arecord 只有arecordmidi,所以我重新用buildroot编译,顺便把buildroot用的configure选项记录一下。 这个问题找到了,这是因为arecord是连接着aplay的。我的sftp复制的时候它自动把连接文件删除了,所以我找不到,手动创建一个即可。

    编译alsa-lib

    ./configure --target=arm-buildroot-linux-gnueabihf --host=arm-buildroot-linux-gnueabihf --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix="" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared  --with-alsa-devdir=/dev/snd --with-pcm-plugins="all" --with-ctl-plugins="all" --without-versioned --enable-static=no --disable-python )

    编译alsa-utils

    ./configure --target=arm-buildroot-linux-gnueabihf --host=arm-buildroot-linux-gnueabihf --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix="" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared  --disable-xmlto --disable-rst2man --with-curses=ncurses --disable-alsaloop --disable-bat
  • 相关阅读:
    LeetCode Merge Two Sorted Lists 归并排序
    LeetCode Add Binary 两个二进制数相加
    LeetCode Climbing Stairs 爬楼梯
    034 Search for a Range 搜索范围
    033 Search in Rotated Sorted Array 搜索旋转排序数组
    032 Longest Valid Parentheses 最长有效括号
    031 Next Permutation 下一个排列
    030 Substring with Concatenation of All Words 与所有单词相关联的字串
    029 Divide Two Integers 两数相除
    028 Implement strStr() 实现 strStr()
  • 原文地址:https://www.cnblogs.com/ZQQH/p/8455714.html
Copyright © 2011-2022 走看看