qtopia4.3

http://blog.csdn.net/sabalol/archive/2009/01/08/3737093.aspx

前一阵子,一直是用的qtopia-free-1.7.0.tar.gz,因为这个已经在开发板运行起来了的,但由于要求实现硬件鼠标,所以得去分析 qtopia的源代码;在网上逛了逛,发现qtopia最新完全版已经是4.3.2了,而且界面也十分漂亮,于是就想,既然要分析qtopia的源代码, 为什么不直接使用最新的qt4呢,而且qt4也必将是今后一段时间的主流,于是决定移植最新的qtopia-4.3.2完全版。

概念:
什么是qtopia?
        Qtopia 是一个面向嵌入式 Linux 的全方位应用程序开发平台,同时也是用于基于 Linux 的 PDA (个人数字助理),智能电话( Smartphone )以及其他移动设备的用户界面。简单地说, Qtopia 实质上是一组关于 PDA 和智能电话的应用程序结合,如果需要开发这类产品可以在这组程序的基础上迅速构建出 PDA 或者智能电话。


一、环境:

主机系统:Fedora 10

目标板:重庆神州龙芯科技有限公司的CQ8401工控机开发板,1024x768液晶显示器,PS2鼠标、键盘
CPU: mipsel ,主频400MHz,
内存64M
文件系统:使用nfs(busybox 1.13.1)
硬盘:160G(IDE或SATA)

qtopia版本: qtopia 4.3.2 大小:109.89M
下载地址:ftp://ftp.trolltech.com/qtopia/source/qtopia-opensource-src-4.3.2.tar.gz

交叉编译器:mipsel-linux-gcc, mipsel-linux-g++ //gcc版本3.3.6

二、准备工作:

建立build目录和安装目录:
目录结构:
/opt/qtopia/source 源代码解压到该目录(根据.configure提示,必须为source目录。

/opt/qtopia/target 编译目录:存放configure,make产生的文件(编译目录不能为source目录)

/usr/local/qtopia 安装目录,安装后,复制到nfs文件系统的对应目录下,如:我的nfs文件系统结构为:/nfsroot/cq8401/{bin,etc,lib,opt,tmp,usr,var}

那么就将/usr/local/qtopia这个qtopia目录复制到/nfsroot/cq8401/usr/local目录下,为什么呢?因为你进入开发板上的系统后运行QT应用程序,它会搜索/usr/local/qtopia下的库配置!

三、配置与编译 :

 


由于我之前没有配置这个,导致屏幕中间没有光标出现,只有我的硬件鼠标,但我实现的硬件鼠标还没有与QT的鼠标事件接口

结合上,导致老是点击无效,要猜测QT当前的鼠标位置在哪里!

cd /opt/qtopia/source

# vi qtopiacore/qconfig-qpe.h

首先注释掉关于鼠标光标的宏定义,让程序运行时,屏中央有光标出现:

// Qtopia Core

/*

#ifndef QT_NO_QWS_CURSOR

#  define QT_NO_QWS_CURSOR

#endif

*/

/*

#ifndef QT_NO_QWS_MOUSE

#  define QT_NO_QWS_MOUSE

#endif

#ifndef QT_NO_QWS_MOUSE_AUTO

#  define QT_NO_QWS_MOUSE_AUTO

#endif

*/

其它宏定义根据需要进行注释。

保存后将qconfig-qpe.h拷贝到global目录。

# cp qtopiacore/qconfig-qpe.h  qtopiacore/qt/src/corelib/global/qconfig-qpe.h

注释掉其他文件里的QT_NO_QWS_CURSOR的定义

# vi qtopiacore/qt/src/corelib/global/qfeatures.h

注释掉如下内容:

/*

#if !defined(QT_NO_QWS_CURSOR) && (defined(QT_NO_CURSOR))

#define QT_NO_QWS_CURSOR

#endif

*/

保存退出。


# vi qtopiacore/qt/src/corelib/global/qglobal.h

注释掉以下内容:

//#    define QT_NO_QWS_CURSOR


# cd /opt/qtopia/target

# ../source/configure -release -image /usr/local/qtopia -prefix /usr/local/qtopia -xplatform linux-mips-g++ -arch mips -no-qvfb -displaysize 1024x768 -no-modem -extra-qtopiacore-config "-release -xplatform qws/linux-mips-g++ -embedded mips -qconfig qpe -depths 8,16,32 " 2>../configure_error.log

# make 2>../make_error.log

把错误输出到make_error.log 文件中,不然编译后,你还不知道在哪儿出错了,因为输入信息相当的多!

主要配置选项解说如下:

-release   Create a release build.

-xplatform linux-mips-g++ -arch mips //目标平台为mips-linux,体系结构为mips。(.configure它会怎么检测是大端还是小端CPU,当然,你也可以强制指定:  
-little-endian .........  Force target build to use little endian (LSB first).
-big-endian ............  Force target build to use big endian (MSB first).)
支持的arch列表:alpha, arm, boundschecker, generic, i386, ia64, macosx, mips , parisc, powerpc, s390, sparc, windows, x86_64

