移植qt4.8.1到mini2440

http://hi.baidu.com/wxpool/item/9dd17846613991ab60d7b9c7

交叉编译器:arm-linux-gcc 4.4.3(友善之臂提供)平台:
Ubuntu 10.04
硬件:mini2440,256M Flash,
T35 LCDTslib:Tslib-1.4
==============================================================================

1.slib为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能。
安装tslib

下载tslib(http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2):tslib-1.0.tar.bz2

将tslib-1.0.tar.bz2复制到/tmp目录下,执行命令:

cd /opt

tar -xvjf /tmp/tslib-1.0.tar.bz2

cd tslib-1.0

./autogen.sh

./configure --prefix=/opt/tslib-1.0/install --host=arm-linux ac_cv_func_malloc_0_nonnull=yes

make

make install

若在 ./autogen.sh: 4: autoreconf: not found

  是在不同版本的 tslib 下执行 autogen.sh 产生。它们产生的原因一样,是

因为没有安装

  automake 工具

  sudo apt-get install autoconf automake libtool

安装成功后,会要/opt/tslib-1.0/install目录下有相应的安装文件,然后要对其配置进行一点点的修改,执行如下命令:
cd  /opt/tslib-1.0/install/etc
vi ts.conf

去掉ts.conf中的module_raw input 前面的#号,我的最终ts.conf文件内容为:

# Uncomment if you wish to use the linux input layer event interface

module_raw input

 

# Uncomment if you're using a Sharp Zaurus SL-5500/SL-5000d

# module_raw collie

 

# Uncomment if you're using a Sharp Zaurus SL-C700/C750/C760/C860

# module_raw corgi

 

# Uncomment if you're using a device with a UCB1200/1300/1400 TS interface

# module_raw ucb1x00

 

# Uncomment if you're using an HP iPaq h3600 or similar

# module_raw h3600

 

# Uncomment if you're using a Hitachi Webpad

# module_raw mk712

 

# Uncomment if you're using an IBM Arctic II

# module_raw arctic2

 

module pthres pmin=1

module variance delta=30

module dejitter delta=100

module linear

将tslib下载到开发板,我存放tslib的目录是/usr/local,把编译后生成的bin、lib、etc、include放到此目录下。

在开发板设置环境变量

export TSLIB_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/event0 

export TSLIB_CONFFILE=/usr/local/etc/ts.conf

export TSLIB_PLUGINDIR=/usr/local/lib/ts

export TSLIB_CALIBFILE=/etc/pointercal

export TSLIB_CONSOLEDEVICE=none

export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH


./ts_calibrate 进行测试。如果一切正常,进入下一步移植qt。

 

 

2.、因为QT是跨平台的,同样的程序,在ARM上和PC上都能跑起来,只要修改其编译配置即可,所以为了以后开发效率,可以
在PC上先仿真其效果,所以也安装个QT的Linux/X11版本。

安装QT的Linux/X11版本(http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.1.tar.gz)

下载QT:qt-everywhere-opensource-src-4.8.1.tar.gz

将qt-everywhere-opensource-src-4.8.1.tar.gz复制到/tmp目录下,执行命令:

cd /opt

tar -xvzf /tmp/qt-everywhere-opensource-src-4.8.1.tar.gz

cd qt-everywhere-opensource-src-4.8.1

./configure -prefix /opt/qt-4.8.1-x11

make

make install

为了怕其配置影响下一步的embedded Linux版本的安装,删除/opt/qt-everywhere-opensource-src-4.8.1目录

 

