/*2010.12.29*/
/*linux-2.6.22.6移植madplay到FL2440-I */
/*主机系统:ubuntu 10.10 */
/*目标板:FL2440-I / linux-2.6.22.6 */
/*交叉编译器:arm-linux-gcc-3.4.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 */
所需源码包:madplay-0.15.2b.tar.gz,libmad-0.15.1b.tar.gz,libid3tag-0.15.1b.tar.gz 和 zlib-1.1.4.tar.gz
下载地址:
http://www.gzip.org/zlib/zlib-1.1.4.tar.gz
http://cdnetworks-kr-2.dl.sourceforge.net/project/mad/libid3tag/0.15.1b/libid3tag-0.15.1b.tar.gz
http://cdnetworks-kr-1.dl.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz
http://cdnetworks-kr-1.dl.sourceforge.net/project/mad/madplay/0.15.2b/madplay-0.15.2b.tar.gz
1.新建路径
sudo mkdir /madplay
sudo mkdir /madplay/mad
2.给路径最大权限
sudo chmod 777 /madplay /madplay/mad
3.将四个源码包拷贝到 /madplay下并解压
4.编译zlib-1.1.4
进入到zlib-1.1.4路径:
cd zlib-1.2.5/
(1)首先配置configure 文件,生成Makefile,命令(--prefix=/madplay/mad/为指定最终生成的库文件的安装路径):
sudo ./configure --prefix=/madplay/mad/
(2)修改Makefile:
sudo vi Makefile
修改以下三项:
CC=gcc -> CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc
AR=ar rc -> AR=/usr/local/arm/3.4.1/bin/arm-linux-ar rc
RANLIB=ranlib -> RANLIB=/usr/local/arm/3.4.1/bin/arm-linux-ranlib
(3)编译:
sudo make
(4)安装:
sudo make install
5.编译madplay:
进入路径/madplay/madplay-0.15.2b
(1)配置,生成Makefile(CPPFLAGS=-I/madplay/mad/include LDFLAGS=-L/madplay/mad/lib指定了上一步安装库文件在路径,以下相同):
sudo ./configure CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc AR=/usr/local/arm/3.4.1/bin/arm-linux-ar RANLIB=/usr/local/arm/3.4.1/bin/arm-linux-ranlib --host=arm-linux --prefix=/madplay/mad --disable-shared CPPFLAGS=-I/madplay/mad/include LDFLAGS=-L/madplay/mad/lib
(2)编译:
sudo make
(3)安装:
sudo make install
6.编译libmad:
进入路径/madplay/libmad-0.15.1b
(1)配置,生成Makefile:
sudo ./configure CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc AR=/usr/local/arm/3.4.1/bin/arm-linux-ar RANLIB=/usr/local/arm/3.4.1/bin/arm-linux-ranlib --host=arm-linux --prefix=/madplay/mad --disable-shared CPPFLAGS=-I/madplay/mad/include LDFLAGS=-L/madplay/mad/lib
(2)编译:
sudo make
(3)安装:
sudo make install
7.编译madplay:
进入路径/madplay/madplay-0.15.2b
(1)配置,生成Makefile:
sudo ./configure CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc AR=/usr/local/arm/3.4.1/bin/arm-linux-ar RANLIB=/usr/local/arm/3.4.1/bin/arm-linux-ranlib --host=arm-linux --prefix=/madplay/mad --disable-shared --enable-static --disable-nls CPPFLAGS=-I/madplay/mad/include LDFLAGS=-L/madplay/mad/lib
(2)编译:
sudo make
这样生成的madplay最终是动态编译的,为了静态编译,make之后输出的最后的编译命令复制一下,最后加上-static,如下:
/usr/local/arm/3.4.1/bin/arm-linux-gcc -Wall -g -O2 -o madplay madplay.o getopt.o getopt1.o version.o resample.o filter.o tag.o crc.o rgain.o player.o audio.o audio_aiff.o audio_cdda.o audio_hex.o audio_null.o audio_raw.o audio_snd.o audio_wave.o audio_oss.o -L/madplay/mad/lib /madplay/mad/lib/libmad.a /madplay/mad/lib/libid3tag.a -lz -lm -static
回车,OK!
将当前目录下的madplay下载到开发板上,然后下载一个mp3格式的音频文件到开发板,执行:
./madplay xxx.mp3
这样就可以通过耳麦听到播放的mp3音乐了.
编码格式为MPA1L3的歌曲播放效果还行,播放速度只比PC的慢一点.
编码格式为MPA2L3的歌曲播放起来明显听起来很慢.