-no-qvfb    //目标平台已支持framebuffer,因而不使用虚拟帧缓冲。

-extra-qtopiacore-config //为Qtopia core 配置选项。

-xplatform qws/linux-mips-g++ -embedded mips //目标平台编译配置文件使用qtopiacore/qt/mkspecs/qws/linux-mips-g++目录下的配置文件,嵌入式平台为mips。

-qconfig qpe //使用配置文件qconfig-qpe.h,若使用qconfig-large.h配置文件,则使用-qconfig large选项。

2>../confgure_error.log //最后将配置过程中的错误输出到confgure_error.log文件中。

在编译安装完成后,在/usr/local/qtopia 中的东西就是Qtopia在mipsel上运行所需要的文件

建立时区信息:

复制刚才编译目录下:/opt/qtopia/target/etc/zoneinfo目录到nfs文件系统的usr/share目录下,我的就是

# cp -a /opt/qtopia/target/etc/zoneinfo /nfsroot/cq8401/usr/share/

然后复制主机:/usr/local/qtopia目录到nfs文件系统相应的目录下:(共74M)

# cp -a /usr/local/qtopia /nfsroot/cq8401/usr/local/
 

 


四、进入开发板,配置与运行

好了,现在进入开发板系统中:

环境设置:(最好把它们写到/etc/profile文件中,免得每次重启系统后,都要重输一遍)

export HOME=/root   #设置用户目录,QT运行后,相应的配置文件,文档就存放在用户主目录下
export PATH=/usr/local/qtopia/bin:$PATH   #设置QT程序搜索路径
export LD_LIBRARY_PATH=/usr/local/qtopia/lib:$LD_LIBRARY_PATH   #设置QT库搜索路径
export QWS_KEYBOARD_PROTO=TTY:/dev/tty0    #设置键盘
export QWS_MOUSE_PROTO=MouseMan:/dev/input/mice   #设置鼠标设置
export TZ=Asia/Chongqing #此句设置时区,可以为Beijing,或Shanghai,我在重庆,所以就设置为Chongqing了
export QWS_DISPLAY="LinuxFb:mmWidth35:mmHeight45:0" #此句显示字体和图标。

完成后,在命令行执行

# qpe -qws&

如果看到目标板屏幕上启动的Qtopia 说明已经成功了。

=========================================================

http://hi.baidu.com/ruanbanyong/blog/item/953537de4e61ee14632798d4.html

最近在论坛上看到许多朋友在交叉编译Qtopia-opensource-src-4.3.2时出现很多问题,而不能继续。

本人一直以来都不会使用新版本的开发库,一个原因是新的东东用的人少,网上资料也少,问题解决办法不容易查得到,而且我的arm CPU也跟不上。

以下是我的完全的交叉编译过程,希望能对您有所帮助。

我的主机系统:FC6

目标板:Arm 9200

目标板文件系统:cramfs

可以在网上下载该Qtopia版本:ftp://ftp.trolltech.com/qtopia/source/qtopia-opensource-src-4.3.2.tar.gz

总共大小:109.89M

交叉编译器:cross-3.3.2

解压到目录:/root/Qtopia4/source

创建目标:/root/Qtopia4/target         存放make 所产生的文件

创建安装目录:/mnt/nfs/image         存放make install 所产生的文件,也是arm板上所执行文件,我是采用nfs方式来和arm板连接的

修改时区信息

# vi src/libraries/qtopia/qtimezone.cpp

将 /usr/share/zoneinfo/ 改为/mnt/nfs/qtopia4/qtopiatslibtarget/zoneinfo/ ,保存退出。

# vi src/settings/systemtime/settime.cpp

将 /usr/share/zoneinfo/ 改为/mnt/nfs/qtopia4/qtopiatslibtarget/zoneinfo/ ,保存退出。

裁减Qtopia core的库

