前传,利用android开发环境来开发qt-embedded程序

5 篇文章 0 订阅
3 篇文章 0 订阅
众所周知,android开发环境是java的环境,而且不同于j2me的开发。尽管可以通过jni来调用本地库来完成部分任务,但是本地库的编写和调试还是没有想象中的那么方便。不过话扯远了,我们今天讨论的并非android应用程序的开发,也不是android底层秘密的探讨。而是如何在android丰富的调试开发环境之上,来开发和调试另外一套嵌入式图形开发系统。而今天是拿qt-embedded来作为例子讲述的。
首先我们需要验证qt-embedded程序是否可以很顺利的跑在android的模拟器上面。我们采用的toolchain是来自codesourcery的,qt源代码是基于4.6.0的。目前是最新的源代码和toolchain。而android的模拟器我们也是采用目前最新的, eclair版本。
I 从codesourcery官方网站获取arm工具链
http://www.codesourcery.com/sgpp/lite/arm/portal/package5383/public/arm-none-linux-gnueabi/arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
# mkdir /opt/codesourcery
# cd /opt/codesourcery
# wget -c http://www.codesourcery.com/sgpp/lite/arm/portal/package5383/public/arm-none-linux-gnueabi/arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
# tar xf arm-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
# export PATH=$PATH:/opt/codesourcery/arm-2009q3/bin

II 从nokia获取qt的源代码
# wget -c http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.0.tar.gz
# tar xf qt-everywhere-opensource-src-4.6.0.tar.gz
# cd qt-everywhere-opensource-src-4.6.0

III 修改qt的源代码
    1. modify the toolchain
    vi mkspecs/qws/linux-arm-g++/qmake.conf
        change all "arm-linux-" to "arm-none-linux-gnueabi-"
    2. modify the tmp directory
    vi src/gui/embedded/qvfbhdr.h
        change all "/tmp" to "/sqlite_stmt_journals" or to "/data/data"
    3. modify the fonts' directory
        or set QT_QWS_FONTDIR on run time
    for example, export QT_QWS_FONTDIR="/system/fonts"
    4. modify the display device
    linuxfb
        or set -display "LinuxFb:/dev/graphics/fb0"
    5. modify the mouse driver
    linuxinput
    or set export QWS_MOUSE_PROTO on run time
    for example, export QWS_MOUSE_PROTO="LinuxInput:/dev/input/event0"
    6. modify the keyboard driver
    tty or linuxinput
    7. modify the /etc/pointercal directory
    or set POINTERCAL_FILE on run time
    for example, export POINTERCAL_FILE="/sqlite_stmt_journals/pointercal"

IV 构建和安装
# mkdir build-static
# cd build-static
# ../qt-everywhere-opensource-src-4.6.0/configure -embedded arm -static -release -prefix /system -qt-mouse-linuxinput -no-mouse-pc -no-mouse-linuxtp -qt-gfx-transformed -qt-gfx-vnc
# make
# make install

V 安装到android模拟器上面

VI 在android模拟器或者硬件上运行qt-embedded程序
export POINTERCAL_FILE=/sqlite_stmt_journals/pointercal
export QT_QWS_FONTDIR=/system/fonts
export QWS_MOUSE_PROTO="LinuxInput:/dev/input/event0"
./animatedtiles -qws -display "LinuxFb:/dev/graphics/fb0"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值