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
Step 1
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
Step 2
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.
Step 3
Now turn off compiler optimization by making changes in /mkspecs/common/g++.conf Just change the following line to this :
QMAKE_CFLAGS_RELEASE += -O0
Step 4
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.
Step 5
So more or less you are done. Its time to do some creative stuff (blah!) just do
make
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.
Environment Variables
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
source /etc/qt46profile
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
QWS_MOUSE_PROTO=Tslib:/dev/input/event1
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
./analogclock -qws
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.
Tags: embedded, linux, mini2440, qt
About suchakra
A guy so passionate about the things that happen in life and yet so boring sometimes :p16 Responses to “Qt 4.6 on mini2440 – A Definitive Guide”
Leave a Reply Cancel reply
Suchakra
This blog is mostly about my adventures with FOSS/Linux and some design stuff that I have started taking interest in
Tuxology Tweets
- RT @philshapiro How to draw a shiny bug in Inkscape. http://t.co/vmhrbRba #inkscape #FOSS #screencast 2 days ago
- @s_d_f Search google. You'll find the id for sure. Btw m interested in your idea.. :) 2 days ago
- @instruite : Konichiwa Hemant San! Its been so long... :) 1 week ago
- @s_d_f Hi, Have you installed it through Market? Mail me about the issue in detail..I'll try to help 1 week ago
- Had a nice time at #gnunify 2012. Met @adityapatawari @123shravan @tuxdna @shreyankg @shakthimaan @ramkrsna @neependra and other cool guys! 1 week ago

Blog Stats
- 16,364 morons have wasted their time here so far



