Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1249641
  • 博文数量: 479
  • 博客积分: 12240
  • 博客等级: 上将
  • 技术积分: 4999
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-24 17:12
文章分类

全部博文(479)

文章存档

2014年(1)

2013年(1)

2012年(1)

2011年(95)

2010年(177)

2009年(167)

2008年(16)

2007年(21)

分类: LINUX

2009-10-14 20:34:04

使用LTIB编译Qtopia2

    在Qtopia 2中使用鼠标


    编译Qtopia的时候配置了使用鼠标的选项:
[*] Use usb mouse instead of touchscreen in qtopia by default 

    同时内核使能了USB HID等,已经插入了USB光学鼠标,在内核中已经看到了鼠标:
[root@nxp root]# ls /dev/input/by-id/usb-15ca_USB_Optical_Mouse-event-mouse -la
lrwxrwxrwx    1 root     root            9 Jan  1 00:18 /dev/input/by-id/usb-15ca_USB_Optical_Mouse-event-mouse -> ../event1

另外,使用cat命令读取/dev/input/event1,触动鼠标,能够看到有信息。

    但是,在Qtopia 2下就是无法使用。进入Qtopia 欢迎界面,看不到鼠标,点击鼠标,屏幕没有任何反应。

问题
#!/bin/sh

        export QTDIR=/opt/Qtopia
        export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
        export QPEDIR=/opt/Qtopia
        export HOME=/root
        export PATH=$QPEDIR/bin:$PATH
#       export QWS_MOUSE_PROTO="USB:/dev/mouse0"
        export QWS_MOUSE_PROTO="USB:/dev/input/event1"
        export QWS_KEYBOARD="USB:/dev/event0"
        export QWS_SIZE="320x240"

        /opt/Qtopia/bin/qpe& >/dev/null 2>/dev/null

出现这样的警告,鼠标无法正常使用:
Warning: QServerSocket: failed to bind or listen to the socket
Warning: Failed to bind to port 4243
Warning: QServerSocket: failed to bind or listen to the socket
Warning: Failed to bind to port 4242
Warning: QServerSocket: failed to bind or listen to the socket
Warning: Failed to bind to port 4243


NXP 支持回复:
  export QWS_MOUSE_PROTO="USB:/dev/input/mouse1"  

U鼠可以工作,能正常运行Qtopia。你试试看。
 
触摸屏的在看。


    在Qtopia 2中使用触摸屏

    在编译Qtopia2的时候已经配置了数用触摸屏的选项:
[*] Use touchscreen 

    Linux系统启动后,也能够看到触摸屏的设备节点:
[root@nxp root]# ls /dev/input/by-path/platform-lpc32xx-ts-event- -la
lrwxrwxrwx    1 root     root            9 Jan  1 00:35 /dev/input/by-path/platform-lpc32xx-ts-event- -> ../event0

    同样,使用cat命令读取/dev/input/event0设备,点击触摸屏,也有数据显示。

    但是,在Qtopia 2下还是无法使用触摸屏。进到Qtopia欢迎界面,点击屏幕没有任何反应。

    问题解决

    1:升级drivers/input/touchscreen/lpc32xx_ts.c文件;
    2:修改dist/lfs-5.1/qtopia/qtopia.spec文件,在platform in中增加:
 88     phy3250)
 89     if [ -n "$PKG_QTOPIA_WANT_TSLIB" ]
 90     then
 91         export EXTRA_QTE_CONFIG="-tslib"
 92     fi
 93 # export QPE_EXTRA_CFG="-tslib"
 94     ;;

    3:修改/etc/rc.d/init.d/qtopia脚本,在其中增加/dev/input/event0 到 /dev/touchscreen/ucb1x00的软链接;  //不添加链接,Qtopia的触摸屏可用,但ts_*系列函数无法使用。
mkdir /dev/touchscreen
ln -s /dev/input/event0 /dev/touchscreen/ucb1x00

    4:设置触摸屏:
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CONFFILE=/usr/etc/ts.conf

export QWS_MOUSE_PROTO="TPanel:/dev/input/event0"

    如果不设置到ucb1x00的软链接,手工输入export TSLIB_TSDEVICE=/dev/input/event0后,ts_*程序可用,但是在qtopia脚本中指定却不管用,奇怪了。


