前一段时间由于没有一直忙着在E680g上完善和优化Qtopia的功能,所以一直没时间来写点东西。可以做的东西久了就会忘了,虽然自己没有写东西的好习惯,但是没办法,反正以后工作了一定也好写的,所以就不如 现在开始养好习惯。
在E680g上移植Qtopia的想法源于E680g手机上有国外的前辈移植了Opie系统,但是速度很慢,启动需要1分钟左右,而且很多东西都不实用,所以就有了把Qtopia移植上去的想法。
1.准备所需的源码包
xscale-gcc-vfp-3.3.tar.gz
用于E680g手机的XScale交叉编译器,相信玩E680g编程的兄弟们肯定在用这个,我这个也是从网上下,自己编译太花时间了。
e2fsprogs-1.35.tar.gz
这个包交叉编译后会生成libuuid.so,libuuid.so.1,libuuid.so.1.2,其他生成的东西都用不到的,在编译qtopia-free-1.7.0时会用到这几个库文件。
qt-embedded-2.3.7.tar.bz2
这个是Qt的嵌入式版本,在编译qtopia-free-1.7.0需要用到它生成的库文件。
qtopia-free-1.7.0.tar.gz
这个就是今天我们要移植的东东了,选这个版本是因为之前做过这方面的东西,用起来顺手些,当然现在已经到了最新的qtopia-opensource-4.3.0,这个还没怎么玩过,等以后有时间再搞搞这个。
qt-x11-2.3.2.tar.gz
这个是Qt的桌面版本,我们编译这个只是为了得到moc,uic等工具,这个在以后的编译中要用到的。
tmake-1.13.tar.gz
这个是Makefile的脚本生成工具,可以根据配置文件生成应用于特定平台的Makefile。
2.安装交叉编译器
只需要把 xscale-gcc-vfp-3.3.tar.gz直接解压即可,它会自己解压到/usr/local/arm目录中,但是这个时候交叉编译器还是不能实用的,我们还需要把它添加到PATH环境变量中,方法如下:
打开配置文件,在文件末尾添加下面内容:
保存后注销一下系统即可。
3.编译系统
(1)解压qtopia-free-1.7.0.tar.gz
#! /bin/sh
tar xfz qtopia-free- 1.7.0 .tar.gz
cd qtopia-free- 1.7.0
export QPEDIR=$PWD
cd ..(2)解压tmake-1.13.tar.gz并设置相关环境变量
export TMAKEDIR = $PWD / tmake - 1.13
export TMAKEPATH = $TMAKEDIR / lib / qws / linux - ipaq - g ++
export PATH = $TMAKEDIR / bin:$PATH
(3)编译qt-embedded-2.3.7
cd qt - 2.3 . 7
export QTDIR = $PWD
export QTEDIR = $QTDIR
export PATH = $QTDIR / bin:$PATH
export LD_LIBRARY_PATH = $QTDIR / lib:$LD_LIBRARY_PATH
cp $QPEDIR / src / qt / qconfig - qpe.h src / tools /
echo yes | . / configure - xplatform linux - ipaq - g ++ - shared - qconfig qpe - qvfb - depths 4 , 8 , 16 , 32
make sub - src
cd ..
(4)编译qt-x11-2.3.2
cd qt - 2.3 . 2
export QTDIR = $PWD
export PATH = $QTDIR / bin:$PATH
export LD_LIBRARY_PATH = $QTDIR / lib:$LD_LIBRARY_PATH
echo yes | . / configure - no - opengl - no - xft
make
make - C tools / qvfb
mv tools / qvfb / qvfb bin
cp bin / uic $QTEDIR / bin
cd ..
(5)编译e2fsprogs-1.3.5
cd e2fsprogs - 1.35
cp - rf lib / uuid $QPEDIR / include
. / configure -- enable - elf - shlibs -- build = i386 - linux -- host = arm - linux -- with - cc =/ usr / local / arm / bin / arm - linux - gcc -- with - linker =/ usr / local / arm / bin / arm - linux - ld
make
cp - rf lib / libuuid.so * $QTEDIR / lib
cd ..
(6)编译qtopia-free-1.7.0
export QTDIR = $QTEDIR
export QPEDIR = $PWD
export PATH = $QPEDIR / bin:$PATH
cd src
. / configure - release - shared - xplatform linux - ipaq - g ++
make
4.编译错误与解决
按照上述脚本进行编译时会出现两个错误,都是在编译qtopia-free-1.7.0是出现的,都需要手动修改Makefile脚本来完成。
(1)出现有关uuid库找不到的错误
找出错误部分的Makefile文件,把里面的:
改为:
在接着编译就可以通过了,这种情况会出现多次,每次遇到时就改下Makefile即可。
(2)链接qpe时出错
错误提示如下:
/ usr / local / arm / bin / .. / lib / gcc - lib / arm - linux / 3.3 / libgcc.a(_divsi3.oS)(.text + 0x0 ): / home / wyang / xscale / src / gcc - 3.3 / gcc / config / arm / lib1funcs.asm: 596 : multiple definition of `__divsi3 '
/ usr / local / arm / bin / .. / lib / gcc - lib / arm - linux / 3.3 / libgcc.a(_umodsi3.oS)(.text + 0x0 ): / home / wyang / xscale / src / gcc - 3.3 / gcc / config / arm / lib1funcs.asm: 540 : multiple definition of `__umodsi3 '
/ usr / local / arm / bin / .. / lib / gcc - lib / arm - linux / 3.3 / libgcc.a(_modsi3.oS)(.text + 0x0 ): / home / wyang / xscale / src / gcc - 3.3 / gcc / config / arm / lib1funcs.asm: 656 : multiple definition of `__modsi3 '
.
.
.
下面还有很多类似的报错
需要修改qtopia-free-1.7.0/src/sever下的Makefile文件,把其中的:
把里面的 -Wl,-whole-archive -Wl,-no-whole-archive删掉,改成如下即可:
5.打包所需文件
mkdir –p ezx-qtopia
rm -rf ezx-qtopia / *
cp -rf qtopia-free- 1.7 . 0 / apps ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / bin ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / etc ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / lib ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / pics ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / sounds ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / plugins ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / services ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / i18n ezx-qtopia /
cp -rf qtopia-free- 1.7 . 0 / help ezx-qtopia /
cp -rf qt- 2.3 . 7 / lib / libqte* ezx-qtopia / lib /
cp -rf qt- 2.3.7/lib/libuuid.so* ezx-qtopia/lib/
cd ezx-qtopia/ lib
mkdir fonts
cd fonts
cp ../../../qt-2.3.7/lib/fonts/*.qpf ./
cp ../../../qt-2.3.7/lib/fonts/fontdir ./
6.由于SD卡是FAT文件系统,无法创建软链接,所以需要打包成cramfs文件系统
总结:
用XScale交叉编译器编译时,跟原来在PMP项目中的ARM交叉编译时,出现的问题更多,原来ARM编译器不会出现上述的两个错误,估计是编译器不同的问题,而且ARM编译器不需要编译e2fsprogs-1.35。