Qiang Li - Mpu Se

How to run QT embeded with touch support on iMX platform (Based on qt 4.7.3)

Discussion created by Qiang Li - Mpu Se Employee on Sep 15, 2011
Latest reply on Dec 12, 2014 by Daniel Oliveira

Here we just used the framebuffer based embeded QT, no X11 support.

 

1. Install the Freescale LTIB BSP, for example “L2.6.35_11.05.01_ER_source.tar.gz”

 

2. Goto ltib folder build the BSP for iMX board:

$ ./ltib –selectype

(1)    Select imx5x platform and min profile: 

(2)    Save and goto next page, select the board for example “mx50_rdp”.

(3)    In same page, goto “Target Image Generation”, and select “ext2.gz ramdisk” image for SD boot and save. 

(4)    Goto “Package List ” and select the “Tslib” to enable touch panel or QT, save. 

(5)    Save and exit, LTIB will start to build the image. 

(6)    The rootfs will be built out at ltib folder “rootfs”.

 

3. Get the “tslib” source code from LTIB: “$ ./ltib –p  tslib -m prep”; the tslib source code can be found at “ltib/rpm/BUILD/tslib-1.0”

 

4. Set the CROSS_COMPILE for both tslib and QT compiling.

In Ubuntu, the LTIB cross compiler will be installed to “/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0”.

Edit “~/.bashrc”, and add the followed line, then logout and login again:

export PATH=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/:$PATH

 

5. Build the tslib

$ cd ~/tslib-1.0

$ ./autogen.sh

$ echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache

$ ./configure --host=arm-linux --cache-file=arm-linux.cache  -prefix=/home/ubuntu123/tslib

$ make

$ make install

    Now tslib head files and lib will be at folder “home/ubuntu123/tslib/”.

 

6. Build the QT, the last QT source code can be downloaded from “http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.tar.gz”.

$ cd ~

$ tar -zxvf qt-everywhere-opensource-src-4.7.3.tar.gz

$ cd qt-everywhere-opensource-src-4.7.3

Edit the file “mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf”, and add the line “QMAKE_LFLAGS += -Wl,-rpath-link=/home/ubuntu123/tslib/lib”.

$ ./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -prefix ~/qt_demo -hostprefix ~/qt_target -opensource -qt-mouse-tslib -I ~/tslib/include -L ~/tslib/lib -confirm-license

$ make

$ make install

    Then the built out QT libs can be found at “/home/ubuntu123/qt_target”.

 

7. Prepare the rootfs

(1)    Copy “/home/ubuntu123/qt_target/*” to “ltib/rootfs/qt” folder; copy “/home/ubuntu123/qt_demo/*” to “ltib/rootfs/qt”.

(2)    Edit the file “ltib/rootfs/etc/profile”, and add the followed lines:

export QTDIR=/qt

export QPEDIR=/qt

export PATH=$QTDIR/bin:$PATH

export TSLIB_ROOT=/usr

export TSLIB_CONSOLEDEVICE=none

export TSLIB_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/ts0

export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts

export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf

export TSLIB_CALIBFILE=/etc/pointercal

export QWS_MOUSE_PROTO=Tslib:/dev/input/ts0

export QWS_DISPLAY=LinuxFb:/dev/fb0

export set QT_QWS_FONTDIR=$QTDIR/lib/fonts/

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

(3)    “$ cd ~/ltib/rootfs”; “$ tar -jcvf ../rootfs.tar.bz2  .”; now the rootfs.tar.bz2 can be burned to iMX board with MFGTool.

 

8. Run the QT demo

After the board booted up, we can run “$ ts_calibrate” to calibrate the touch panel; use the followed commands to run the QT demos.

$ cd /qt/demos/mainwindow

$ ./mainwindow  -qws

 

Outcomes