以前接触MiniGUI近2年的时间,也没有做过MiniGUI的移植工作,近日利用调研的机会,对MiniGUI进行了一下在9G45平台的移植工作。简单记录如下。
-
移植准备
- 交叉编译工具链-$HOME/usr/arm-2008q1/arm-none-linux-gnueabi/arm-none-linux-gnueabi-gcc
-
需要移植的软件包
- zlib-1.2.2
- libpng-1.2.37
- freetype-2.3.9-fm20100818
- jpeg-7
- tslib-1.4
- libminigui-gpl-3.0.12
- minigui-res-be-3.0.12
- libmgplus-1.2.4
- libmgutils-1.0.4
- mg-samples-3.0.12
-
移植过程
-
zlib库的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabi
export CC=arm-none-linux-gnueabi-gcc
export CXX=arm-none-linux-gnueabi-g++
export AS=arm-none-linux-gnueabi-as
export LD=arm-none-linux-gnueabi-ld
export CFLAGS="-I. -I${TOOLCHAIN}/include/c++/4.2.3"
export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc"
./configure --prefix=${HOME}/tmp/crosscomplie \
--shared \
&& make && sudo make install && echo "Make successful." -
tslib库的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}/tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lm -lz"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ && make && make install && echo "Make successful."
-
png库的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}/tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lm -lz"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ && make && make install && echo "Make successful."
-
jpeg库的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I${TOOLCHAIN}/include/c++/4.2.3"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ --enable-shared \ && make && make install && echo "Make successful."
-
freetype的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I${TOOLCHAIN}/include/c++/4.2.3"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ --enable-static \ && make && make install && echo "Make successful."
-
MiniGUI库的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I./include -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include -I${TOOLCHAIN}/libc/usr/include -I${INSTALL_DIR}/include/ts"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lm -lz -ldl -lpthread -lpng -ljpeg -lfreetype -lts"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ --enable-tslibial --enable-videofbcon \ --enable-splash=no --enable-screensaver=no \ && make && make install && echo "Make successful."
-
MiniGUI 资源库的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}/tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I./include -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include -I${TOOLCHAIN}/libc/usr/include -I${INSTALL_DIR}/include/ts"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lm -lpthread -lpng -ljpeg -lfreetype -lts"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ && make && make install && echo "Make successful."
-
MGPlus的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}/tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I./include -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include -I${TOOLCHAIN}/libc/usr/include"export CXXFLAGS="-I. -I./include -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include -I${TOOLCHAIN}/libc/usr/include"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lpng -ljpeg -lz -lpthread -ldl -lts -lfreetype -lminigui_ths"export MINIGUI_CFLAGS="-I${INSTALL_DIR}/include"export MINIGUI_LIBS="-lminigui_ths"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ && make && make install && echo "Make successful."
-
MGUtils的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}/tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I./include -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include -I${TOOLCHAIN}/libc/usr/include -I${INSTALL_DIR}/include/minigui"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lpng -ljpeg -lz -lpthread -lts -ldl -lfreetype -lminigui_ths"export MINIGUI_CFLAGS="-I${INSTALL_DIR}/include/minigui"export MINIGUI_LIBS="-L${INSTALL_DIR}/lib"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ && make && make install && echo "Make successful."
-
MGSamples的移植
export TOOLCHAIN=${HOME}/usr/toolchain/arm-2008q1/arm-none-linux-anueabiexport INSTALL_DIR=${HOME}/tmp/crosscompileexport CC=arm-none-linux-gnueabi-gccexport CXX=arm-none-linux-gnueabi-g++export AS=arm-none-linux-gnueabi-asexport LD=arm-none-linux-gnueabi-ldexport CFLAGS="-I. -I./include -I${TOOLCHAIN}/include/c++/4.2.3 -I${INSTALL_DIR}/include -I${TOOLCHAIN}/libc/usr/include -I${INSTALL_DIR}/include/minigui"export LDFLAGS="-L${TOOLCHAIN}/lib -L${TOOLCHAIN}/libc -L${TOOLCHAIN}/libc/lib -L${INSTALL_DIR}/lib"export LIBS="-lpng -ldl -lpthread -lts -ljpeg -lz -lfreetype -lminigui_ths"export MINIGUI_CFLAGS="-I${INSTALL_DIR}/include/minigui"export MINIGUI_LIBS="-L${INSTALL_DIR}/lib"./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi \ --target=arm-none-linux-gnueabi --prefix=${HOME}/tmp/crosscomplie \ && make && make install && echo "Make successful."
-
zlib库的移植
-
遇到的问题及解决方法
- 缺少链接库—根据提示,缺少什么库就在编译脚本中用-L和-l指定就OK了
- 编译MiniGUI的过程中,遇到src/newgal/pcxvfb/Makefile.am和Makefile.in中直接INCLUDES了/usr/include目录,将这个目录去掉以避免引用到PC上的头文件
-
tslib配置的问题。MGSample运行时,提示信息“No raw modules loaded“,查看tslib的代码,发现是tslib的配置问题,需要在目标平台上设定:
export TSLIB_PLUGINDIR=/usr/local/lib/ts export TSLIB_CONFFILE=/etc/ts.conf</span>
两个环境变量,才能够直接查找到。 - MiniGUI.cfg配置文件的修改:
-
# GAL engine and default options
gal_engine=fbcon
defaultmode=800x480-16bpp
# IAL engine
ial_engine=tslib
mdev=/dev/input/event0
[fbcon]
defaultmode=800x480-16bpp
[cursorinfo]
# Edit following line to specify cursor files path
cursorpath=/usr/local/share/minigui/res/cursor/
[resinfo]
respath=/usr/local/share/minigui/res/