主机编译Qtopia2

    单独编译Qtopia2,同样需要依赖于几个库:e2fsprogs jpeg-6b  zlib libpng等。
    需要首先交叉编译这些库,可以考虑添加到交叉编译器中,当然也可以指定链接路径。

    编译e2fsprogs-1.41.4

    需要先确认主机有没有e2fsprogs,如果没有再进行安装:
    ./configure
    make
    sudo make install

   编译jpeg-6b

    ./configure --enable-shared
    vi Makefile
     prefix = /opt/nxp/gcc-4.3.2-glibc-2.7/arm-vfp-linux-gnu/
     CC= arm-vfp-linux-gnu-gcc
     AR= arm-vfp-linux-gnu-ar rc
     AR2=arm-vfp-linux-gnu-ranlib
    make
    sudo make install

如果出现/opt/nxp/gcc-4.3.2-glibc-2.7/arm-vfp-linux-gnu//man/man1/cjpeg.1无法访问的错误,是因为系统没有/opt/nxp/gcc-4.3.2-glibc-2.7/arm-vfp-linux-gnu//man/man1目录,使用
sudo madir -p /opt/nxp/gcc-4.3.2-glibc-2.7/arm-vfp-linux-gnu//man/man1/创建后再次安装即可。

    编译zlib

     ./configure --shared
    vi Makefile
 19 CC=arm-vfp-linux-gnu-gcc
 20
 21 CFLAGS=-fPIC -O3 -DUSE_MMAP
 22 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
 23 #CFLAGS=-g -DDEBUG
 24 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
 25 #           -Wstrict-prototypes -Wmissing-prototypes
 26
 27 LDFLAGS=-L. libz.so.1.2.3
 28 LDSHARED=arm-vfp-linux-gnu-gcc -shared -Wl,-soname,libz.so.1
 29 CPP=arm-vfp-linux-gnu-gcc -E
 30
 31 LIBS=libz.so.1.2.3
 32 SHAREDLIB=libz.so
 33 SHAREDLIBV=libz.so.1.2.3
 34 SHAREDLIBM=libz.so.1
 35
 36 AR=arm-vfp-linux-gnu-ar rc
 37 RANLIB=arm-vfp-linux-gnu-ranlib
 38 TAR=tar
 39 SHELL=/bin/sh
 40 EXE=
 41
 42 prefix =/opt/nxp/gcc-4.3.2-glibc-2.7/arm-vfp-linux-gnu/

    编译遇到错误:
arm-vfp-linux-gnu-gcc -fPIC -O3 -DUSE_MMAP -o example example.o -L. libz.so.1.2.3
/opt/nxp/gcc-4.3.2-glibc-2.7/bin/../lib/gcc/arm-vfp-linux-gnu/4.3.2/../../../../arm-vfp-linux-gnu/bin/ld: error while loading shared libraries: libz.so.1: ELF file OS ABI invalid
collect2: ld returned 127 exit status
make: *** [example] 错误 1


交叉编译Qtopia2

    从LTIB中获取源代码

./ltib --pkg qtopia --m prep --preconfig

./ltib -m scbuild -p qtopia


[chenxibing@localhost ltib]$ ./ltib -m scbuild -p qtopia

Processing: qtopia
====================
Build path taken because: build key set, no prebuilt rpm,

