主机操作系统:fedora 12 i686
开发板: 友善之臂 mini2440 (内核版本为2.6.32)
交叉编译器:arm-linux-gcc(版本号:4.4.3)
mplayer版本:mPlayer-1.0rc2.tar.bz2
移植过程:
1.因为需要mad库播放音频,所以首先交叉编译libmad(不然会报错Can’t find –lmad)
libmad的版本为 libmad-0.15.1b.tar.bz2
步骤为configure,make ,make install
configure的配置参数为:./configure --enable-fpm=arm --host=arm-linux --disable-shared /--disable-debugging --prefix=/usr/local/arm-linux/4.4.3/lib /CC=arm-linux-gcc
其中--prefix为你安装arm-linux-gcc的目录
在安装libmad是出现过如下错误
arm-linux-ranlib command not found
在终端检查,发现arm-linux-ranlib可以在系统的PATH中找到。
那为什么还提示说找不到arm-linux-ranlib呢?
原因如下:
1)我添加arm交叉编译器目录到PATH中是放在~/.bash_profile里的,这是用户的配置文件,我的用户为wmm。
2)执行make install时,加了sudo前缀,变成了root的工作环境和root的权限。
根据以上两点,make install是在root下做的,而arm-linux-ranlib在wmm用户的工作环境中才能找到。所以产生了这里的错误。
那既要取得root权限,又要具有当前用户wmm的工作环境,改怎办呢?
解决如下:
执行make install之前,先用下su命令取得root权限。然后再执行make install。
2.安装mplayer
步骤为configure,make ,make install
configure的配置参数为:./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm-linux --enable-static --disable-win32dll --disable-dvdread --disable-dvdread-internal --disable-dvdnav --disable-libdvdcss-internal --enable-fbdev --disable-mencoder --disable-live --disable-mp3lib --enable-mad --enable-libavcodec_a --disable-live --prefix=/opt
--with-extraincdir=/usr/local/arm-linux/4.4.3/lib/include /
--with-extralibdir=/usr/local/arm-linux/4.4.3/lib/lib
之后make,make install。
其中可能会遇到如下问题:
1.Error:motion_comp_arm_s.S
在libmpeg2/motion_comp_arm_s.S文件的最前面加上如下的内容:#ifndef HAVE_PLD.macro pld reg.endm#endif
2.vo_ivtv.c:79: error: storage size of ’sd’ isn’t known
vo_ivtv.c:80: error: storage size of ’sd1′ isn’t known
添加--disable-ivtv
3. undefined reference to `video_out_ivtv'
在文件 file libvo/video_out.c, 找到#ifdef HAVE_DXR2extern vo_functions_t video_out_dxr2;#endifextern vo_functions_t video_out_dxr3; // ошибка сделана тут#ifdef HAVE_IVTVextern vo_functions_t video_out_ivtv;#endif edit it like this:#ifdef HAVE_DXR2extern vo_functions_t video_out_dxr2;#endif#ifdef HAVE_DXR3 //这一句是要添加的extern vo_functions_t video_out_dxr3; #endif //这句是要添加的#ifdef HAVE_IVTVextern vo_functions_t video_out_ivtv;#endif
4.strip: Unable to recognise the format of the input file
查资料看install带-s 参数时会自动调用strip来strip应用程序。但是arm编译时要调用arm-linux-strip才有正确处理。解决办法是取消-s参数,查看Makefile可以发现-s是如下
$(INSTALL) -m 755 $(INSTALLSTRIP) mplayer$(EXESUF) $(BINDIR)
的INSTALLSTRIP设置的,它默认是-s,因此只要简单去掉即可。
$(INSTALL) -m 755 mplayer$(EXESUF) $(BINDIR)
以上几步都完成之后将生成的 /opt/bin/mplayer下载到开发板上,输入参数:
mplayer test.avi -framedrop -quiet -vf rotate -flip -x 240 -y 320
完成