成功移植Qt4到mini2440.docx

上传人:b****5 文档编号:3325417 上传时间:2022-11-21 格式:DOCX 页数:11 大小:1.11MB
下载 相关 举报
成功移植Qt4到mini2440.docx_第1页
第1页 / 共11页
成功移植Qt4到mini2440.docx_第2页
第2页 / 共11页
成功移植Qt4到mini2440.docx_第3页
第3页 / 共11页
成功移植Qt4到mini2440.docx_第4页
第4页 / 共11页
成功移植Qt4到mini2440.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

成功移植Qt4到mini2440.docx

《成功移植Qt4到mini2440.docx》由会员分享,可在线阅读,更多相关《成功移植Qt4到mini2440.docx(11页珍藏版)》请在冰豆网上搜索。

成功移植Qt4到mini2440.docx

成功移植Qt4到mini2440

成功移植Qt-embeded-opensource-4.5.0到mini2440上:

开发环境:

虚拟机:

VM6.5

虚拟机系统:

Fedora9–linux2.6.25

开发板:

mini2440-128M,内有linux2.6.32内核及所有驱动,以及qtopia2.2.0文件系统

编译器:

gcc-4.2.1(fedora9系统自带)arm-linux-gcc-4.3.2(友善提供)

源码准备:

tslib-1.4.1.tar.bz2

qt-x11-opensource-src-4.5.0.tar.bz2

qt-embedded-linux-opensource-src-4.5.0.tar.bz2

qt-creator-linux-x86-opensource-1.3.0.bin

qt-sdk-win-opensource-2010.02.1.exe

开发步骤:

1.安装交叉编译器arm-linux-gcc-4.3.2

将光盘中的arm-linux-gcc-4.3.2.tgz复制到某个目录下,然后进入到该目录,执行解压命令:

tarxvzfarm-linux-gcc-4.3.2.tgz-C/

注意:

C后面有个空格,并且C是大写的,它是英文单词“Change”的第一个字母,在此是改变目录的意思。

把编译器路径加入系统环境变量,运行命令

gedit/root/.bashrc

编辑/root/.bashrc文件,在最后一行exportPATH=$PATH:

/usr/local/arm/4.3.2/bin

如图,保存退出。

执行该命令,将把arm-linux-gcc安装到/usr/loca/arm/4.3.2目录。

确认arm-linux-gcc-v

2.安装tslib-1.4.1

1).解压源码包tslib-1.4.1.tar.bz2(天嵌提供的用tarxvfj…解压)到当前目录得到tslib-1.4.1目录。

2)创建目录mytslib(mkidrmytslib)。

3)进入tslib-1.4.1目录(当前目录是/home/abilly/tslib-1.4.1)

#./configure--prefix=/home/abilly/mytslib/--host=arm-linuxac_cv_func_malloc_0_nonnull=yes

#make

#makeinstall

即完成了tslib-1.4.1的按装

3.编译及安装qt-x11-opensource-src-4.5.0

qt-x11版本可以产生Qt开发工具,如designer等等,最重要的是可以得到qvfb,嵌入式的开发有了qvfb,就可以不需要实际的开发板,也可以开发Qt应程序。

qt-embedded版本就是专门用于嵌入式方面的版本。

tarxjvfqt-x11-opensource-src-4.5.0.tar.bz2

cdqt-x11-opensource-src-4.5.0

./configure(4分钟)

make(近2小时)

makeinstall

历经漫长的编译过程,默认安装在/usr/local/Trolltech/Qt-4.5.0下.编译完成后源程序不要删除,还有用。

4.编译及安装qt-embedded-linux-opensource-src-4.5.0x86版本

将qt-embedded-linux-opensource-src-4.5.0.tar.bz2解压得到qt-embedded-linux-opensource-src-4.5.0,重命名为qt-embedded-linux-opensource-src-4.5.0-x86.再次解压qt-embedded-linux-opensource-src-4.5.0.tar.bz2,并重命令为qt-embedded-linux-opensource-src-4.5.0-arm.为什么有两个复制呢?

