ALSA cross-compilation and Testing

Source: Internet
Author: User

Kernel version: Kernel 2.6.28.6 compiled by the menuconfig configuration file top6410_3d.config (if you use the old version of 28 kernel or use the default menuconfig configuration file for compilation, the Alsa recording will not sound)

File System Version: ubifs in the old version.

ALSA-lib version: 1.0.9

ALSA-util version: 1.0.9a

Other versions of ALSA-lib and ALSA-util cannot guarantee normal operation

After the previous versions of the kernel and ubifs have been successfully installed to 6410 (you can also use TFTP to download the kernel and NFS to mount ubifs In the debugging phase), start the following work:

First, cross-compile ALSA-lib and ALSA-util on Ubuntu.

1.decompress alsa-lib-1.0.9.tar and enter the decompressed directory.

2. Use commands

./Configure -- Host = arm-None-Linux-gnueabi -- prefix =/usr/share/ARM-ALSA

TIPS: -- The host parameter specifies that the cross compiler is "arm-None-Linux-gnueabi-GCC". Therefore, you must ensure that the cross compiler is successfully configured. www.linuxidc.com can be directly called in shell; the -- prefix parameter specifies the target installation directory of ALSA-lib, and the subsequent ALSA-util configuration is the same.

3. Use commands

Make

Sudo make install

TIPS: make install sudo must be added, because some directories will be created during the install process.

4.decompress alsa-util-1.0.9a.tar and enter the extracted directory.

5. Use commands

. /Configure -- Host = arm-None-Linux-gnueabi -- prefix =/usr/share/ARM-ALSA -- With-ALSA-inc-Prefix =/usr/share/ARM-ALSA /include -- With-ALSA-Prefix =/usr/share/ARM-ALSA/lib -- disable-alsamixer

TIPS: -- With-ALSA-inc-prefix and -- With-ALSA-Prefix specify the header files and library files required for cross-compiling util applications; -- disable-alsamixer indicates that the alsamixer application is not compiled and generated, because the program depends on the ncurses GUI library. Currently, we cannot cross-compile the library, so we give up

6. Use commands

Touch alsaconf/po/t-ja.gmo

Avoid making errors later

7. Use commands

Make

Sudo make install

So far, all work on Ubuntu has ended.

Then deploy the cross-compiled ALSA-lib and ALSA-util on 6410.

For ease of understanding, set the 6410 root directory to $ rootfs

1. Move all files under the Alsa installation directory in Ubuntu to the corresponding directory of 6410 (the absolute path must be consistent) and run the following command:

Sudo CP-r/usr/share/ARM-ALSA $ rootfs/usr/share/

2. Move the cross-compiled ALSA library under the Alsa installation directory to the default library search directory in 6410 and use the command

Sudo CP-r $ rootfs/usr/share/ARM-ALSA/lib/* $ rootfs/lib/

3. Move the cross-compiled ALSA-util application under the Alsa installation directory to the 6410 Default Application search directory and use the command

Sudo CP-r $ rootfs/usr/share/ARM-ALSA/bin/* $ rootfs/usr/sbin/

Sudo CP-r $ rootfs/usr/share/ARM-ALSA/sbin/* $ rootfs/usr/sbin/

4. Edit $ rootfs/etc/init. d/RCs and add the following lines:

[Plain]
  1. # Alsa_init
  2. Mkdir/dev/SND
  3. Ln/dev/controlc0/dev/snd/controlc0
  4. Ln/dev/pcmc0d0c/dev/snd/pcmc0d0c
  5. Ln/dev/pcmc0d0p/dev/snd/pcmc0d0p
  6. Ln/dev/Timer/dev/snd/Timer
  7. Amixer cset numid = 86 2
  8. Amixer cset numid = 87 2

TIPS: The two commands of amixer change the default values of 'left capture source' and 'right capture source' of amixer to 'line ', otherwise, the Alsa recording has no sound.

5. Edit $ rootfs/etc/profile and add the following two lines:

[Plain]
  1. # Alsa_init
  2. Export alsa_config_path =/usr/share/ARM-ALSA/share/ALSA. conf

TIPS: The environment variable value must be consistent with the Alsa installation directory. Otherwise, an error is reported when aplay and arecord are used.

Now the transplantation of ALSA-lib and ALSA-util is complete.

Test

1. test whether the video can be played normally. Run the following command:

Aplay test1.wav

Test1.wav is a normal recorded audio file.

2. test whether the recording can be normal. Use the command

Arecord-D 10-fdat test2.wav

-D indicates that the recording time is 10 seconds, and-fdat indicates that the recording is based on the DAT quality (the sampling rate, audio channel, and other parameters are determined)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.