一.我的环境及所需资源:
PC机操作系统:基于VMware7.1.4上的Fedora 14操作系统
交叉编译工具:arm-linux-gcc-4.3.2.tar.gz
所需资源: tslib-1.4.tar.gz
qt-everywhere-opensource-src-4.7.4.tar.gz
tslib-1.4.tar.gz源码以及该文档可以再以下链接下载:
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2012年资料/8月/16日/Fedora 14 安装QT和QT-Embedded
二.安装交叉编译环境:
把arm-linux-gcc-4.3.2.tar.gz放到/tmp 目录下
# tar xzvf arm-linux-gcc-4.3.2.tar.gz -C /
# vim /root/.bashrc
编辑/root/.bashrc文件,在最后一行添加:
export PATH=$PATH:/usr/local/arm/4.3.2/bin
保存退出后回到终端,然后使得刚才添加的环境变量生效:
# source /root/.bashrc
# arm-linux-gcc -v 可以看到版本信息
三.安装QT X11 Requirements 下面的库文件 (如果安装fedora 选择软件开发环境这步可以省略)
libfontconfig1-dev
libfreetype6-dev
libx11-dev
libxcursor-dev
libxext-dev
libxfixes-dev
libxft-dev
libxi-dev
libxrandr-dev
libxrender-dev
依次运行类似命令: yum install libfontconfig1-dev
四.安装qvfb 所需库文件(qvfb是一个在PC机上模拟在开发板上运行qtopia以及自己开发的QtE程序的虚拟帧缓冲区)
libXtst-devel
即运行:yum install libXtst-devel
五.安装Qt for PC(X11)
1.1、 建立目录Qt目录
mkdir /opt/FriendlyARM/mini2440/Qt
1.2、 解压qt-everywhere-opensource-src-4.7.4.tar.gz 并更改目录名
tar xvzf qt-everywhere-opensource-src-4.7.4.tar.gz -C /opt/FriendlyARM/mini2440/Qt
cd /opt/FriendlyARM/mini2440/Qt
mv qt-everywhere-opensource-src-4.7.4 qt-for-x11
1.3、 开始配置文件:
# cd qt-for-x11
#. /configure
接着提示要使用商业版还是开源版:输入o后回车选择开源版;
然后提示可以使用开源协议:输入yes后回车即可。
1.4、 #gmake //编译,这个过程要等几个小时的时间
1.5、 #gmake install //开始安装基于PC上的Qt
1.6、 安装目录在新生成的目录下面:/usr/local/Trolltech/Qt-4.7.4
1.7、 使用时需添加
#export PATH=” /usr/local/Trolltech/Qt-4.7.1/bin:$PATH”
然后输入#qmake –v (如能输出版本号,则说明安装成功)
1.8、 编译qvfb(Virtual Framebuffer) 为QT-embedded X86 作准备
1.8.1、# cd /opt/FriendlyARM/mini2440/Qt/qt-for-x11/tools/qvfb
1.8.2、# gmake (编译后qvfb存在/opt/FriendlyARM/mini2440/Qt /qt-for-x11/bin目录中)
1.8.3、# cd /opt/FriendlyARM/mini2440/Qt /qt-for-x11/bin/
1.8.4、# ./qvfb (进行检验,如能输出一个虚拟窗口,则说明安装正常)
1.8.4、将qvfb拷贝到QTDIR/bin路径下:
cp qvfb /usr/local/Trolltech/Qt-4.7.4/bin
六.安装QT for Embedded for X86 嵌入式X86
1.1、解压qt-everywhere-opensource-src-4.7.4.tar.gz 并更改目录名
tar xvzf qt-everywhere-opensource-src-4.7.4.tar.gz -C /opt/FriendlyARM/mini2440/Qt
cd /opt/FriendlyARM/mini2440/Qt
mv qt-everywhere-opensource-src-4.7.4 qt-for-x86
1.2、 进入对应文件夹并配置
#cd /opt/FriendlyARM/mini2440/Qt/qt-for-x86
#./configure -embedded x86 -qt-gfx-qvfb -qt-kbd-qvfb -qt-mouse-qvfb //配置
接着提示要使用商业版还是开源版:输入o后回车选择开源版;
然后提示可以使用开源协议:输入yes后回车即可。
1.3.、#gmake //编译,这个过程要等几个小时的时间
1.4、#gmake install
1.5、安装目录在/usr/local/Trolltech/QtEmbedded-4.7.4/
1.6、使用时需添加
#export PATH=” /usr/local/Trolltech/QtEmbedded-4.7.1/bin:$PATH”
然后输入#qmake –v (如能输出版本号,则说明安装成功)
1.1 安装qvfb
将第五步中1.8中编译成功的qvfb复制到/usr/local/Trolltech/QtEmbedded-4.7.4/bin/中,则可。
七. 为安装QT for Embedded for ARM 的准备工作
1.安装交叉编译工具arm-linux-gcc-4.3.2
1.1、tar xvzf arm-linux-gcc-4.3.2.tgz –C / (C需要大写,解压后安装在/usr/local/arm/4.3.2/)
1.2、#vi /etc/profile (添加PATH)
export PATH=”$PATH:/usr/local/arm/4.3.2/bin”
保存退出后在终端输入:
# source /etc/profile
1.3、测试是否安装成功 arm-linux-gcc -v 会显示arm-linux-gcc版本,则说明安装成功。
2.交叉编译tslib-1.4 安装移植 (需要交叉编译工具, QT4只是支持tslib-1.4)
1.1、解压tslib-1.4.tar.gz
tar xvzf tslib-1.4.tar.gz –C /opt/FriendlyARM/mini2440/Qt
1.2、#cd /opt/FriendlyARM/mini2440/Qt /tslib/
进入tslib之后关键是要设置交叉编译环境(下面是根据我自己的实际情况所添加的)——如果不设置交叉编译环境,在移植到开发板时,执行./ts_calibrate程序时会出现以下错误:
./ts_calibrate: line 1: syntax error :”(” unexpected.
#export PATH=$PATH:/usr/local/arm/4.3.2/bin
#export CC=/usr/local/arm/4.3.2/bin/arm-linux-gcc //设定C编译器
#export CXX=/usr/local/arm/4.3.2/bin/arm-linux-g++ //设定C++编译器
1.3、#./autogen.sh (如果运行有错误则需要安装autoconf、automake、libtool (如yum install autoconf))
1.4、#echo “ac_cv_func_malloc_0_nonnull=yes” >arm-linux.cache //避免检查ac_cv_func_malloc_0_nonnull
1.5、# ./configure –host=arm-linux –cache-file=arm-linux.cache -prefix=/usr/local/tslib
1.6、gmake
1.7、gmake install (安装在/usr/local/tslib里面)
1.8、#vi /usr/local/tslib/etc/ts.conf (修改ts.conf) 最后内容如下:
module_raw input //前面不能有空格,否则会出现段错误
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
1.9、(以下是在对应的开发版上使用)
将上面整个tslib的内容打包,下载到开发版里的对应路径下 (/usr/local/),或自己指定的路径下,然后设置相应的环境变量。
配置环境变量,可以在/etc/profile最后添加以下内容:
#export QTDIR=/usr/local/lib-for-QtE //这是预先设置的,因为安装完QtE后会用到这个环境变量
#export T_ROOT=/tslib
#export PATH=$QTDIR/bin:$T_ROOT/bin:$PATH
#export TSLIB_CONSOLEDEVICE=none
#export TSLIB_FBDEVICE=/dev/fb0
#export TSLIB_TSDEVICE=/dev/input/event0
#export TSLIB_PLUGINDIR=$T_ROOT/lib/ts
#export TSLIB_CONFFILE=$T_ROOT/etc/ts.conf
#export TSLIB_CALIBFILE=/etc/pointercal
#export QWS_MOUSE_PROTO=tslib:/dev/input/event0
#export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR/lib
若在相应的文件夹里没有相应的fb0、event0模块,则cd到开发板的根目录里,然后执行:
mknod /dev/fb0 c 29 0
mknod /dev/input c 13 64
而对于/etc/pointercal文件,需要再开发板的触摸屏执行完五点校正后才会生成此文件。
重启MINI2440,在终端下输入
#ts_calibrate
出现tslib的触摸屏五点校准画面,至此,tslib的安装移植成功完成。
# ts_test //触摸屏测试
可以参考以下链接来编译安装tslib:
http://www.linuxidc.com/Linux/2012-08/68410.htm
http://www.linuxidc.com/Linux/2012-08/68411.htm
八. 安装QT for Embedded for ARM 嵌入式ARM
1.1、解压qt-everywhere-opensource-src-4.7.4.tar.gz 并更改目录名
tar xvzf qt-everywhere-opensource-src-4.7.4.tar.gz -C /opt/FriendlyARM/mini2440/Qt
cd /opt/FriendlyARM/mini2440/Qt
mv qt-everywhere-opensource-src-4.7.4 qt-for-arm
1.2、 进入对应文件夹并配置
#cd /opt/FriendlyARM/mini2440/Qt/qt-for-arm
#./configure -embedded arm -xplatform qws/linux-arm-g++ -qt-libtiff -qt-libmng -qt-mouse-tslib -I/usr/local/tslib/include -L/usr/local/tslib/lib
接着提示要使用商业版还是开源版:输入o后回车选择开源版;
然后提示可以使用开源协议:输入yes后回车即可。
1.3.、#gmake //编译,这个过程要等几个小时的时间
1.4、#gmake install
1.5、安装目录在/usr/local/Trolltech/QtEmbedded-4.7.4-arm/
1.6、使用时需添加
#export PATH=” /usr/local/Trolltech/QtEmbedded-4.7.4-arm/bin:$PATH”
然后输入#qmake –v (如能输出版本号,则说明安装成功)
1.7、将相应的库文件与工具移植到开发板的根文件系统的相应位置
执行以下附件的操作。
九.建立三个文件,用于三个环境进行设置 可以用vi 、gedit 、emacs、vim
1.1、新建.setenv-qt-X11.sh
# vim /root/.setenv-qt-X11.sh //在文件是输入 :
export PATH=/usr/local/Trolltech/Qt-4.7.1/bin:$PATH
export QTDIR=/usr/local/Trolltech/Qt-4.7.1/
export LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.7.1/lib: $LD_LIBRARY_PATH
1.2、//新建.setenv-qt-X86.sh
#vim /root/.setenv-qt-X86.shh //在文件是输入
export PATH=/usr/local/Trolltech/QtEmbedded-4.7.1/bin:$PATH
export QTEDIR=/usr/local/Trolltech/QtEmbedded-4.7.1/
export LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.7.1/lib:$LD_LIBRARY_PATH
1.3、新建.setenv-qt-arm.sh
# vim /root/.setenv-qt-arm.sh //在文件是输入
export PATH=/usr/local/Trolltech/QtEmbedded-4.7.4-arm/bin:$PATH
export QTEDIR=/usr/local/Trolltech/QtEmbedded-4.7.4-arm/
export LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.7.1/lib:$LD_LIBRARY_PATH
1.4、在相应的终端里输入以下指令以设置需要使用的开发环境的环境变量
# source ~/.setenv-qt-arm.sh //设置QtE的环境变量
附件:
建立脚本文件mktarget
# gedit mktarget
然后将以下代码内容拷贝进去:
(完成后在当前目录执行
# ./mktarget //接着会生成一个target-qte-4.7.4.tgz的压缩包
//将生成的压缩包解压到根文件系统的相应位置,我的开发板的根文件体统凡在/root/tftp 目录下的roo_qtopia目录下。
# tar –xvzf target-qte-4.7.4.tgz –C ~/tftp/root_qtopia
//此时会在开发板的根文件系统的/usr/local/ 路径下生成所需要的Trolltech目录,里面就包含所运行QtE程序所需要的库文件等内容。)
#!/bin/bash
TARGET_DIR=$PWD
cd /
list=`cat << EOF
usr/local/Trolltech/QtEmbedded-4.7.4-arm/examples/widgets/wiggly/wiggly
usr/local/Trolltech/QtEmbedded-4.7.4-arm/examples/painting/concentriccircles/concentriccircles
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSql.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtXml.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSvg.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSql.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScript.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtXml.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtMultimedia.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScriptTools.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtGui.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSql.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtGui.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtXml.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtCore.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtGui.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQt3Support.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtTest.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtCore.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/fonts/unifont_160_50.qpf
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSvg.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtNetwork.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQt3Support.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScript.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScriptTools.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtNetwork.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScript.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtNetwork.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtTest.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSql.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtMultimedia.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtTest.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQt3Support.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtTest.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtCore.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScriptTools.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtMultimedia.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSvg.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtXml.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtCore.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScriptTools.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtNetwork.so.4.7.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtMultimedia.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtScript.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtGui.so.4.7
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQt3Support.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/lib/libQtSvg.so.4
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/sqldrivers/libqsqlite.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/accessible/libqtaccessiblewidgets.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/accessible/libqtaccessiblecompatwidgets.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/iconengines/libqsvgicon.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/imageformats/libqico.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/imageformats/libqsvg.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/imageformats/libqtiff.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/imageformats/libqjpeg.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/imageformats/libqmng.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/plugins/imageformats/libqgif.so
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/deform/deform
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/deform/pathdeform.html
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/embeddedsvgviewer/spheres.svg
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/embeddedsvgviewer/embeddedsvgviewer
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/embeddedsvgviewer/shapes.svg
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/embeddedsvgviewer/files/default.svg
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/embeddedsvgviewer/files/v-slider-handle.svg
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/desktopservices_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/deform.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/flightinfo_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/raycasting.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/digiflip.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/styledemo.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/styledemo_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/mediaplayer.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/weatherinfo.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/concentriccircles.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/context2d_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/wiggly.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/lightmaps.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/elasticnodes.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/wiggly_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/ftp_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/embeddedsvgviewer_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/anomaly_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/flickable.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/softkeys_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/fridgemagnets_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/saxbookmarks_s60.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/screenshots/pathstroke.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/slides/demo_4.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/slides/demo_1.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/slides/demo_2.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/slides/demo_6.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/slides/demo_3.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/slides/demo_5.png
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/fluidlauncher
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/fluidlauncher/config.xml
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/embedded/styledemo/styledemo
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/pathstroke/pathstroke.html
usr/local/Trolltech/QtEmbedded-4.7.4-arm/demos/pathstroke/pathstroke
EOF
`
tar cfvz $TARGET_DIR/target-qte-4.7.4.tgz $list