Use qtcetfb to support qt4.7.0 and accelerate QT startup

Source: Internet
Author: User
Support for qt4.7.0 using direcetfb

 

Support for qt4.7.0 using direcetfb
Abstract: How to Use directfb on ok6410 and use it to support qt4.7.0
Keyword: directfb 1.2.8 qt4.7.0 tslib ok6410
1. Preface:
I have heard of directfb a long time ago, but in fact, due to the relationship between time and energy, I have never had a good understanding of it. This time, the younger brother's project encountered a bottleneck in the QT refresh efficiency. He recommended the hardware graphics acceleration feature to directfb. At the same time, they helped them to the end and planned to do it first and then tell them how to do it.
As a matter of fact, after the twists and turns program, I was surprised. I encountered several problems on the way. After twists and turns, I finally found that the software version caused me a lot of difficulties in the process. I personally like diretfb. I have selected the latest 1.4.5, which leads to the problem of crash during the final start of QT. Although the debug mode is enabled, I have read the run log of more than 4000 rows, but it is still unsolved.
Finally, I found that the directfb version used in javasut10.04 is 1.2.8. I also chose this version. After the same process, the QT routine starts normally, and touch calibration is also available, verify again under the tossing Linux, the combination of versions can make people crazy.
After four days of work, I found that the QT + directfb materials on the Internet were extremely scarce. At least I didn't find any tutorials to use. So I recorded this article and hoped to help later users.
Preparations:
Hardware environment:
Host ubuntu10.4
Development Board ok6410
2. software environment:
The configured ok6410 cross-compilation tool chain
Qt4.7.0 source package http://qt.nokia.com/downloads
Tslib
Directfb1.2.8 source code package http://www.directfb.org/index.php? Path = Main % 2 fdownloads
DirectFB-example1.2.0 source package http://www.directfb.org/index.php? Path = Main % 2 fdownloads & page = 1
Tslib1.0 source package http://github.com/kergoth/tslib/downloads
Libw.v8b source package http://www.ijg.org/
Libpng1.2.44 source package http://www.libpng.org/pub/png/libpng.html
Zlib1.2.5 source package http://www.zlib.net/
FreeType source package http://freetype.sourceforge.net/index2.html
Among them, except libpng and directfb, other software is the latest version. For the software that directfb depends on, we can look at the README file in the source code Directory, which clearly describes the necessary software for directfb. In this regard, with the deepening of directfb, it may be described step by step.
After the source code is downloaded, it is stored in the/home/cnnbboy/directfb directory.
3. Actual Operation:
3.1directfb Port
If qt4.7.0 runs on directfb, You need to first port directfb to the board and pass the test. Before compiling directfb, install the necessary source code package.
(1) tslib1.0 compilation and Installation
Extract the source code first
# Tar xvf kergoth-tslib-1.0-0-gd7f5dae.tar.gz
Change the directory name and enter
# Mv kergoth-tslib-1.0-0-gd7f5dae tslib-1.0
# Cd tslib-1.0
Then compile and install
#./Autogen. Sh
#./Configure-Prefix =/home/cnnbboy/tslib-arm-host = arm-Linux ac_cv_func_malloc_0_nonnull = Yes
# Make
# Make install
Finally, import an environment variable to prepare the final directfb Compilation
# Export tslib =/home/cnnbboy/tslib-arm
(2) libjpeg compilation and Installation
Extract the source code first
# Tar xvf restart src.v8b.tar.gz
# Cd jpeg-8b
Configure compilation and Installation
#./Configure-host = arm-Linux-Prefix =/home/cnnbboy/libjpeg-arm-enable-shared
# Make
# Make install
Import Environment Variables
# Export libjpeg =/home/cnnbboy/libjpeg-arm
(3) libpng compilation and Installation
Extract the source code first
# Tar xvf libpng-1.2.44.tar.gz/
# Cd libpng-1.2.44
Configure compilation and Installation
#./Configure-host = arm-Linux-Prefix =/home/cnnbboy/libpng-arm
# Make
# Make install
Import Environment Variables
# Export libpng =/home/cnnbboy/libpng-arm
(4) FreeType compilation and Installation
Extract the source code first
# Tar xvf freetype-2.4.2.tar.gz
# Cd freetype-2.4.2
Configure compilation and Installation
#./Configure-host = arm-Linux-Prefix =/home/cnnbboy/FreeType-arm
# Make
# Make install
Import Environment Variables
# Export FreeType =/home/cnnbboy/FreeType-arm
(5) zlib compilation and Installation
Extract the source code first
# Tar xvf zlib-1.2.5.tar.gz
# Cd zlib-1.2.5
Configure compilation and Installation
#./Configure-host = arm-Linux-Prefix =/home/cnnbboy/zlib-arm
# Make
# Make install
Import Environment Variables
# Export zlib =/home/cnnbboy/zlib-arm
After the above software is compiled and installed, you can configure and compile directfb.
(6) Compile and install directfb and directfb-Example
Import the environment variables previously set before compilation and installation.
Export ldflags = "$ ldflags-L $ tslib/lib-L $ libjpeg/lib-L $ libpng/lib-L $ FreeType/lib-L $ zlib/lib"
Expoty cflags = "$ cflags-I $ tslib/iclude-I $ libjpeg/include-I $ FreeType/include-I $ zlib/include"
These two environment variables help directfb compile and find the required library file and header file
Decompress the source code directory
# Tar xvf DirectFB-1.2.8.tar.gz
# Cd DirectFB-1.2.8
Configure compilation and Installation
#. /Configure-host = arm-Linux-Prefix =/home/cnnbboy/directfb-arm-with-gfxdrivers = none-with-inputdrivers = All-enable-PNG-enable-JPEG- disable-Tiff-enable-zlib-enable-SDL = No-enable-GIF = No-disable-x11-enable-debug-sysconfdir =/etc-enable-fbdev
Configuration parameters are not described in detail here, because they are mainly used for Qt, rather than directly using directfb for UI development.
# Make
# Make install
Import Environment Variables
# Export directfb =/home/cnnbboy/directfb-arm
After the installation is complete, you can port it. To check whether direct is available, you can also compile directfb-Example
First, clear the original environment variables and import new environment variables.
# Unset ldflags
# Unset cflags
Export ldflags = "$ ldflags-L $ tslib/lib-L $ libjpeg/lib-L $ libpng/lib-L $ FreeType/lib-L $ zlib/lib-L $ directfb /lib"
Expoty cflags = "$ cflags-I $ tslib/iclude-I $ libjpeg/include-I $ FreeType/include-I $ zlib/include-I $ directfb /include"
Same principle as above, extract the source code
# Tar xvf DirectFB-examples-1.2.0.tar.gz
# Cd DirectFB-examples-1.2.0.tar.gz
Configure compilation and Installation
#./Configure-host = arm-Linux-Prefix =/home/cnnbboy/directfb-Example
# Make
# Make install
After the installation is complete, you can start porting and test on the ok6410 board.
(7) Port directfb and Test
Similarly, in the previous article, I have built an ok6410 NFS environment. You only need to copy the relevant files and run them on the Host terminal.
# Cp-r/home/cnnbboy/directfb-arm/forlinx/root/home/cnnbboy
# Cp-r/home/cnnbboy/directfb-example/forlinx/root/home/cnnbboy
# Cp-r/home/cnnbboy/tslib-arm/forlinx/root/home/cnnbboy
# Cp-r/home/cnnbboy/libjpeg-arm/forlinx/root/home/cnnbboy
# Cp-r/home/cnnbboy/libpng-arm/forlinx/root/home/cnnbboy
# Cp-r/home/cnnbboy/FreeType-arm/forlinx/root/home/cnnbboy
# Cp-r/home/cnnbboy/zlib-arm/forlinx/root/home/cnnbboy
Then, start kermit and enter the Development Board terminal.
# Ls-L/home/cnnbboy/directfb-arm
# Ls-L/home/cnnbboy/directfb-Example
You can find that all files already exist, set the development board environment, and prepare to test the directfb routine.
Export tslib =/home/cnnbboy/tslib-arm
Export libjpeg =/home/cnnbboy/libjpeg-arm
Export libpng =/home/cnnbboy/libpng-arm
Export FreeType =/home/cnnbboy/FreeType-arm
Export zlib =/home/cnnbboy/zlib-arm
Export directfb =/home/cnnbboy/directfb-arm
Export tslib_consoledevice = none
Export tslib_fbdevice =/dev/fb0
Export tslib_tsdevice =/dev/input/event1
Export tslib_plugindir = $ t_root/lib/TS
Export tslib_conffile = $ t_root/etc/ts. conf
Export tslib_calibfile =/etc/pointercal
Export LD_LIBRARY_PATH = $ tslib/lib: $ libjpeg/lib: $ libpng/lib: $ FreeType/lib: $ zlib/lib: $ directfb/lib
This is from the theory that directfb should be able to run, of course, the preparation routine is for testing, but never forget to configure directfbrc In the/etc directory.
# Vi/etc/directfbrc
Add
System = fbdev
Fbdeb =/dev/fb0
WM = default
Save and exit
Finally, you can test it.
# Cd/home/cnnbboy/directfb-arm/bin
# Ls
We can see many directfb programs.
#./Dfbinfo
After successful start, you can see information about directr startup.
So far, the directfb migration is complete. The following is the compilation and Transplantation of qt4.7.0 Based on directfb.
3.2 qt4.7.0 directfb-based compilation and Installation
Qt documentation is excellent, so the content supporting directfb can be found in QT documentation.