3、安装QT的embedded Linux版本(http://qt-project.org/doc/qt-4.8/installation.html)

将qt-everywhere-opensource-src-4.8.1.tar.gz复制到/tmp目录下(与上一步是同一个文件,若上一步已作了,就不用复制了),执行命令:

cd /opt

tar -xvzf /tmp/qt-everywhere-opensource-src-4.8.1.tar.gz

cd qt-everywhere-opensource-src-4.8.1

./configure -prefix /opt/qt-4.8.1-arm -embedded arm -xplatform qws/linux-arm-g++ -depths 16,18,24,32 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -no-qt3support -no-phonon -no-webkit -no-libtiff -no-libmng -qt-zlib -qt-libpng -qt-libjpeg -no-nis -no-dbus -little-endian -host-little-endian -qt-freetype -qt-gfx-transformed -qt-gfx-vnc -qt-gfx-linuxfb -qt-gfx-multiscreen -qt-kbd-tty -qt-mouse-tslib -I/opt/tslib-1.0/install/include -L/opt/tslib-1.0/install/lib

make

make install

把 /opt/qt-4.8.1-arm目录下的imports、lib、mkspecs 、plugin等目录复制到开发板上的opt/Qtopia目录下

 

4、安装QT Creator

下载qt-creator-linux-x86-opensource-2.4.1.bin   (http://get.qt.nokia.com/qtcreator/qt-creator-linux-x86-opensource-2.4.1.bin)

将qt-creator-linux-x86-opensource-2.4.1.bin复制到/tmp目录下,执行命令:

chmod +x qt-creator-linux-x86-opensource-2.4.1.bin

./qt-creator-linux-x86-opensource-2.4.1.bin

运行QT Creator,点击工具->选项:

进入构建和运行->工具链,点击添加,设置编译器路径为/opt/FriendlyARM/toolschain/4.4.3/bin/arm-linux-g++,点击应用

进入构建和运行->QT版本,点击添加,设置qmake路径为/opt/qt-4.8.1-arm/bin/qmake,点击应用
进入构建和运行->QT版本,点击添加,设置qmake路径为/opt/qt-4.8.1-x11/bin/qmake,点击应用


程序测试
用QT Creator打开一个qt的example或者demo,比如用analogclock这个demo,打开工程中,因为刚才设置了两工具连,所以构建中就可以选择qt-4.8.1-x11或qt-4.8.1-arm平台,这两平台下又有对应的Debug和release版本,先用PC版本平台构建并运行测试一下,没问题后,两构建arm平台的程序,在pc平台下,打开工程后,其默认的配置不用修改就可以编译并运行,但arm平台下,先删除原来的qmake步骤,自己添加一个自定义进程步骤,命令:qmake
                                             工作目录:%{buildDir}
                                              命令参数: %{sourceDir}
并启用这个自定义处理步骤,然后进行编译,编译成功生成analogclock并下载到arm板上。


在程序运行之前,先设置其环境变量,设置的环境变量如下:
export TSLIB_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/event0 

export TSLIB_CONFFILE=/usr/local/etc/ts.conf

export TSLIB_PLUGINDIR=/usr/local/lib/ts

export TSLIB_CALIBFILE=/etc/pointercal

export QTDIR=/opt/Qtopia

export QPEDIR=/opt/Qtopia

export PATH=$QTDIR/bin:$PATH

export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH

export QT_QWS_FONTDIR=/opt/Qtopia/lib/fonts/

export QWS_SIZE=240x320

export set QWS_DISPLAY="LinuxFb:mmWidth80:mmHeight120:0"

export set QWS_DISPLAY="LinuxFB:/dev/fb0" 

export set QWS_MOUSE_PROTO=Tslib:/dev/input/event0

export TSLIB_CONSOLEDEVICE=none


./analogclock -qws  正常情况下,这程序就可以在arm板上运行起来了
若程序中,有字体显示大小不可适,调整以下参数试试。
export set QWS_DISPLAY="LinuxFb:mmWidth80:mmHeight120:0"


一些参考网址
http://blog.chinaunix.net/uid-20788517-id-34707.html
http://blog.chinaunix.net/uid-20788517-id-1748232.html
http://blog.chinaunix.net/uid-20788517-id-34706.html
http://www.arm9home.net/read.php?tid-16101.html



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值