rpmbuild --dbpath /home/chenxibing/lpc3250/ltib/rootfs//var/lib/rpm --target arm --define '_unpackaged_files_terminate_build 0' --define '_target_cpu arm' --define '__strip strip' --define '_topdir /home/chenxibing/lpc3250/ltib/rpm' --define '_prefix /usr' --define '_tmppath /home/chenxibing/lpc3250/ltib/tmp' --define '_mandir /usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bc --short-circuit  /home/chenxibing/lpc3250/ltib/dist/lfs-5.1/qtopia/qtopia.spec
Building target platforms: arm
Building for target arm
Executing(%build): /bin/sh -e /home/chenxibing/lpc3250/ltib/tmp/rpm-tmp.48488
+ umask 022
+ cd /home/chenxibing/lpc3250/ltib/rpm/BUILD
+ cd qtopia-free-2.2.0
+ source ./ltibqtopiaconfig
++ export EXTRA_QPE_CONFIG=
++ EXTRA_QPE_CONFIG=
++ export EXTRA_QTE_CONFIG=
++ EXTRA_QTE_CONFIG=
++ export 'EXTRA_CFLAGS=-fsigned-char -mfpu=vfp -mfloat-abi=softfp -O3'
++ EXTRA_CFLAGS='-fsigned-char -mfpu=vfp -mfloat-abi=softfp -O3'
++ export 'EXTRA_LDFLAGS=-fsigned-char -mfpu=vfp -mfloat-abi=softfp -O3'
++ EXTRA_LDFLAGS='-fsigned-char -mfpu=vfp -mfloat-abi=softfp -O3'
++ export PKG_QTOPIA_WANT_MOUSE=
++ PKG_QTOPIA_WANT_MOUSE=
++ export QWS_PLATFORM=
++ QWS_PLATFORM=
++ export QWS_KEYBOARD=
++ QWS_KEYBOARD=
++ perl -e 'print uc '
+ export UC_QWS_PLATFORM=
+ UC_QWS_PLATFORM=
+ perl -p -i -e 's,arm-linux-,$ENV{TOOLCHAIN_PREFIX},;
               s,^((?:QMAKE|TMAKE)_CFLAGS\s+).*,$1 = -pipe -I. -I $ENV{DEV_IMAGE}/usr/include -DQT_QWS_$ENV{UC_QWS_PLATFORM} $ENV{EXTRA_CFLAGS},;
               s,^((?:QMAKE|TMAKE)_LFLAGS\s+).*,$1 = -L $ENV{DEV_IMAGE}/usr/lib $ENV{EXTRA_LDFLAGS},;
               s,^((?:QMAKE|TMAKE)_CXXFLAGS\s+.*),$1 $ENV{EXTRA_CFLAGS},;
               if( $ENV{PKG_QTOPIA_WANT_TSLIB} ) {
                   s,^((?:QMAKE)_LIBS\s+).*,$1 = -lts,;
               }
              ' tmake/lib/qws/linux--g++/tmake.conf qtopia/mkspecs/qws/linux--g++/qmake.conf
+ export PATH=/home/chenxibing/lpc3250/ltib/bin:/opt/ltib/usr/bin:/opt/nxp/gcc-4.3.2-glibc-2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin
+ PATH=/home/chenxibing/lpc3250/ltib/bin:/opt/ltib/usr/bin:/opt/nxp/gcc-4.3.2-glibc-2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin
+ echo yes
+ ./configure -qte '-platform linux-x86-g++ -xplatform linux--g++     -depths 16,32 -system-jpeg -no-opengl -no-xft -no-sm -no-qvfb -no-vnc          -no-g++-exceptions -no-xft -embedded -qconfig qpe' -qpe '-platform linux-g++ -xplatform linux--g++     -arch arm -no-qvfb -with-libffmpeg -qconfig qpe          -l jpeg -l uuid'

This is the Qtopia Free Edition.

You are licensed to use this software under the terms of
the Qtopia Free Edition License.

Type '?' to view the Qtopia Free Edition License.
Type 'yes' to accept this license offer.
Type 'no' to decline this license offer.

Do you accept the terms of the Qtopia Free Edition License?
Using the following configurations:
QPE_CFG=" '-arch' 'arm' '-no-qvfb' '-with-libffmpeg' '-qconfig' 'qpe' '-l' 'jpeg' '-l' 'uuid' -no-qtopiadesktop -release -platform 'linux-g++' -xplatform 'linux--g++'"
QTE_CFG=" '-depths' '16,32' '-system-jpeg' '-no-opengl' '-no-xft' '-no-sm' '-no-qvfb' '-no-vnc' '-no-g++-exceptions' '-no-xft' '-embedded' '-qconfig' 'qpe' -release -platform 'linux-x86-g++' -xplatform 'linux--g++'"
QT2_CFG="-no-opengl -no-xft -no-sm -platform 'linux-g++'"
DQT_CFG="-thread -qt-gif -fast -no-xft -disable-opengl -disable-sql -no-cups -no-sm  -no-xinerama -no-xcursor -no-xrandr -no-xrender -platform 'linux-g++'"

Qtopia is now configured.

Type "make"              to build the qtopia bundle (and the tools, if required).
Type "make install"      to install Qtopia.
Type "make cleaninstall" to install Qtopia after removing the image first (avoid stale files in the image).
Type "make clean"        to clean the qtopia bundle.