Http://doc.qt.nokia.com/4.7/qt-embeddedlinux-directfb.html

For details, read the document carefully.
(1) changes to the compilation parameters in qt4.7.0
If you want qt4.7.0 to use directfb, add the Configuration Parameter
./Configure-plugin-GFX-directfb
./Configure-QT-GFX-directfb
These two configuration parameters are optional.
(2) Modify qmake. conf
Note that you should choose based on your target platform. For example, if you are targeting arm-Linux, then qmake. conf should be modified in the QT source code directory.
$ Qtsource/mkspecs/qws/Linux-arm-G ++ directory
Add the following two sentences:
Qt_cflags_directfb =-I/home/cnnbboy/directfb-arm-d_reentrant
Qt_libs_directfb =-L/home/cnnbboy/directfb-arm/lib/-ldirect-ldirectfb-lfusion
Note that the directory should be the installation directory for your directfb
(3) configure, compile, and install qt4.7.0
Decompress the source code of qt4.7.0 and enter
# Tar xvf qt-everywhere-opensource-src-4.7.0.tar.gz
# Cd qt-everywhere-opensource-src-4.7.0.tar.gz
Configure, compile, and install qt4.7.0
#. /Configure-release-shared-fast-no-largefile-QT-SQL-SQLite-no-WebKit-QT-zlib-QT-GIF-QT-LibTIFF-QT-libpng-QT -libmng-QT-libjpeg-make libs-nomake tools-nomake examples-nomake docs-nomake demo-xplatform qws/Linux-arm-G ++-Embedded ARM-little-Endian- qt-FreeType-Depths 16, 18-no-GFX-linuxfb-no-GFX-transformed-no-GFX-multiscreen-no-GFX-VNC-no-GFX-qvfb-QT-GFX -directfb-I/home/cnnbboy/directfb-arm/include-L/home/cnnbboy/directfb-arm/lib-no-glib-QT-mouse-tslib-I/home /cnnbboy/tslib-arm/include-L/home/cnnbboy/tslib-arm/lib
# Make
# Make install
After the installation is complete, you can port it.
(4) transplantation of qt4.7.0 Based on directfb
The previous article has already described the transplantation of qt4.7.0, so the process is briefly described.
# Cd/usr/local/trolltech/qtembedded4.7.0-arm
# Sudo CP-r lib/plugins // forlinx/root/usr/local/trolltech/qtembedded4.7.0-arm
In this way, if NFS is used for startup, you can find these files on the Development Board terminal.
(5) Routine Test
To verify whether the function works properly, you should compile a small program to run it. First, enter the compiled QT source code directory.
# Cd example/mainwindows/Application
#/Usr/local/trolltech/qtembedded4.7.0-arm/bin/qmake
# Make
After the application program is generated, copy it to the NFS Directory of the Development Board.
# Cp application/forlinx/root/home/cnnbboy
Finally, execute a program test.
#./Application-qws-display directfb
First, the directfb startup log will appear on the terminal, and then the application interface will appear smoothly on the Development Board. When the interface appears that moment, for the author who experienced the difficulties, is a great joy.
4. Summary
Problems in the process also need to be solved.
(1) directfb compilation depends on other software libraries. Therefore, make sure that the paths of the software to be compiled and installed are correct.
(2) The directory where directfb is installed on the PC should be consistent on the Development Board. Otherwise, the system not found may occur, at a deeper level, directfb loads modules. If the modules are not specified during configuration and the installation location on the Development Board is different from that on the PC, the modules cannot be found.
(3) The software version should not be too new. I just suffered the loss of the version combination. I wasted two days to solve unknown errors. At the same time, directfb should correspond to LibPNG, when directfb1.2.x is selected, libpng uses 1.4.x, which is displayed in can not find-lpng12. It indicates that libpng must be 1.2.x before it can pass
(4) If the undefined reference to 'ts _ read_raw 'error occurs when compiling the QT test routine, modify the qmake. conf file and add the-lts parameter, as shown below:
Qmake_cc = arm-Linux-gcc-lts
Qmake_cxx = arm-Linux-G ++-lts
Qmake_link = arm-Linux-G ++-lts
Qmake_link_shlib = arm-Linux-G ++-lts
This is the bug of qt4.7.0 and has nothing to do with tslib and directfb.
5. References
(1) Qt for Embedded Linux and directfb http://doc.qt.nokia.com/4.7/qt-embeddedlinux-directfb.html
(2) embedded Linux Gui-directfb + GTK Supreme secret http://www.directfb.com.cn/viewthread.php? Tid = 383
(3) directfb wiki http://www.directfb.org/wiki/index.php/Main_Page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.