我们可以从他们的名字上就不难看出前者是适合x架构的,后者适合arm架构的,如果有开发板的话,可以只编译qt-embedded版本成arm架构的就可以了,但是很多时候用qvfb的话,开发会方便很多,所以多编译一个x86架构的也不错。

tarxjvfqt-embedded-linux-opensource-src-4.5.0.tar.bz2

mvqt-embedded-linux-opensource-src-4.5.0qt-embedded-linux-opensource-src-4.5.0-x86

tarxjvfqt-embedded-linux-opensource-src-4.5.0.tar.bz2

mvqt-embedded-linux-opensource-src-4.5.0qt-embedded-linux-opensource-src-4.5.0-arm

cdqt-embedded-linux-opensource-src-4.5.0-x86

./configure-prefix/usr/local/Trolltech/QtEmbedded-4.5.0-x86-embeddedx86–qvfb(4分钟)

make(1.5小时)(8:

45~10:

15)

makeinstall

qt-embedded-x86被安装在/usr/local/Trolltech/QtEmbedded-4.5.0-x86下.

5.编译及安装qt-embedded-linux-opensource-src-4.5.0ARM版本

cdqt-embedded-linux-opensource-src-4.5.0-arm

./configure-prefix/usr/local/Trolltech/QtEmbedded-4.5.0-arm-release-shared-little-endian-no-qt3support-no-libtiff-no-libmng-qt-libjpeg-qt-gif-qt-zlib-qt-libpng-no-freetype-no-openssl-nomakeexamples-nomakedemos-nomaketools-optimized-qmake-no-phonon-no-nis-no-opengl-no-cups-no-separate-debug-info-xplatformqws/linux-arm-g++-embeddedarm-depths4,8,16,32-qt-mouse-tslib-I/home/abilly/mytslib/include-L/home/abilly/mytslib/lib&&

#gmake

#gmakeinstall

qt-embedded-arm被安装在/usr/local/Trolltech/QtEmbedded-4.5.0-arm下.

(当然可以写成一个sehll脚本。

6.做到这一步还有qvfb没有编译,到qt-x11-opensource-src-4.5.0中重新编译qvfb即可

cdqt-x11-opensource-src-4.5.0

cd/tools/qvfb

make--会在qt-x11-opensource-src-4.5.0/bin下生成qvfb,我们将它copy至/usr/local/Trolltech/QtEmbedded-4.5.0-x86/bin下

cp../../bin/qvfb/usr/local/Trolltech/QtEmbedded-4.5.0-x86/bin/

7.至此我们已经安装好了qt-x11版,即在PC机上运行的QT,qt-embedded-x86版(x86体系的嵌入式板子上运行的QT)和qt-embedded-arm(arm板子上运行的QT).下一步:

设置环境变量

编辑#geditsetX86env.sh内容如下:

#!

/bin/sh

PATH=/usr/local/Trolltech/Qt-4.5.0/bin:

$PATH

LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.5.0/lib:

$LD_LIBRARY_PATH

QTEDIR=/usr/local/Trolltech/QtEmbedded-4.5.0-x86:

$QTEDIR

PATH=/usr/local/Trolltech/QtEmbedded-4.5.0-x86/bin:

$PATH

LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.5.0-x86/lib:

$LD_LIBRARY_PATH

编辑#geditsetARMenv.sh内容如下:

#!

/bin/sh

PATH=/usr/local/Trolltech/Qt-4.5.0/bin:

$PATH

LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.5.0/lib:

$LD_LIBRARY_PATH

QTEIR=/usr/local/Trolltech/QtEmbedded-4.5.0-arm:

$QTDIR

PATH=/usr/local/Trolltech/QtEmbedded-4.5.0-arm/bin:

$PATH

LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.5.0-arm/lib:

$LD_LIBRARY_PATH

8.做一个测试(X86上的)

cd/usr/local/Trolltech/QtEmbedded-4.5.0-x86

sourcesetX86env.sh

cd/usr/local/Trolltech/QtEmbedded-4.5.0-x86/demos/books

qvfb-width640-height480&

./books–qws

如图:

9.Qt4arm版本文件系统移植到mini2440上

是在原来的root_qtopia文件系统的基础上构建的,前提准备:

NFS挂载root_qtopia文件系统

1).在opt/下新建目录qt4.5.0/和qt4.5.0/plugin;qt4.5.0/bin

