If there is a mistake, please criticize ...
Qt for embeded Linux
Here, http://doc.qt.io/qt-5/embedded-linux.html.
QT no longer contains its own windowing system (QWS) implementation since the release of QT 5.0. For single process use cases, Qt Platform abstraction is an excellent solution. Wayland can support multiple graphics processes.
There are multiple platform plug-ins that can be used on embedded Linux systems: Eglfs,linuxfb,kms,directfb,wayland. The availability of these depends on the configuration of Qt. The default platform plug-in is also device-specific. For example, on many boards, select Eglfs as the default board. If the default value is not appropriate, you can use the QT_QPA_PLATFORM environment variable parameter to request another plug-in. Alternatively, for quick tests, the-platform command line can use the same syntax.
First, configure specific equipment
Building QT for a given device requires a tool chain and a sysroot. In addition, some devices require vendor-specific adapter code that is supported for EGL and OpenGL ES 2.0. This is not related to a non-acceleration platform, such as a platform using the LINUXFB plug-in, which applies only to software-based rendering. This means that QT Quick 2 does not work in such a setting because it relies on OpenGL for rendering.
The directory qtbase/mkspecs/devices contains configuration and graphics adapter code for multiple devices. For example, the LINUX-RASP-PI2-G + + Mkspec contains build settings, such as the best compiler and linker flags for Raspberry Pi 2 devices. Mkspec also contains information about the implementation of Eglfs hooks (vendor-specific adapter code) or references to appropriate EGLFS device integration plug-ins. Select the device by configuring the tool's-device parameter. The name after this parameter must be at least partially matched to one of the subdirectories under the device.
The following is a sample configuration for Raspberry Pi 2. For most embedded Linux boards, the Configure command looks similar:
./configure-release
-opengl es2
-device linux-rasp-pi2-g++-device-option cross_compile=
$TOOLCHAIN/ arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
-sysroot $ROOTFS
-prefix/ Usr/local/qt5
The most important parameters are-device and-sysroot. The included files and libraries that are used by the specified-sysroot,configure characteristics are detected by the test and Qt itself is obtained from the specified location, rather than from the standard location of the host PC. This means that there is no point in installing a development pack on the host. For example, to obtain libinput support, it is not enough or unnecessary to install Libinput development headers and libraries in a host environment. Instead, the headers and libraries of the target architecture, such as arm, must exist in Sysroot.
Pkg-config is also supported when performing cross compilation. Configure automatically sets the Pkg_config_libdir so that the Pkg-config report compiler and linker settings are based on Sysroot instead of the host. This is usually a good feature, without any further adjustments. However, you must set the environment variables (such as Pkg_config_path) for the host before you run configure. Otherwise, QT builds may attempt to use inappropriate headers and libraries from the host system.
Specifying-sysroot causes the--sysroot parameter to be set automatically when the compiler is invoked. In some cases, this is undesirable, and you can disable the configuration by passing-no-gcc-sysroot.
-prefix,-extprefix and-hostprefix control the desired target directory for QT builds. In the example above, the arm build of QT is expected to be placed on the target device/USR/LOCAL/QT5. Note that running make install does not deploy any content to the device. Instead, the target of the installation step is the directory specified by Extprefix, which defaults to the Sysroot + prefix and is therefore optional. However, in many cases, "pollution" sysroot is undesirable, so designation of-extprefix becomes important. Finally,-hostprefix allows the separation of host tools, such as Qmake,rcc,uic, from the target binaries. When given, these tools will be installed in the specified directory instead of Extprefix.
Second, embedded Linux device Platform plug-in (Platform Plugins for Embedded Linux Devices)
Eglfs:
EGL is the interface between OpenGL and the local window system. QT can be used for context and surface management with EGL, but the API does not include platform-specific: Creating a local window (which is not necessarily a real window on the screen) still has to be done through a platform-specific method. Therefore, a specific adapter code for the board or GPU is required. Such adaptations, or as Eglfs hooks, can be a single source file compiled into a platform plug-in, or as a dynamically loaded EGL device integration plug-in.
Eglfs is a platform plug-in for running QT5 applications on EGL and OpenGL ES 2.0 without an actual window system (such as X11 or Wayland). In addition to QT Quick 2 and native OpenGL applications, it also supports software rendering windows (such as Qwidget). In the latter case, the contents of the widget are rendered as images using the CPU, which is then uploaded to the texture and synthesized by the plug-in.