pc:ubuntu 13.10
开发板:龙芯1B
gcc版本:gcc 4.8.1
交叉编译环境:mipsel-linux
下载源码包:libmad-0.15.1b.tar.gz、MPlayer-1.0rc2.tar.bz2、yasm-0.8.0.tar.gz
1.移植libmad解码器
tar zxvf libmad-0.15.1b.tar.gz
cd libmad-0.15.1b
./configure --enable-fpm=mips --host=mipsel-linux --disable-shared --disable-debugging --prefix=/home/kid/temp CC=/opt/gcc-4.3-ls232-softfloat/bin/mipsel-linux-gcc
make
make install
make install成功后会在安装目录生成include和lib文件夹,include文件夹里面有mad.h文件,lib文件夹里面有libmad.a和libmad.la两个库文件,后面开发板指定解码器的时候需要把lib两个库文件放到开发板lib目录下。
--prefix=/home/kid/temp指定安装目录,就是安装完后会在/home/kid/temp下生成include和lib文件夹
CC=/opt/gcc-4.3-ls232-softfloat/bin/mipsel-linux-gcc指定交叉编译工具环境路径
问题:make时提示error: unrecognized command line option “-fforce-mem”
解决办法:打开Makefile找到-fforce-mem并删除
2.安装yasm
tar zxvf yasm-0.8.0.tar.gz
cd yasm-0.8.0
./configure
make
make install
3.移植mplayer播放器
tar xvf MPlayer-1.0rc2.tar.bz2
cd MPlayer-1.0rc2
./configure --cc=mipsel-linux-gcc --target=mips --enable-static --prefix=/home/kid/item --disable-win32dll --disable-dvdread --enable-fbdev --disable-mencoder --disable-live --disable-mp3lib --enable-mad --enable-libavcodec_a --disable-armv5te --disable-armv6 --with-extraincdir=/home/kid/temp/include/ --with-extralibdir=/home/kid/temp/lib/ --host-cc=gcc --enable-ossaudio --disable-ivtv --disable-tv
make
make install
--cc=mipsel-linux-gcc指定交叉编译工具
--target=mips指定运行机器架构
--enable-static启用静态编译
--prefix=/home/kid/item指定安装路径,即mplayer安装在/home/kid/item路径下
--with-extraincdir=/home/kid/temp/include/指定刚刚移植的mad解码器的include文件夹
--with-extralibdir=/home/kid/temp/lib/指定刚刚移植的mad解码器的lib文件夹
问题:make install时提示DVD ioctls are unavailable on this system
解决办法:找到代码相应行并注释掉。文件位置是./libdvdcss/ioctl.c
问题:make install时提示Unable to recognise the format of the input file
解决办法:在Makefile定义里加入INSTALLSTRIP :=
INSTALLSTRIP :=
make install成功后把mplayer放到开发板上,mplayer使用命令
./mplayer *.mp3
mplayer指定解码器,例如指定前面移植的mad解码器
./mplayer -ac mad *.map