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

Showing results for 
Search instead for 
Did you mean: 

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

NXP Employee
NXP Employee

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

$ ./

$ 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 “”.

$ 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_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/ts0


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


Tags (1)
5 Replies

Contributor III

Hi Qiang_FSL.

I was able to use QtQuick applications with touch support in my iMX6 Sabre SD. Now I want to use multi touch gestures which is not enable for now. Each should be the steps to do this ?

0 Kudos

Contributor II

Thanks for the detailed instructions.

I have taken the latest LTIB version and when I select QT from Package list, the build fails and I am not able to generate image. Could you please let me know is there are some setting changes needed for building Qt successfully

0 Kudos

Contributor V

Hi Vishal,

             i had suceeded in building  QT through LTIB, can you please post your log details. so that i can guide you, how to fix the errors.

Thanks & Regards,


0 Kudos

Contributor I

Thank you for the concise directions on he environment variables.  I did need to tweak them since I used tlib and everything (except the examples) ended up under /usr (instead of /qt).  Now... since I don't have a touch screen, must determine how to use mouse instead... {maybe the imxdev site has stuff}

Thanks again.

0 Kudos

Contributor III

What exactly is your question?


If you just want to use Qt on imx, take a look here..

0 Kudos