2010年9月12日星期日

Build Mplayer for arm Linux


Build Mplayer for arm(s3c2440) Linux:


1.download the source file and uncompress it to the sysapps directory:

2.run the configure:
./configure \
--prefix=${PRJROOT}/rootfs/usr \
--target=arm-unknown-linux \
--cc=arm-linux-gcc \
--host-cc=gcc \
--as=arm-linux-as \
--enable-fbdev \
--disable-largefiles \
--disable-md5sum \
--disable-pnm \
--disable-tga \
--disable-vcd \
--disable-bluray \
--disable-dvdnav \
--disable-dvdread \
--disable-dvdread-internal \
--disable-libdvdcss-internal \
--enable-menu \
--disable-libmpeg2 \
--disable-libmpeg2-internal \
--disable-liba52 \
--disable-ftp \
--disable-tv \
--disable-networking \
--disable-inet6 \
--disable-mmx \
--disable-mmxext \
--disable-3dnow \
--disable-3dnowext \
--disable-sse \
--disable-sse2 \
--disable-ssse3 \
--disable-shm \
--disable-altivec \
--disable-armv5te \
--disable-armv6 \
--disable-iwmmxt \
--disable-fastmemcpy \
--disable-dynamic-plugins \
--language=en \
--enable-static

#for more information, you can type the “./configure –help”
#accoarding to the configure above, the mplay will install in the directory rootfs/usr
#since in my arm-linux-gcc configure, I don't enable large file support, so –disable-largefiles option must be used.
#option –disable-libmpeg2-internal must be add, because s3c2410 cpu does not support arm pld instruction.
#the end of the –prefix must not have “/”, else install will fail.

3, run make and make install

error:
make[1]: Entering directory `/home/oneyoung/project/sysapps/mplayer-export-2010-09-11/libavcodec'
CC 4xm.o
{standard input}: Assembler messages:
{standard input}:478: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:479: Error: no such instruction: `bic %edx,%edx,'
{standard input}:480: Error: suffix or operands invalid for `mov'
{standard input}:481: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:1670: Error: no such instruction: `eor %eax,%ebx,%ebx,ror'
{standard input}:1671: Error: no such instruction: `bic %eax,%eax,'
{standard input}:1672: Error: suffix or operands invalid for `mov'
{standard input}:1673: Error: no such instruction: `eor %ebx,%ebx,%eax,lsr'
{standard input}:1685: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:1686: Error: no such instruction: `bic %edx,%edx,'
{standard input}:1687: Error: suffix or operands invalid for `mov'
{standard input}:1688: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2110: Error: no such instruction: `eor %eax,%ebx,%ebx,ror'
{standard input}:2111: Error: no such instruction: `bic %eax,%eax,'
{standard input}:2112: Error: suffix or operands invalid for `mov'
{standard input}:2113: Error: no such instruction: `eor %ebx,%ebx,%eax,lsr'
{standard input}:2125: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2126: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2127: Error: suffix or operands invalid for `mov'
{standard input}:2128: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2200: Error: no such instruction: `eor %eax,%ebx,%ebx,ror'
{standard input}:2201: Error: no such instruction: `bic %eax,%eax,'
{standard input}:2202: Error: suffix or operands invalid for `mov'
{standard input}:2203: Error: no such instruction: `eor %ebx,%ebx,%eax,lsr'
{standard input}:2215: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2216: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2217: Error: suffix or operands invalid for `mov'
{standard input}:2218: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2280: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2281: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2282: Error: suffix or operands invalid for `mov'
{standard input}:2283: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2318: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2319: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2320: Error: suffix or operands invalid for `mov'
{standard input}:2321: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2364: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2365: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2366: Error: suffix or operands invalid for `mov'
{standard input}:2367: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2428: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2429: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2430: Error: suffix or operands invalid for `mov'
{standard input}:2431: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2494: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2495: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2496: Error: suffix or operands invalid for `mov'
{standard input}:2497: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2532: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2533: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2534: Error: suffix or operands invalid for `mov'
{standard input}:2535: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2578: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2579: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2580: Error: suffix or operands invalid for `mov'
{standard input}:2581: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2638: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2639: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2640: Error: suffix or operands invalid for `mov'
{standard input}:2641: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2898: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2899: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2900: Error: suffix or operands invalid for `mov'
{standard input}:2901: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2936: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2937: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2938: Error: suffix or operands invalid for `mov'
{standard input}:2939: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
{standard input}:2982: Error: no such instruction: `eor %edx,%eax,%eax,ror'
{standard input}:2983: Error: no such instruction: `bic %edx,%edx,'
{standard input}:2984: Error: suffix or operands invalid for `mov'
{standard input}:2985: Error: no such instruction: `eor %eax,%eax,%edx,lsr'
make[1]: *** [4xm.o] Error 1
make[1]: Leaving directory `/home/oneyoung/project/sysapps/mplayer-export-2010-09-11/libavcodec'
make: *** [libavcodec/libavcodec.a] 错误 2

