分类: LINUX
2009-03-27 16:55:20
1. 下载源码包
准备源码包 madplay-0.15.2b.tar.gz,libmad-0.15.1b.tar.gz,
libid3tag-0.15.1b.tar.gz 和 zlib-1.1.4.tar.gz
我使用的交叉编译器为gcc-3.4.1,建立必要的文件夹,用于存放文件
[nick@localhost nick]mkdir madplay
[nick@localhost nick]cd madplay
将以上源码包拷贝到此并解压
[nick@localhost madplay]tar –zxvf zlib-1.1.4.tar.gz
[nick@localhost madplay]tar –zxvf libid3tag-0.15.1b.tar.gz
[nick@localhost madplay]tar –zxvf libmad-0.15.1b.tar.gz
[nick@localhost madplay]tar –zxvf madplay-0.15.2b.tar.gz
[nick@localhost madplay]mkdir lib
2. 编译zlib-1.1.4
[nick@localhost madplay]cd zlib-1.1.4
首先配置configure 文件
[nick@localhost zlib-1.1.4]./configure --prefix=/home/nick/madplay/lib
修改Makefile
[nick@localhost zlib-1.1.4]vi Makefile
CC=arm-linux-gcc
AR=arm-linux-ar rc
RANLIB=arm-linux-ranlib
[nick@localhost zlib-1.1.4]make
[nick@localhost zlib-1.1.4]make install
3. 编译libid3tag
[nick@localhost libid3tag-0.15.1b]./configure CC=arm-linux-gcc --host=arm-linux --prefix=/home/nick/madplay/lib --disable-shared CPPFLAGS=-I/home/nick/madplay/lib /include LDFLAGS=-L/home/nick/madplay/lib/lib
[nick@localhost libid3tag-0.15.1b]make
[nick@localhost libid3tag-0.15.1b]make install
4. 编译libmad
[nick@localhost libmad-0.15.1b]./configure CC=arm-linux-gcc --host=arm-linux --prefix=/home/nick/madplay/lib --disable-shared CPPFLAGS=-I/home/nick/madplay/lib /include LDFLAGS=-L/home/nick/madplay/lib/lib
[nick@localhost libmad-0.15.1b]make
[nick@localhost libmad-0.15.1b]make install
5. 编译madplay
[nick@localhost madplay-0.15.2b]./configure CC=arm-linux-gcc --host=arm-linux --prefix=/home/nick/madplay/lib --disable-shared CPPFLAGS=-I/home/nick/madplay/lib /include LDFLAGS=-L/home/nick/madplay/lib/lib
[nick@localhost madplay-0.15.2b]make
这样会在madplay-0.15.2b目录下生成madplay的可执行文件,因为是动态编译,所以还要查看一下需要的动态库
[nick@localhostmadplay-0.15.2b]/usr/local/arm/3.4.1/bin/arm-linux-readelf -d madplay
输出一大堆信息,最上面显示了编译所需的动态库:libm.so.6和libc.so.6,将动态库拷贝到根文件系统的/usr/lib目录下(先查看,如果已经有了则不需要)
将madplay复制到U盘,复制一首歌曲到U盘,然后插入并挂载U盘(也可以通过nfs)
[root@ /]#mount -t vfat -o iocharset=cp936 /dev/uba1 /mnt/usb
[root@ /mnt/usb]#ls
1.files Timer.txt quartus60
1.html bootex.log 1.mp3 clock 按键中断.rar
1.wav found.000 电子时钟
2.mp3 libm.so.6 王力宏.-.[心·跳].专辑
NiosII范例 madplay
Screen.ddb my 新建文件夹
Timer.pdf picture.bmp 新建文件夹 (2)
将madplay复制到/usr/bin目录下
[root@ /mnt/usb]#cp ./madplay /usr/bin
执行madplay程序
[root@ /mnt/usb]#madplay -r 2.mp3
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
s3c2410-uda1341-superlp: audio_set_dsp_speed:44100 prescaler:66
Title: 心跳
Artist: 王力宏
Album: 《心·跳》
Track: 2
Comment:
s3c2410-uda1341-superlp: audio_set_dsp_speed:44100 prescaler:66
哈哈,这样你就可以王力宏的歌声,音质还不错~~