# vi qtopiacore/qconfig-qpe.h

首先注释掉关于鼠标光标的宏定义,让程序运行时,触摸屏中央有光标出现:

// Qtopia Core

/*

#ifndef QT_NO_QWS_CURSOR

# define QT_NO_QWS_CURSOR

#endif

*/

/*

#ifndef QT_NO_QWS_MOUSE

# define QT_NO_QWS_MOUSE

#endif

#ifndef QT_NO_QWS_MOUSE_AUTO

# define QT_NO_QWS_MOUSE_AUTO

#endif

*/

其它宏定义根据需要进行注释。

保存后将qconfig-qpe.h拷贝到global目录。

# cp qtopiacore/qconfig-qpe.h qtopiacore/qt/src/corelib/

global/qconfig-qpe.h

注释掉其他文件里的QT_NO_QWS_CURSOR的定义

# vi qtopiacore/qt/src/corelib/global/qfeatures.h

注释掉如下内容:

/*

#if !defined(QT_NO_QWS_CURSOR) && (defined(QT_NO_CURSOR))

#define QT_NO_QWS_CURSOR

#endif

*/

保存退出。


# vi qtopiacore/qt/src/corelib/global/qglobal.h

注释掉以下内容:

//#    define QT_NO_QWS_CURSOR


Qtopia4移植过程配置源码包

进入/root/Qtopia4/target目录

#../source/configure -release -image /mnt/nfs/image -prefix /mnt/nfs/image -xplatform linux-arm-g++ -arch arm -no-qvfb -displaysize 640x480 -no-modem -extra-qtopiacore-config "-release -xplatform qws/linux-arm-g++ -embedded arm -qconfig qpe -depths 4,8,16,32 -qt-mouse-linuxtp " 2>../confgureERR.txt

主要配置选项解说如下:

-xplatform linux-arm-g++ -arch arm

目标平台为arm-linux,体系结构为arm。


-no-qvfb

目标平台已支持framebuffer,因而不使用虚拟帧缓冲。


-extra-qtopiacore-config

为Qtopia core 配置选项。


-xplatform qws/linux-arm-g++ -embedded arm

目标平台编译配置文件使用qtopiacore/qt/mkspecs/qws/linux-arm-g++目录下的配置文件,嵌入式平台为arm。


-qconfig qpe

使用配置文件qconfig-qpe.h,若使用qconfig-large.h配置文件,则使用-qconfig large选项。


-qt-mouse-linuxtp

触摸屏协议支持linuxtp
2>../confgureERR.txt

最后将配置过程中的错误输出到confgureERR.txt文件中。

# make 2>../makeERR.txt

# make install

在编译安装完成后,在/mnt/nfs/image 中就是Qtopia在arm上运行所需要的文件


建立时区信息

# cd $QTOPIATARG

# mkdir zoneinfo

# cp -a /usr/share/zoneinfo/* /mnt/nfs/image/zoneinfo/

到这一步主机上的工作已经基本完成。

NFS连接主机,进入目标板系统,mount -t nfs 主机地址:/mnt/nfs /mnt/nfs -o nolock

输入目标板环境设置

export PATH=/mnt/nfs/image/bin:$PATH
export LD_LIBRARY_PATH=/mnt/nfs/image/lib:$LD_LIBRARY_PATH

export QWS_MOUSE_PROTO=LinuxTP:/dev/touchscreen/0 待选: /dev/input/mice

export QWS_DISPLAY="LinuxFb:mmWidth35:mmHeight45:0" 此句显示字体和图标。

后执行qpe -qws&

就可以看到目标板屏幕上启动的Qtopia 说明您已经成功了。

注:
a 由于在pc机上安装的时候qtopia的image的存放路径是file:/mnt/nfs/image.
所以在板子上的存放路径也必须跟其一致。否则会出错。如下:
**********************************************************
* ERROR: Expecting this binary to be located in
* /opt/arm-qt/qt-arm-bin/bin/qpe
* but it is being run from
* /Qtopia/bin/qpe
*
* This generally indicates that you have specified the wrong
* value for -prefix when configuring Qtopia. Based on the
* location of this binary, you should be using a prefix of
* /Qtopia
**********************************************************

b 另外会提示如下错误:
Could not read calibration: "/etc/pointercal"
查看的在/etc目录下没有pointercal文件,而自己的qpe怎么也起不来五点校正图片,可以用tslib来校正一下,这边就不说明了。

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lanmanck/archive/2009/08/04/4402942.aspx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章