--it seems that something wrong with cpu type config, so re comfigure with the opton –target=arm-unknown-linux
--target=arm-armv4l-linux这个参数要注意的是一个分三部分,第一部分的arm是指arch,这里设定为arm;第二部分的armv4l是指具体的版本,这个要注意了,一定要跟libavcodec目录下的平台目录名一致,否则为这个平台的优化代码没办法编译进去(据我观察是这样的^_@ );第三部分是系统平台。
--this way doesn't work , try another option –disable-mencoder
disable MEncoder (A/V encoder) compilation
also does not work alright.

After I google the `eor %edx,%eax,%eax,ror', I found that it was x86 insruction.
So … FUCK ! I forget to export arm-linux-gcc path. What a shame!

Error:
mp_fifo.o: could not read symbols: File in wrong format
--recompile mp_fifo.o
make –new-file=fifo.c
--another file has the same error. Maybe it was because I recompile with make -o Makefile, and after I change configure, some file do not re-compile again. So run make clean and then run make, this problem solved. :)

error:
libmpdemux/mp_taglists.o:(.rodata+0x0): undefined reference to `ff_codec_wav_tags'
libmpdemux/mp_taglists.o:(.rodata+0x14): undefined reference to `ff_codec_bmp_tags'
collect2: ld returned 1 exit status
--open the file libmpdemux/mp_taglists.c and remove the “ff_” prefix from both reference.
I try this way, but it does not work.

--take a close look at the error. I seems that ff_codec_wav_tags and ff_codec_bmp_tags have not been defined. I search the google, and find that the two structure are defined in libavformat/riff.c
, but during the configure, we just disable it. So we remove the option --disable-libavformat_a --disable-libavformat_so .

Error:
when running make install, the error below occurs.

strip: Unable to recognise the format of the input file `/home/oneyoung/project/rootfs/usr/bin/mencoder'

--the error occurs. Because that the file mencoder we compile is arm format, but the make script use install -s to accomplish strip task, install is a x86 version program, and can't not operate on arm execute file.
So we have some trick:
(1)first we “run make install -n” to get the command while make will run. And mine looks like below:
install -d /home/oneyoung/project/rootfs/usr/bin /home/oneyoung/project/rootfs/usr/etc/mplayer /home/oneyoung/project/rootfs/usr/lib
install -m 755 -s mencoder /home/oneyoung/project/rootfs/usr/bin
install -d /home/oneyoung/project/rootfs/usr/share/man/zh_CN/man1
install -m 644 DOCS/man/zh_CN/mplayer.1 /home/oneyoung/project/rootfs/usr/share/man/zh_CN/man1/
cd /home/oneyoung/project/rootfs/usr/share/man/zh_CN/man1 && ln -sf mplayer.1 mencoder.1
install -m 755 -s mplayer /home/oneyoung/project/rootfs/usr/bin

here we delete the install's “-s” option and add arm-linux-strip like below:
install -d /home/oneyoung/project/rootfs/usr/bin /home/oneyoung/project/rootfs/usr/etc/mplayer /home/oneyoung/project/rootfs/usr/lib
install -m 755 mencoder /home/oneyoung/project/rootfs/usr/bin
arm-linux-strip /home/oneyoung/project/rootfs/usr/bin/mencoder
install -d /home/oneyoung/project/rootfs/usr/share/man/zh_CN/man1
install -m 644 DOCS/man/zh_CN/mplayer.1 /home/oneyoung/project/rootfs/usr/share/man/zh_CN/man1/
cd /home/oneyoung/project/rootfs/usr/share/man/zh_CN/man1 && ln -sf mplayer.1 mencoder.1
cd -
install -m 755 mplayer /home/oneyoung/project/rootfs/usr/bin
arm-linux-strip mplayer /home/oneyoung/project/rootfs/usr/bin/mplayer

and past it to the terminal, and the install will be complete.


Test the mplayer:

fetch a movie and try to run “mplayer -nosound 1.avi”

and error occurs:
[swscaler @ 0x8d1fb0]No accelerated colorspace conversion found from yuv420p to.
[swscaler @ 0x8d1fb0]using unscaled yuv420p -> bgra special converter
VO: [fbdev] 320x240 => 320x240 BGRA
Can't put VSCREENINFO: Invalid argument

search the VSCREENINFO in the kernel source, and find that ioctl is define in the drivers/video/fbmem.c
1052        case FBIOPUT_VSCREENINFO:
1053                if (copy_from_user(&var, argp, sizeof(var)))
1054                        return -EFAULT;
1055                if (!lock_fb_info(info))
1056                        return -ENODEV;
1057                acquire_console_sem();
1058                info->flags |= FBINFO_MISC_USEREVENT;
1059                ret = fb_set_var(info, &var);
1060                info->flags &= ~FBINFO_MISC_USEREVENT;
1061                release_console_sem();
1062                unlock_fb_info(info);
1063                if (!ret && copy_to_user(argp, &var, sizeof(var)))
1064                        ret = -EFAULT;
1065                break;
maybe the problem laid in the frame buffer console, since I don't take care of fbcon, and just initialize the s3c2410fb.

--this is not working, since my fbcon works well.

After that, I have tried many methods, but still does not work. And one day, I refer to the mplayer manual, and find that there is another option -vo fbdev2 instead of -vo fbdev. Eventually it works!!!
just run “mplayer -nosound -vo fbdev2 4.avi”

没有评论:

发表评论