We will create a Qt app that is compatible on mini2440 on our host computer then we will copy the libraries and binary of the app to mini2440 and will run the app….
So first we need to set up the Qt environment that we have in our mini2440(Qtopia) to our host computer…
These are the steps we must follow
1. tslib compilation
2. Qt4.6.2 compilation
3. Copy library of tslib and Qt4.6.2 into mini2440 board.
4. Configure the environment in mini2440 board.
5. Run Qt example program
1. tslib compilation
Tslib is an abstraction layer for touchscreen panel events, as well as a filter stack for the manipulation of those events. It was created by Russell King, of arm.linux.org.uk. Tslib is generally used on embedded devices to provide a common user space interface to touchscreen functionality.
$sudo apt-get install git-core
$cd /usr/local
$git clone http://github.com/kergoth/tslib.git
$export PATH=/usr/local/arm/4.3.2/bin:$PATH
$export CROSS_COMPILE=arm-none-linux-gnueabi-
$export CC=${CROSS_COMPILE}gcc
$export CFLAGS=-march=armv4t
$export CXX=${CROSS_COMPILE}"g++"
$export AR=${CROSS_COMPILE}"ar"
$export AS=${CROSS_COMPILE}"as"
$export RANLIB=${CROSS_COMPILE}"ranlib"
$export LD=${CROSS_COMPILE}"ld"
$export STRIP=${CROSS_COMPILE}"strip"
$export ac_cv_func_malloc_0_nonnull=yes
$cd /usr/local/tslib
$./autogen-clean.sh
$./autogen.sh
$./configure --host=arm-linux --prefix=/home/tslib --enable-shared=yes --enable-static=yes
$make
$make install
If everything went ok you will see tslib in you will see tsblib in /home/tslib
2.Qt Compilation
$wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.3.tar.gz
$mv qt-everywhere-opensource-src-4.6.3.tar.gz /usr/local
$cd /usr/local
$tar -zxvf qt-everywhere-opensource-src-4.6.3.tar.gz
$cd qt-everywhere-opensource-src-4.6.3
$cd mkspecs/common/
$gedit g++.conf
Edit that file
change QMAKE_CFLAGS_RELEASE += -O2
into QMAKE_CFLAGS_RELEASE += -O0
Then save the file
$cd /usr/local/qt-everywhere-opensource-src-4.6.3/mkspecs/qws/linux-arm-g++/
$gedit qmake.conf
Edit the file.Copy paste the below content , note that, the path /usr/local/arm/4.3.2/ is the path which you installed tool chain.Remember that the PATH variable should have the location of arm-none-linux-gnueabi-gcc
#
# qmake configuration for building with arm-linux-g++
#
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
# modifications to g++.conf
QMAKE_CC = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-gcc -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_CXX = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK_SHLIB = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-g++ -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
# modifications to linux.conf
QMAKE_AR = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-objcopy
QMAKE_STRIP = /usr/local/arm/4.3.2/bin/arm-none-linux-gnueabi-strip
QMAKE_INCDIR += /home/tslib/include/
QMAKE_LIBDIR += /home/tslib/lib/
QMAKE_CFLAGS_RELEASE += -march=armv4 -mtune=arm920t
QMAKE_CFLAGS_DEBUG += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT_DBG += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT_DLL += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_MT_DLLDBG += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_SHLIB += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_THREAD += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_WARN_OFF += -march=armv4t -mtune=arm920t
QMAKE_CFLAGS_WARN_ON += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_DEBUG += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT_DBG += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT_DLL += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_MT_DLLDBG += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_RELEASE += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_SHLIB += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_THREAD += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_WARN_OFF += -march=armv4t -mtune=arm920t
QMAKE_CXXFLAGS_WARN_ON += -march=armv4t -mtune=arm920t
load(qt_config)
Save the file
$mkdir /usr/local/Qt
$cd /usr/local/qt-everywhere-opensource-src-4.6.3
Then issue this command
$./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian -no-webkit -no-qt3support -no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -qt-sql-sqlite -no-3dnow -system-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-opengl -gtkstyle -no-openvg -no-xshape -no-xsync -no-xrandr -qt-freetype -qt-gfx-linuxfb -qt-kbd-tty -qt-kbd-linuxinput -qt-mouse-tslib -qt-mouse-linuxinput
chose ‘o’ Open Source Edition
chose ‘yes’ to accept license offer
$make
$make install
Now the compilation is done, you will see the result files in /usr/local/Qt.
3 .Copy library of tslib and Qt4.6.3 into mini2440 board
Use sd card,pendrive or you can copy through network
copy library and example program of Qt to pendrive
$cd /usr/local/Qt/lib
$cp *4.6.3 /media/Pendrive/
$cp -r fonts/ /media/Pendrive/
$cd /usr/local/Qt
$cp -r demos/ /media/Pendrive/
copy tslib into pendrive
$mkdir /media/Pendrive/tslib/lib/
$cd /home/tslib/lib/
$cp -r * /media/Pendrive/tslib/lib/
$cp * /media/Pendrive/tslib/lib/
Now connect the pendrive to the usb port of Mini2440 and in mini2440’s console
$mkdir /usr/local/Qt/lib/
$cp /sdcard/*4.6.3 /usr/local/Qt/lib/
rename all *.4.6.3 in /usr/local/Qt/lib into *.4, for example
$mv libQtCore.so.4.6.3 libQtCore.so.4
$cp -r /udisk/fonts/ /usr/local/Qt/lib/
$cp -r /udisk/demos/ /mnt/
$cp -r /udisk/tslib/ /usr/local/
On mini2440 the pendrive will appear as /udisk instead of /media/Pendrive
4. Configure the environment in mini2440 board.
Below instructions will make mini2440 board not load its desktop so that our example Qt programs not conflict screen with the desktop
$cd /etc/init.d/
$vi rcS
comment last three lines:
#bin/qtopia&
#echo" "> /dev/tty1
#ehco"Starting Qtopia, please waiting..." > /dev/tty1
Configure the environment in mini2440:
$cd /etc/
$vi profile
add those lines at the end of file
export LD_LIBRARY_PATH=/usr/local/tslib/lib
export QTDIR=/usr/local/Qt
export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_TSDEVICE=/usr/local/tslib/lib/ts
export TSLIB_TSEVENTTYPE=INPUT
export QWS_DISPLAY=LinuxFB:mmWidth=105:mmHeight=140
Save it
5. Run Qt example program:
Now we can test Qt example programs
$cd /mnt/demos/embedded/fluidlauncher/
$./fluidlauncher -qws