将/usr/local/Trolltech/QtEmbedded-4.5.0-arm/lib目录的全部内容(含lib)拷贝到qt4.5.0/下(以后知道哪些不必要的再考虑删除)

将/usr/local/Trolltech/QtEmbedded-4.5.0-arm/plugins/imageformats目录的全部内容(含imageformats)拷贝到qt4.5.0/plugin下

将/usr/local/Trolltech/QtEmbedded-4.5.0-arm/demos/mainwindow下的mainwindow拷贝到qt4.5.0/bin下(由于前面的qt4.5.0的arm版的配置中没有配置编译demos故可以自己在x86下的相应目录下编译arm版的mainwindow执行程序。

2)编写qt4运行环境变量设置脚本qt4.5.0,放到/bin目录下修改权限为777可执行。

内容如下:

#!

/bin/sh

exportsetTSLIB_TSDEVICE=/dev/input/event0

exportsetTSLIB_CONFFILE=/usr/local/etc/ts.conf

exportsetTSLIB_PLUGINDIR=/usr/local/lib/ts

exportsetTSLIB_CALIBFILE=/etc/pointercal

exportsetQTDIR=/opt/qt4.5.0

exportsetQPEDIR=/opt/qt4.5.0

exportsetQWS_DISPLAY="LinuxFB:

/dev/fb0"

exportsetQWS_DISPLAY="LinuxFB:

mmWidth130:

mmHeight100:

0"

exportsetQWS_KEYBOARD=TTY:

/dev/tty1

exportsetQWS_MOUSE_PROTO="TSLIB:

/dev/input/event0"

exportsetQT_PLUGIN_PATH=$QTDIR/plugins/

exportsetQT_QWS_FONTDIR=$QTDIR/lib/fonts/

exportsetHOME=/root

exportsetPATH=$QTDIR/bin:

$PATH

exportsetLD_LIBRARY_PATH=$QTDIR/lib:

/usr/local/lib:

$LD_LIBRARY_PATH

(这里的触摸屏相关设置与qtopia的一致,是因为qtopia使用的就是tslib-1.4.1因此不需拷贝自己编译的tslib相关库和配置文件,但是是必须编译tslib的否则qt4中的tslib是不能用的。

3)设置rcS运行qt4应用程序。

注释掉qtopia的运行

#/bin/qtopia&

#echo"">/dev/tty1

#echo"StartingQtopia,pleasewaiting...">/dev/tty1

改为qt4程序的运行

source/bin/qt4.5.0

if[-f/etc/pointercal];then

$QPEDIR/bin/books-qws

>/dev/null2>/dev/null

else

/usr/local/bin/ts_calibrate触摸屏校正程序

$QPEDIR/bin/books-qws

>/dev/null2>/dev/null

fi

10.运行效果:

(摄像头拍摄不是很清楚)

 

11.qtcreator的安装与使用,以及qt4程序的一次编写,到处编译运行的效果。

Win_xp下安装qtcreator:

下载QtSDK2010.02.1(包含qt4.6.2与qtcreator1.3.1)与安装略。

编写hello程序,运行效果:

Linux下的编译与运行hello程序,安装qtcreator1.3.1略(参考TQ的QT4编译视频教程),设置编译选项及编译工具qmake的路径后。

这表明linux下的qt4_x86和arm版本都编译好了可以使用了。

编译x86版(拷贝xp下的hello工程全部文件到linux下)使用qtcreator打开后,先clean后在rebuild.

在MINI2440上的运行hello程序效果:

可见在mini2440上运行帧缓冲相当于linuxPC下的qvfb。

程序在界面是浮动的。

效果不是太好,而且界面的大小不好控制,唯一的好处是可以一次编写程序,到处编译运行。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 学科竞赛

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1