Introduction to each part of Zero

Zero port Qt5.4.1


surroundings:


installation steps:

This article mainly describes the porting process of QT. For the porting process of tslib, you can search for the reference of "The whole process of tslib1.4 porting". If you don't need a touch screen,
you don't need to port tslib.


1. Preparation

Make sure the following software is installed,

sudo apt-get install xorg-dev libfontconfig1-dev \
libfreetype6-dev libx11-dev libxcursor-dev libxext-dev \
libxfixes-dev libxft-dev libxi-dev libxrandr-dev libxrender-dev

2. Configuration

1. Unzip the source code qt-everywhere-opensource-src-5.4.1.tar.gz, and enter the source code folder

tar xzf qt-everywhere-opensource-src-5.4.1.tar.gz
cd qt-everywhere-opensource-src-5.4.1/

2. Specify the arm architecture and cross compiler of the platform used:

vi qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

Change it to the following, you should actually need to make corresponding changes according to your own development environment:

#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv7-a
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_INCDIR += /usr/local/tslib/include
QMAKE_LIBDIR += /usr/local/tslib/lib

implementmodifications to g++.conf

QMAKE_CC = arm-linux-gnueabihf-gcc -lts
QMAKE_CXX = arm-linux-gnueabihf-g++ -lts
QMAKE_LINK = arm-linux-gnueabihf-g++ -lts
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++ -lts

implementmodifications to linux.conf

QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_NM = arm-linux-gnueabihf-nm -P
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)

3. Configure Qt according to your actual needs (here is the compilation using tslib):

./configure \
-prefix /usr/local/qt5.4.1 \
-confirm-license \
-opensource \
-release \
-make libs \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-pch \
-qt-sql-sqlite \
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-tslib \
-no-opengl \
-no-sse2 \
-no-openssl \
-no-nis \
-no-cups \
-no-glib \
-no-dbus \
-no-xcb \
-no-xcursor -no-xfixes -no-xrandr -no-xrender \
-no-separate-debug-info \
-make examples -nomake tools -nomake tests -no-iconv

3. Compile and install

sudo make && make install


Fourth, transplant Qt to licheepi development board

After completing the above steps, qt5.4.1 will be installed into /usr/local/qt5.4.1. Then copy qt5.4.1 in /usr/local/ to the
/opt/ directory of the development board, and copy tslib in /usr/local/ to /usr/local/ of the development board.


Five, set the development board Qt environment variables:

vi /etc/bash.bashrc

Add the following:

export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CONFFILE=/usr/local/tslib/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/tslib/lib:/opt/qt5.4.1/lib
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/tslib/bin
export QT_QPA_PLATFORM_PLUGIN_PATH=/opt/qt5.4.1/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=/opt/qt5.4.1/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE

After saving and exiting, make the above environment variables take effect:

source /etc/bash.bashrc


6. Run some examples:

/opt/qt5.4.1/examples/touch/pinchzoom/pinchzoom
/opt/qt5.4.1/examples/svg/embedded/fluidlauncher/fluidlauncher

We can see that QT running in linuxfb mode has no frame border, which is a feature of qt5, which seems to be better transferred to
mobile terminals such as mobile phones.
When testing the program, it may prompt that some library files do not exist. You can copy the corresponding library files under the cross compiler in the ubuntu host to the licheepi
development board, and then add environment variables to make it effective. Copy it if you don't know.