Type "make tools"        to build the tools bundle.
Type "make cleantools"   to clean the tools bundle.

To manually build a particular component (eg. because it failed to build)
source the set...Env script. eg. . ./setQpeEnv; cd $QPEDIR; make

+ ./qtopia/scripts/buildQtopiaTools -check
Re-using cached Qtopia Tools.
+ '[' y = y ']'
+ ./qtopia/scripts/cacheQtopiaTools
+ exit 0
Build time for qtopia: 75 seconds

[chenxibing@localhost ltib]$


***********************************
********* Build Qt/Embedded *******
***********************************
QTE_CFG=" '-depths' '16,32' '-system-jpeg' '-no-opengl' '-no-xft' '-no-sm' '-no-qvfb' '-no-vnc' '-no-g++-exceptions' '-no-xft' '-embedded' '-qconfig' 'qpe' -release -platform 'linux-x86-g++' -xplatform 'linux--g++'"



+ echo yes
+ ./configure -qte '-platform linux-x86-g++ -xplatform linux--g++     -depths 16,32 -system-jpeg -no-opengl -no-xft -no-sm -no-qvfb -no-vnc          -no-g++-exceptions -no-xft -embedded -qconfig qpe' -qpe '-platform linux-g++ -xplatform linux--g++     -arch arm -no-qvfb -with-libffmpeg -qconfig qpe          -l jpeg -l uuid'


Do you accept the terms of the Qtopia Free Edition License?
Using the following configurations:
QPE_CFG=" '-arch' 'arm' '-no-qvfb' '-with-libffmpeg' '-qconfig' 'qpe' '-l' 'jpeg' '-l' 'uuid' -no-qtopiadesktop -release -platform 'linux-g++' -xplatform 'linux--g++'"
QTE_CFG=" '-depths' '16,32' '-system-jpeg' '-no-opengl' '-no-xft' '-no-sm' '-no-qvfb' '-no-vnc' '-no-g++-exceptions' '-no-xft' '-embedded' '-qconfig' 'qpe' -release -platform 'linux-x86-g++' -xplatform 'linux--g++'"
QT2_CFG="-no-opengl -no-xft -no-sm -platform 'linux-g++'"
DQT_CFG="-thread -qt-gif -fast -no-xft -disable-opengl -disable-sql -no-cups -no-sm  -no-xinerama -no-xcursor -no-xrandr -no-xrender -platform 'linux-g++'"



***********************************
********* Build Qtopia ************
***********************************
QPE_CFG=" '-arch' 'arm' '-no-qvfb' '-with-libffmpeg' '-qconfig' 'qpe' '-l' 'jpeg' '-l' 'uuid' -no-qtopiadesktop -release -platform 'linux-g++' -xplatform 'linux--g++'"



vi rpm/BUILD/qtopia-free-2.2.0/config.cache

  1 QPEDIR=/home/chenxibing/lpc3250/ltib/rpm/BUILD/qtopia-free-2.2.0/qtopia
  2 QTOPIA_DEPOT_PATH=/home/chenxibing/lpc3250/ltib/rpm/BUILD/qtopia-free-2.2.0/qtopia
  3 TMAKEDIR=/home/chenxibing/lpc3250/ltib/rpm/BUILD/qtopia-free-2.2.0/tmake
  4 DQTDIR=/home/chenxibing/lpc3250/ltib/rpm/BUILD/qtopia-free-2.2.0/dqt
  5 QT2DIR=/home/chenxibing/lpc3250/ltib/rpm/BUILD/qtopia-free-2.2.0/qt2
  6 QTEDIR=/home/chenxibing/lpc3250/ltib/rpm/BUILD/qtopia-free-2.2.0/qt2
  7 QPE_CFG=" '-arch' 'arm' '-no-qvfb' '-with-libffmpeg' '-qconfig' 'qpe' '-l' 'jpeg' '-l' 'uuid' -no-qtopiade    sktop -release -platform 'linux-g++' -xplatform 'linux--g++'"
  8 QTE_CFG=" '-depths' '16,32' '-system-jpeg' '-no-opengl' '-no-xft' '-no-sm' '-no-qvfb' '-no-vnc' '-no-g++-e    xceptions' '-no-xft' '-embedded' '-qconfig' 'qpe' -release -platform 'linux-x86-g++' -xplatform 'linux--g+    +'"
  9 QT2_CFG="-no-opengl -no-xft -no-sm -platform 'linux-g++'"
 10 DQT_CFG="-thread -qt-gif -fast -no-xft -disable-opengl -disable-sql -no-cups -no-sm  -no-xinerama -no-xcur    sor -no-xrandr -no-xrender -platform 'linux-g++'"
 11 USE_CACHE="no"



