Qt 4.6 on mini2440 – A Definitive Guide
Having Qt on your device is a awesome way to ensure that you and many other developers can enjoy developing applications and having fun in addition to doing rapid application development whenever required. The wealth of support provided by the Qt framework – right from OpenGL to WebKit tempts a embedded developer for sure. So I decided its time for a change. Lets dump the overkiiling Android and take shelter under Qt’s canvas for my device. I kept on roaming the intricately laid out web of information on having Qt 4.6.2 run successfully on my mini2440. But owing to the strange 12.1″ LCD that I have attached to it I was more-or-less stuck on the Touchscreen calibration part. So Now after hits and trials and many cups of tea, I am assembling a guide. I intend to make if definitive but only the willful enough to dare can tell.
What You Need
Setup the toolchain and modify the PATH variable accordingly. Untar qt-everywhere-opensource-src-4.6.2.tar.gz wherever you like. Mine is /usr/local/qt
Replace the whole text in mkspecs/qws/linux-arm-g++/qmake.conf by the following:
# # 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 = arm-none-linux-gnueabi-gcc -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts QMAKE_CXX = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts QMAKE_LINK = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts QMAKE_LINK_SHLIB = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts # modifications to linux.conf QMAKE_AR = arm-none-linux-gnueabi-ar cqs QMAKE_OBJCOPY = arm-none-linux-gnueabi-objcopy QMAKE_STRIP = arm-none-linux-gnueabi-strip QMAKE_RANLIB = arm-none-linux-gnueabi-ranlib load(qt_config)
Remember that the PATH variable should have the location of arm-none-linux-gnueabi-gcc etc.
Now turn off compiler optimization by making changes in /mkspecs/common/g++.conf Just change the following line to this :
QMAKE_CFLAGS_RELEASE += -O0
Now we have to configure Qt the way we want it by doing ./configure but we need to specify some options according to our requirements.
./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix \ /usr/local/qt -little-endian -webkit -no-qt3support -no-cups -no-largefile \ -optimized-qmake -no-openssl -nomake tools -qt-mouse-tslib -qt-kbd-linuxinput
Now, this configuration is what I needed, for example for my network enabled device I needed a webkit based application so I provided -webkit option. You can drop in or add whatever you want. Some handy options that you may (or may not require) are :
Enable touchscreen library support : -qt-mouse-tslib
Enable USB keyboard support : -qt-kbd-linuxinput
The above options affect the QtGui library so you need to replace only QtGui.so.x.x file on your root filesystem if you are planning to make changes.
So more or less you are done. Its time to do some creative stuff (blah!) just do
Wait for a couple of hours or so and find your cross compiled freshly baked libraries in /usr/local/qt/lib/
Setting up Qt 4.6 libs on mini2440
So now, its time to put the libs on your mini machine! You may choose to create a separate filesystem using busybox too. Elaborate tutorials on that are available on the web. Just Google it up. What I will do is, modify the rootfs that came with my mini and remove all unnecessary stuff from it. Create a dir /usr/local/qt on your mini2440′s stock root filesystem and copy the complete lib directory from step 5 to that location using a USB stick/SD Card or something. Remember to do a df on the mini beforehand to see the free NAND you have got. In case the memory is low, delete some stock data – the small video file, mp3 file and some sample images that are present on it.Also remove unnecessary applications viz konqueror and old qt 2.2.0 libraries from the system.
To make the mini understand the new Qt libs, we’ll add some variables
On your mini2440, edit /etc/inint.d/rcS and add the following line to it
Now create the /etc/qt46profile file and the following text to it :
export LD_LIBRARY_PATH=/usr/local/qt/lib export QTDIR=/usr/local/qt export QWS_MOUSE_PROTO=IntelliMouse:/dev/input/event0 export QWS_DISPLAY=LinuxFB:mmWidth=310:mmHeight=190
Remember that these variables may change according to your qt libs location and mouse/touchscreen drivers. Go to /dev/input/ and see which file is responsible for which device. For eg. if tslib is configured on your device then the QWS_MOUSE_PROTO variable will have the value something like
So, you are done at last and have your system ready with Qt 4.6.2 libs. Try running a simple application (viz a Analog Clock from the cross-compiled qt examples at /usr/local/qt/examples/widgets/analogclock/analogclock by giving the -qws option on the mini2440 shell as
Thats it! Do tell me if you are able to reach here. In the next two posts I shall be discussing about rapidly developing a GUI application for your mini using Qt Creator and compiling and configuring Tslib for mini2440.
About suchakraA guy so passionate about the things that happen in life and yet so boring sometimes :p
This blog is mostly about my adventures with FOSS/Linux and some design stuff that I have started taking interest in
- RT @k4rtik: Have you ever been discriminated on the basis of caste in India's top universities and colleg… #reservation #fail http://t.c ... 1 month ago
- RT @newsycombinator: A lot of free programming ebooks j.mp/HFEISG 1 month ago
- RT @ComicConIndia: Here We Go! Bangalore Comic Con Is Here! June 1-2, Koramangala Stadium! Entry is Free! #blorecomiccon! http://t.co/id ... 1 month ago
- RT @lut4rp: This autorickshaw runs on Python 3. #onlyinbangalore http://t.co/i63CZlbsYA 2 months ago
- RT @ramkrsna: Sad to see some OpenSource projects blowing up money for evangelism, fancy parties, while many struggle to raise money jus ... 2 months ago
- 37,085 morons have wasted their time here so far