qt源码下载地址:qt-everywhere-src-5.14.2.tar.xz
1.修改qt-everywhere-src-5.14.2/qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf文件:
#
# 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 -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv7-a -mtune=cortex-a7 -mfpu=neon -mfloat-abi=hard
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
#QMAKE_INCDIR += /home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/X11_INSTALL/include
#QMAKE_INCDIR += /home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/XCB_INSTALL/include
#QMAKE_LIBDIR += /home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/X11_INSTALL/lib
#QMAKE_LIBDIR += /home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/XCB_INSTALL/lib
QMAKE_LIBS += -lXau
QMAKE_LIBS += -lxcb
#QMAKE_LIBS += -lxcb-xkb
#QMAKE_LIBS += -lxkbcommon
#QMAKE_LIBS += -lxkbcommon-x11
# modifications to g++.conf
QMAKE_CC = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
QMAKE_CXX = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy
QMAKE_NM = /home/ubuntu/real_imx6ull_board/Toolchain/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -P
QMAKE_STRIP
2.在源码目录下创建脚本autoconfig.sh,内容如下:
#!/bin/sh
./configure \
-prefix /home/ubuntu/real_imx6ull_board/qt_for_imx6ull/build_output \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtquick3d \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
-xkbcommon \
--xcb \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-I/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/tslib_xxx/tslib_output/include \
-I/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/XKB_INSTALL/include \
-I/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/X11_INSTALL/include \
-I/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/XCB_INSTALL/include \
-L/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/tslib_xxx/tslib_output/lib \
-L/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/XKB_INSTALL/lib \
-L/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/X11_INSTALL/lib \
-L/home/ubuntu/real_imx6ull_board/qt_for_imx6ull/xcb_for_arm/XCB_INSTALL/lib \
-recheck-all
这里开启了xcb支持,因为qtquick模块需要用到xcb,如图:
3.make&make install
4.将build_output文件夹拷贝到buildroot根文件系统的/opt目录下:
5.将前期交叉编译的tslib文件夹和XCB、X11、XKB文件夹也拷贝到/opt/build_output/
6.修改根文件系统/etc/profile文件,添加如下代码
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_TSEVENTTYPE=input
export TSLIB_CONFFILE=/opt/build_output/tslib_output/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_PLUGINDIR=/opt/build_output/tslib_output/lib/ts
export QT_QPA_GENERIC_PLUGINS=tslib
export QT_ROOT=/opt/build_output
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
export LD_LIBRARY_PATH=/lib:/usr/lib:$QT_ROOT/lib:/opt/build_output/tslib_output/lib/:/opt/build_output/X11_INSTALL/lib/:/opt/build_output/XKB_INSTALL/lib/:/opt/build_output/XCB_INSTALL/lib
7.在根文件系统/etc/init.d/下添加文件S80selfdef,目的是挂载NFS网络文件系统。内容如下:
echo 7 4 1 7 > /proc/sys/kernel/printk
mount -t nfs -o nolock,vers=3 192.168.137.100:/home/ubuntu/real_imx6ull_board/ /mnt
8.在开发板的uboot中设置参数:
9.启动
10.运行
效果:
WeChat_20240305101736