# tar zvxf arm-linux-gcc-4.4.3.tar.gz –C / # gedit /root/.bashrc export PATH=$PATH:/opt/FriendlyARM/toolschain/4.4.3/bin # reboot # arm-linux-gcc –v # 最後一行出現版本號即成功
# strings /usr/lib/libstdc++.so.6 | grep GLIBC # 若無 GLIBCXX_3.4.9 # ls -l /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.8 # rm –rf /usr/lib/libstdc++.so.6 # cp libstdc++.so.6.0.10 /usr/lib/ # ln -s /usr/lib/libstdc++.so.6.0.10 /usr/lib/libstdc++.so.6
建立工作目錄並解開原始碼:
# mkdir mywork && cd mywork # mkdir myplayer && cd myplayer # tar jxvf MPlayer-1.0rc3.tar.bz2 # cd MPlayer-1.0rc3
configure 是整個移植的核心,參數多但每一項都有目的:
# ./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm \
--enable-static --disable-win32dll \
--disable-dvdread --disable-dvdread-internal --disable-dvdnav \
--disable-libdvdcss-internal \
--enable-fbdev --disable-mencoder --disable-live \
--disable-mp3lib --disable-mad --enable-libavcodec_a \
--language=zh_CN 2>&1 | tee logfile
簡單說:關掉 DVD 與 Win32 相關功能以縮小體積,改用 framebuffer 輸出(--enable-fbdev),不產生 mencoder,並把介面訊息設為中文。把輸出導向 logfile,出錯時才好回溯。
新版工具鏈不認得舊寫法,必須修改兩個檔案裡的 pld [r1](注意中括號內有空格),把它整行換成空白:
MPlayer-1.0rc2/libmpeg2/motion_comp_arm_s.S MPlayer-1.0rc2/libavcodec/armv4l/dsputil_arm_s.S
用編輯器的全域取代一次處理即可。存檔後執行:
# make
成功後,MPlayer 可執行檔就產生在該目錄底下。
把 mplayer 與測試用的 wmv 檔放到板子的 /usr/bin。用 tftp 的話,PC 端開啟伺服端軟體,板子上執行:
# tftp –g –r 要下載的檔案 PC的IP # chmod 777 mplayer
# ./mplayer test.wmv -framedrop -quiet -vf rotate=1,scale=240:320
三個參數各有含意:-framedrop 允許在算力不足時丟幀,換取播放流暢度,這在 400MHz 的 ARM9 上幾乎是必要的;-quiet 精簡輸出;-vf rotate=1,scale=240:320 先旋轉再縮放到 240×320,正好對應 mini2440 的直式螢幕。
檔案路徑可換成實際位置,例如 /temp/test.wmv。若畫面卡頓,優先調整的是解析度與是否啟用 framedrop;若完全沒有影像,先確認 framebuffer 沒有被其他 GUI 佔用。