交叉编译器的指定:

    QT2

[chenxibing@localhost qt2]$ grep arm-vfp-linux-gnu- -R .
./configs/linux--g++-shared:SYSCONF_CXX         = arm-vfp-linux-gnu-g++
./configs/linux--g++-shared:SYSCONF_CC          = arm-vfp-linux-gnu-gcc
./configs/linux--g++-shared:SYSCONF_LINK                = arm-vfp-linux-gnu-gcc
./configs/linux--g++-shared:SYSCONF_LINK_SHLIB  = arm-vfp-linux-gnu-gcc
./configs/linux--g++-shared:SYSCONF_AR          = arm-vfp-linux-gnu-ar cqs
./configs/linux--g++-static:SYSCONF_CXX         = arm-vfp-linux-gnu-g++
./configs/linux--g++-static:SYSCONF_CC          = arm-vfp-linux-gnu-gcc
./configs/linux--g++-static:SYSCONF_LINK                = arm-vfp-linux-gnu-gcc
./configs/linux--g++-static:SYSCONF_LINK_SHLIB  = arm-vfp-linux-gnu-gcc
./configs/linux--g++-static:SYSCONF_AR          = arm-vfp-linux-gnu-ar cqs
./configs/linux--g++-shared-debug:SYSCONF_CXX           = arm-vfp-linux-gnu-g++
./configs/linux--g++-shared-debug:SYSCONF_CC            = arm-vfp-linux-gnu-gcc
./configs/linux--g++-shared-debug:SYSCONF_LINK          = arm-vfp-linux-gnu-gcc
./configs/linux--g++-shared-debug:SYSCONF_LINK_SHLIB    = arm-vfp-linux-gnu-gcc
./configs/linux--g++-shared-debug:SYSCONF_AR            = arm-vfp-linux-gnu-ar cqs
./configs/linux--g++-static-debug:SYSCONF_CXX           = arm-vfp-linux-gnu-g++
./configs/linux--g++-static-debug:SYSCONF_CC            = arm-vfp-linux-gnu-gcc
./configs/linux--g++-static-debug:SYSCONF_LINK          = arm-vfp-linux-gnu-gcc
./configs/linux--g++-static-debug:SYSCONF_LINK_SHLIB    = arm-vfp-linux-gnu-gcc
./configs/linux--g++-static-debug:SYSCONF_AR            = arm-vfp-linux-gnu-ar cqs
[chenxibing@localhost qt2]$


编译器、库相关配置文件:

qt2/configs/linux--g++-static
qt2/configs/linux--g++statix-debug
qt2/configs/linux--g++-shared
qt2/configs/linux--g++shared-debug

qtopia/mkspecs/qws/linux--g++/qmake.conf
 
tmake/qws/linux--g++/tmake.conf
 






    使用arm-linux-gcc-3.4.4(oe)的编译器:


修改:qtopia-free-2.2.0/qtopia/src/libraries/qtopia/qdawg.cpp

294 //QDawgPrivate::~QDawgPrivate()
295     ~QDawgPrivate()
296     {
297     delete memoryFile;
298     }

另外,增加配置文件:
 cd qtopia-free-2.2.0/qtopia/src/libraries/qtopia/
 cp custom-linux-ipaq-g++.h custom-linux-arm-g++.h
 cp custom-linux-ipaq-g++.cpp custom-linux-arm-g++.cpp

编译通过。


支持鼠标:
修改文件:
qtopia-free-2.2.0/qtopia/src/qt/qconfig-qpe.h

    参考文章

    
    
    http://linux.chinaunix.net/techdoc/develop/2008/09/09/1030943.shtml

阅读(1949) | 评论(0) | 转发(1) |
0

上一篇:TTY and Login

下一篇:待机LCD黑屏问题

给主人留下些什么吧!~~