Upgrade Qt4.6.2 in mini2440

Friday, February 14, 2014

After day by day searching code from many forums, I lastly did compile Qt4.6.2 successfully on my Ubuntu 10.04. After that work, 'fluid program' run perfectly on the mini2440 board. Also, my own programs which are written in QtCreator could run on the board (I will write the instructions on later article)
And now, the way of upgrading Qt4.6.2 in mini2440 is listed below.
At first, you should have general view of the work:
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
$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

#after succesful tslib compilation, you will see tsblib in /home/tslib
root@phuc-laptop:/usr/local/tslib# cd /home/tslib/
root@phuc-laptop:/home/tslib# ls
bin  etc  include  lib


2. Qt4.6.2 compilation.
#get Qt4.6.2 from the link http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz
#copy it into /usr/local

$cd /usr/local
$tar -zxvf qt-everywhere-opensource-src-4.6.2.tar.gz
$cd qt-everywhere-opensource-src-4.6.2
$cd mkspecs/common/
$gedit g++.conf

#change         QMAKE_CFLAGS_RELEASE += -O2
#into         QMAKE_CFLAGS_RELEASE += -O0
#save the file

$cd /usr/local/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++/
$gedit qmake.conf 

#change the file into, note that, the path /usr/local/arm/4.3.2/ is the path which you installed tool chain.

#
# 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)


#then, save the file. Continue on console panel:


$mkdir /usr/local/Qt
$cd /usr/local/qt-everywhere-opensource-src-4.6.2
$./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
#then, you will wait for about 5 miniutes


$make
#it will take nearly one hour on my due core 1.7GHz laptop, too long!
$make install
#Ok, if the compilation is done, you will see the result files in /usr/local/Qt.


3. Copy library of tslib and Qt4.6.2 into mini2440 board.
#I use SDcard to copy file from Ubuntu to mini2440 board. It should be copied the library of tslib, Qt, and the example program of Qt that will be run on mini2440 board.

#copy library and example program of Qt.
$cd /usr/local/Qt/lib
$cp *4.6.2 /media/My_SDcard/
$cp -r fonts/ /media/MySDcard/
$cd /usr/local/Qt
$cp -r demos/ /media/My_SDcard/

#copy tslib into SDcard
$mkdir /media/My_SDcard/tslib/lib/
$cd /home/tslib/lib/
$cp -r * /media/My_SDcard/tslib/lib/
$cp * /media/My_SDcard/tslib/lib/


#place your SDcard into mini2440 board, copy all file to the board.
#in mini2440 console
$mkdir /usr/local/Qt/lib/
$cp /sdcard/*4.6.2 /usr/local/Qt/lib/

#rename all *.4.6.2 in /usr/local/Qt/lib into *.4, for example
$mv libQtCore.so.4.6.2 libQtCore.so.4 


$cp -r /sdcard/fonts/ /usr/local/Qt/lib/
$cp -r /sdcard/demos/ /mnt/
$cp -r /sdcard/tslib/ /usr/local/

4. Configure the environment in mini2440 board.
#Below instructions will make mini2440 board not load its desktop. So, the board will load system until the black screen with Linus logo and some note lines. We should stop the desktop of mini2440 because that helps 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:
#Okay, now, reset the board.
#still on console mini2440
$cd /mnt/demos/embedded/fluidlauncher/
$./fluidlauncher -qws 

#the fluid program will run! ^^

anyway, if you don't want to cross-compile Qt and tslib and want to see the result of fluid program now, you can download Qt and tslib which are cross-compiled by me from below links.
Qt4.6.2 (pre-compiled)
http://www.mediafire.com/?tytlz6cvuvbt661
tslib (pre-compiled)
http://www.mediafire.com/?0kb9kai5n7nt0i7 

No comments:

Post a Comment

 

Search This Blog

Most Reading

Google+ Followers