Hi,
Thanks for this tutorial. I need help with Touchscreen.
I compiled Qt and tslib successfully.
Typing “cat /dev/input/ts” works as mentioned (weird chars when touched).
ts_calibrate and ts_test work fine too (touch screen is working fine).
If I use “export QWS_MOUSE_PROTO=tslib:/dev/input/ts” it shows “Segmentation fault”. When I replace this line by just “export QWS_MOUSE_PROTO=” (without “driver:options”) my “Hello World” shows perfectly, but no touch screen.
Compiling Qt with “-no-freetype” generates the same result: “Segmentation fault”.
I can’t find a way to work touch with my app.
Any suggestion?
Thank you.
Afonso.
Hi Afonso,
I faced the same problem before too when I was trying Qt 4.7. It got solved by using Qt 4.6.2 and arm-linux-gcc 4.3.2 as mentioned above. Also don’t forget -qt-mouse-tslib option while configuring and then replace your Qtcore and QtGui library on target. See http://www.friendlyarm.net/forum/topic/1854 for more info. I hope it helps.
Thanks for this useful post (I managed to cross-compile mine couple of days ago using some other sites, and now I need to put my lib on my Mini2440), but I have a question: Since your toolchain is arm-none-linux-gnueabi-gcc”, why use “mkspecs/qws/linux-arm-g++/qmake.conf” but not “mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf” ? Because I cross-compiled mine using that .conf, and it was fine. I’m curious about the difference. I faced a thumb error and fixed that (read it was a bug for 4.7, drank lotsa tea as well), too using “-embedded armv4tl” instead of “-embedded arm.” I guess 4.7 is problematic somehow…
Hi, sorry for a late response. As its an eabi, so I assume the conf will be specific to that one too. However, its all the same as Qt on such a device is almost the same as qt on a PC and as you have tested, both the confs are working fine. Oh, and yeah, 4.7 was giving me lots of trouble on mini2440 but I got it working somehow on mini6410
Thank you for your guide! I’m just barely starting to get a handle on how to code for this…
I’m trying to shoehorn my newly cross-compiled library files into the mini2440, but it looks like I’ve got 347.2 MB in the /usr/local/qt/lib folder, and a grand total of 256640 1K blocks in total on my mini2440.
Have I followed the instructions poorly or missed something else of consequence?
Any reply appreciated, thanks in advance.
The only thing which can affect the size of libs is the ./configure step. I suggest you remove the -webkit and opengl options in this step before moving further and the check the sizes. My libs (will all options enabled except OpenGL) come out to be around 85 MB which can happily stay on a 256MB NAND. I think there has been a mistake somewhere during configuration only
thanks suchakra for this helpful post.
I have given one touch screen support in my qt embedded application, now i want to attach second touch screen(which will have different content than first touch screen)with my Qt application. so i am planning to use two different application each with QWSServer or using single QT application with Qt’s mulit driver protocol.
but for this i will have to tell the each application about input event and frame buffer but, since tslib uses global variable like FBDEVICE and TSDEVICE so my question is how individual application will come to know which input event and frame buffer it should connect ?
Wow! At last someone with an innovative touch
I must tell you that I am totally unaware of how to make it happen – but you may try changing the environment variables on the fly for directing output to a different screen. Not sure if it will help but I hope it does. Try http://developer.qt.nokia.com/forums for more help. Please share your results/experiences. I’m indeed excited to see something like this working. Best of luck & keep hacking! Also, I hope that the hardware you are using has enough juice for such a task.
Hi suchakra,
I have been trying to get Qt working and have followed different guides, but am still encountering a problem. Also, I’m not a Linux pro user, but have dabbled a little. When I attempt Step 4, I get this error:
The tslib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR and QMAKE_LIBDIR in
/usr/local/qt/mkspecs/qws/linux-arm-g++.
Am I missing something from an earlier step?
Thanks,
Kevin
This error is generally present when the tslib header and library is not found when Qt is being configured. You may need to manually add the following to /usr/local/qt/mkspecs/qws/linux-arm-g++/qmake.conf :
QMAKE_INCDIR += /usr/local/tslib/include
QMAKE_LIBDIR += /usr/local/tslib/lib
(considering that both the above directories exist with the required libs and the headers)
Afterwards don’t forget to pass the -qt-mouse-tslib option to the ./configure step. Hope it helps
First of all, I want to thank you for this very helpful guide!!!
With your prefered qt version 4.6.2 everything works well.
But I would like to run qt quick (qml) and need a newer qt version.
So I tried qt 4.8.0 rc1 and faced the same error as Kevin (The tslib functionality test failed! …) . I changed the qmake.conf as you have mentioned above, but the error is still there.
Is there something else what I can do/try?
Do you have experience with qml on the mini2440?
Thanks in advance,
Michael
I solved it myself.
( The “tslib functionality test failed!”-problem )
Maybe it’s a solution for other too, maybe not.
My problem was, that I tried to configure + compile QT with sudo on an Ubuntu system.
After chown -r UserABC /usr/local/qt I configured an compiled QT 4.8.0 rc1 as UserABC well.
(Don’t forget to do make confclean before!)
But I haven’t tested it on the mini2440 board yet …
I hope your doing well! Best regards.
I’m having problems trying to run the configure command.
He is generating an error, here.
The tslib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR and QMAKE_LIBDIR in
/home/fabio/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++.
Have one idea about this ?
Hi,
Sorry for the late reply. I have been quite busy
Anyways, please open the qmakeconf file at /home/fabio/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++ and add the following lines. Make sure you have the cross compiled tsllib libs present there on the mini2440
QMAKE_INCDIR += /usr/local/tslib/include
QMAKE_LIBDIR += /usr/local/tslib/lib
I hope it helps..
Hi!
Nice post!!
I managed to complie tslib and qt4.7.4 under Ubuntu 11.10 32bit with arm-linux-gcc 4.3.2.
Now I transfered the complied Qt/lib files and the demos and tslib to my mini2440 board. I follow your instructions and that tutorial too : http://mini2440vietnam.blogspot.com/2011/04/upgrade-qt462-in-mini2440.html
But when I try to modify the rcS file I get this error in console on my host pc:
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 108K
cannot run ‘/etc/init.d/rcS’: Permission denied
Please press Enter to activate this console.
can’t open /dev/tty2: No such file or directory
can’t open /dev/tty3: No such file or directory
can’t open /dev/tty4: No such file or directory
can’t open /dev/tty2: No such file or directory
can’t open /dev/tty4: No such file or directory
can’t open /dev/tty3: No such file or directory
…… etc
I tried to do this command after the modification : chmod -x rcS
but the result is the same…
What do you think? Where did I mistake?
Thank you!!!
Hi Daniel,
THe following is quite dangerous but its ok for an embedded device I think
Just do a chmod -R 777 init.d/* and your system will work for sure.