Bootstrap

照葫芦画瓢,移植qt5.12到T507开发板

“有幸拿到盈鹏飞嵌入式的首批测试用EVB-T507开发板,看着高大上,可以在上面自己捣鼓个qt5.12,这个是项目需求,这个板的样子发出来给大家看看”
在这里插入图片描述
产品特性

  • l 采用Allwinner公司Cortex-A53四核T507处理器,运行最高速度为1.5GHZ;

    l 支持Mali-G31 MP2 GPU,支持OpenGL ES 3.2/2.0/1.0, Valkan 1.1,OpenCL 2.0

    l 支持4K/25fps H.264视频编码,支持4K/15fps MJPEG编码;

    l 多格式4K/60fps视频解码 (H.265,H.264,VC-1, MPEG-1/2/4, VP8) ;

    l 支持双屏异显;支持RGB888/LVDS,分辨率最高1920x1080/60fps;支持HDMI 2.0A,
    分辨率最高4K/60fps;支持TV CVBS OUT(NTSC/PAL);

    l 支持1-2G Bytes DDR3 SDRAM;

    l 支持EMMC 4G-64G大容量电子盘,可启动;

    l 支持SDIO3.0,2路USB2.0 HOST和一路OTG,1路I2C,1路UART(TTL或者RS485),
    2路PWM(应用于背光)

    l 支持CAN BUS通信(MCP2515)

    l 支持双路以太网,一路10/100M;一路10/100/1000M;

    l 支持3G/4G通信;

    l 支持4路720P的AHD视频输入

    l 稳定的操作系统的支持,可预装Android10.0/LINUX 4.9/UBUNTU 20.04;

    l 尺寸为:160*106MM
    简要介绍

产品功能:
在这里插入图片描述

T507移值Qt


Qt源码使用的是 qt-everywhere-src-5.12.9

编译器要软连接一下,不然找不着

ls.sh脚本文件

ln -s aarch64-linux-gnu-addr2line arm-linux-addr2line 
ln -s aarch64-linux-gnu-ar arm-linux-ar 
ln -s aarch64-linux-gnu-as arm-linux-as 
ln -s aarch64-linux-gnu-c++ arm-linux-c++ 
ln -s aarch64-linux-gnu-c++filt arm-linux-c++filt 
ln -s aarch64-linux-gnu-cpp arm-linux-cpp 
ln -s aarch64-linux-gnu-elfedit arm-linux-elfedit 
ln -s aarch64-linux-gnu-ct-ng.config arm-linux-ct-ng.config 
ln -s aarch64-linux-gnu-g++ arm-linux-g++ 
ln -s aarch64-linux-gnu-gcc arm-linux-gcc 
ln -s aarch64-linux-gnu-gcc-ar arm-linux-gcc-ar 
ln -s aarch64-linux-gnu-gcc-nm arm-linux-gcc-nm 
ln -s aarch64-linux-gnu-gcc-ranlib arm-linux-gcc-ranlib 
ln -s aarch64-linux-gnu-gcov arm-linux-gcov 
ln -s aarch64-linux-gnu-gdb arm-linux-gdb 
ln -s aarch64-linux-gnu-gfortran arm-linux-gfortran 
ln -s aarch64-linux-gnu-gprof arm-linux-gprof 
ln -s aarch64-linux-gnu-ld arm-linux-ld 
ln -s aarch64-linux-gnu-ldd arm-linux-ldd 
ln -s aarch64-linux-gnu-nm arm-linux-nm 
ln -s aarch64-linux-gnu-objcopy arm-linux-objcopy 
ln -s aarch64-linux-gnu-objdump arm-linux-objdump 
ln -s aarch64-linux-gnu-pkg-config arm-linux-pkg-config 
ln -s aarch64-linux-gnu-pkg-config-real arm-linux-pkg-config-real 
ln -s aarch64-linux-gnu-ranlib arm-linux-ranlib 
ln -s aarch64-linux-gnu-readelf arm-linux-readelf 
ln -s aarch64-linux-gnu-size arm-linux-size 
ln -s aarch64-linux-gnu-strings arm-linux-strings 
ln -s aarch64-linux-gnu-strip arm-linux-strip
-rwxr-xr-x 1 11827 9000 1001040 Jan 22  2019 aarch64-linux-gnu-addr2line
-rwxr-xr-x 1 11827 9000 1029624 Jan 22  2019 aarch64-linux-gnu-ar
-rwxr-xr-x 1 11827 9000 1697824 Jan 22  2019 aarch64-linux-gnu-as
-rwxr-xr-x 1 11827 9000  981408 Jan 22  2019 aarch64-linux-gnu-c++
-rwxr-xr-x 1 11827 9000  996528 Jan 22  2019 aarch64-linux-gnu-c++filt
-rwxr-xr-x 1 11827 9000  981408 Jan 22  2019 aarch64-linux-gnu-cpp
-rwxr-xr-x 1 11827 9000 2969744 Jan 22  2019 aarch64-linux-gnu-dwp
-rwxr-xr-x 1 11827 9000   31392 Jan 22  2019 aarch64-linux-gnu-elfedit
-rwxr-xr-x 1 11827 9000  981408 Jan 22  2019 aarch64-linux-gnu-g++
-rwxr-xr-x 1 11827 9000  981408 Jan 22  2019 aarch64-linux-gnu-gcc
-rwxr-xr-x 1 11827 9000  981408 Jan 22  2019 aarch64-linux-gnu-gcc-7.4.1
-rwxr-xr-x 1 11827 9000   26984 Jan 22  2019 aarch64-linux-gnu-gcc-ar
-rwxr-xr-x 1 11827 9000   26984 Jan 22  2019 aarch64-linux-gnu-gcc-nm
-rwxr-xr-x 1 11827 9000   26984 Jan 22  2019 aarch64-linux-gnu-gcc-ranlib
-rwxr-xr-x 1 11827 9000  593472 Jan 22  2019 aarch64-linux-gnu-gcov
-rwxr-xr-x 1 11827 9000  486872 Jan 22  2019 aarch64-linux-gnu-gcov-dump
-rwxr-xr-x 1 11827 9000  507416 Jan 22  2019 aarch64-linux-gnu-gcov-tool
-rwxr-xr-x 1 11827 9000 7100256 Jan 22  2019 aarch64-linux-gnu-gdb
-rwxr-xr-x 1 11827 9000    3270 Jan 22  2019 aarch64-linux-gnu-gdb-add-index
-rwxr-xr-x 1 11827 9000  981408 Jan 22  2019 aarch64-linux-gnu-gfortran
-rwxr-xr-x 1 11827 9000 1067856 Jan 22  2019 aarch64-linux-gnu-gprof
-rwxr-xr-x 1 11827 9000 2123712 Jan 22  2019 aarch64-linux-gnu-ld
-rwxr-xr-x 1 11827 9000 2123712 Jan 22  2019 aarch64-linux-gnu-ld.bfd
-rwxr-xr-x 1 11827 9000 5141744 Jan 22  2019 aarch64-linux-gnu-ld.gold
-rwxr-xr-x 1 11827 9000 1014032 Jan 22  2019 aarch64-linux-gnu-nm
-rwxr-xr-x 1 11827 9000 1193200 Jan 22  2019 aarch64-linux-gnu-objcopy
-rwxr-xr-x 1 11827 9000 1900528 Jan 22  2019 aarch64-linux-gnu-objdump
-rwxr-xr-x 1 11827 9000 1029624 Jan 22  2019 aarch64-linux-gnu-ranlib
-rwxr-xr-x 1 11827 9000  522016 Jan 22  2019 aarch64-linux-gnu-readelf
-rwxr-xr-x 1 11827 9000 1000912 Jan 22  2019 aarch64-linux-gnu-size
-rwxr-xr-x 1 11827 9000 1001040 Jan 22  2019 aarch64-linux-gnu-strings
-rwxr-xr-x 1 11827 9000 1193200 Jan 22  2019 aarch64-linux-gnu-strip
lrwxrwxrwx 1 root  root      27 Jun  7 19:02 arm-linux-addr2line -> aarch64-linux-gnu-addr2line
lrwxrwxrwx 1 root  root      20 Jun  7 19:02 arm-linux-ar -> aarch64-linux-gnu-ar
lrwxrwxrwx 1 root  root      20 Jun  7 19:02 arm-linux-as -> aarch64-linux-gnu-as
lrwxrwxrwx 1 root  root      21 Jun  7 19:02 arm-linux-c++ -> aarch64-linux-gnu-c++
lrwxrwxrwx 1 root  root      25 Jun  7 19:02 arm-linux-c++filt -> aarch64-linux-gnu-c++filt
lrwxrwxrwx 1 root  root      21 Jun  7 19:02 arm-linux-cpp -> aarch64-linux-gnu-cpp
lrwxrwxrwx 1 root  root      30 Jun  7 19:02 arm-linux-ct-ng.config -> aarch64-linux-gnu-ct-ng.config
lrwxrwxrwx 1 root  root      25 Jun  7 19:02 arm-linux-elfedit -> aarch64-linux-gnu-elfedit
lrwxrwxrwx 1 root  root      21 Jun  7 19:02 arm-linux-g++ -> aarch64-linux-gnu-g++
lrwxrwxrwx 1 root  root      21 Jun  7 19:02 arm-linux-gcc -> aarch64-linux-gnu-gcc
lrwxrwxrwx 1 root  root      24 Jun  7 19:02 arm-linux-gcc-ar -> aarch64-linux-gnu-gcc-ar
lrwxrwxrwx 1 root  root      24 Jun  7 19:02 arm-linux-gcc-nm -> aarch64-linux-gnu-gcc-nm
lrwxrwxrwx 1 root  root      28 Jun  7 19:02 arm-linux-gcc-ranlib -> aarch64-linux-gnu-gcc-ranlib
lrwxrwxrwx 1 root  root      22 Jun  7 19:02 arm-linux-gcov -> aarch64-linux-gnu-gcov
lrwxrwxrwx 1 root  root      21 Jun  7 19:02 arm-linux-gdb -> aarch64-linux-gnu-gdb
lrwxrwxrwx 1 root  root      26 Jun  7 19:02 arm-linux-gfortran -> aarch64-linux-gnu-gfortran
lrwxrwxrwx 1 root  root      23 Jun  7 19:02 arm-linux-gprof -> aarch64-linux-gnu-gprof
lrwxrwxrwx 1 root  root      20 Jun  7 19:02 arm-linux-ld -> aarch64-linux-gnu-ld
lrwxrwxrwx 1 root  root      21 Jun  7 19:02 arm-linux-ldd -> aarch64-linux-gnu-ldd
lrwxrwxrwx 1 root  root      20 Jun  7 19:02 arm-linux-nm -> aarch64-linux-gnu-nm
lrwxrwxrwx 1 root  root      25 Jun  7 19:02 arm-linux-objcopy -> aarch64-linux-gnu-objcopy
lrwxrwxrwx 1 root  root      25 Jun  7 19:02 arm-linux-objdump -> aarch64-linux-gnu-objdump
lrwxrwxrwx 1 root  root      28 Jun  7 19:02 arm-linux-pkg-config -> aarch64-linux-gnu-pkg-config
lrwxrwxrwx 1 root  root      33 Jun  7 19:02 arm-linux-pkg-config-real -> aarch64-linux-gnu-pkg-config-real
lrwxrwxrwx 1 root  root      24 Jun  7 19:02 arm-linux-ranlib -> aarch64-linux-gnu-ranlib
lrwxrwxrwx 1 root  root      25 Jun  7 19:02 arm-linux-readelf -> aarch64-linux-gnu-readelf
lrwxrwxrwx 1 root  root      22 Jun  7 19:02 arm-linux-size -> aarch64-linux-gnu-size
lrwxrwxrwx 1 root  root      25 Jun  7 19:02 arm-linux-strings -> aarch64-linux-gnu-strings
lrwxrwxrwx 1 root  root      23 Jun  7 19:02 arm-linux-strip -> aarch64-linux-gnu-strip
-rwxr-xr-x 1 root  root    1419 Jun  7 19:02 ln.sh

设置sysroot目录

这个目录包含的移植需要的OpenGL的库,目录来着内核源码
t507-linux/out/t507/demo2.0/longan/buildroot/host/aarch64-buildroot-linux-gnu
将该文件夹放到usr目录aarch64-buildroot-linux-gnu,实际上放哪里都行 只要指定路径

root@yyc-virtual-machine:/home/mywork/T507/t507-linux# ls /usr/
aarch64-buildroot-linux-gnu  bin  games  include  lib  lib32  lib64  libexec  libx32  local  sbin  share  src
root@yyc-virtual-machine:/home/mywork/T507/t507-linux# 

里面的头文件和库文件包含
在这里插入图片描述

root@yyc-virtual-machine:/home/mywork/T507/qt-everywhere-src-5.12.9# ls /usr/aarch64-buildroot-linux-gnu/sysroot/usr/include/
af_vfs.h     com_err.h       expat_external.h  gmp.h           libmount                ncurses.h   paths.h         rpc            stdlib.h     unctrl.h
aio.h        complex.h       expat.h           gnu             libnetfilter_conntrack  neon        pcap            rpcsvc         string.h     unistd.h
aliases.h    cpio.h          ext2fs            gnu-versions.h  libnfnetlink            net         pcap-bpf.h      samplerate.h   strings.h    ustat.h
alloca.h     crypt.h         fcntl.h           gpg-error.h     libnl3                  netash      pcap.h          sched.h        stropts.h    utime.h
alsa         ctype.h         features.h        gpgrt.h         libpng16                netatalk    pcap-namedb.h   scsi           sys          utmp.h
ao           curses.h        fenv.h            grp.h           libusb-1.0              netax25     pixman-1        search.h       syscall.h    utmpx.h
a.out.h      dhcpctl         fmtmsg.h          gshadow.h       limits.h                netdb.h     pngconf.h       semaphore.h    sysexits.h   uuid
argp.h       dirent.h        fnmatch.h         iconv.h         link.h                  neteconet   png.h           setjmp.h       syslog.h     values.h
argz.h       dlfcn.h         fontconfig        id3tag.h        linux                   netinet     pnglibconf.h    sgtty.h        taglib       video
ar.h         drm             form.h            ieee754.h       locale.h                netipx      poll.h          shadow.h       tar.h        vorbis
arpa         dvdcss          fpu_control.h     ifaddrs.h       ltdl.h                  netiucv     pppd            signal.h       termcap.h    vulkan
asm          e2p             freetype2         inttypes.h      mad.h                   netpacket   printf.h        sndfile.h      term.h       wait.h
asm-generic  EGL             fstab.h           isc-dhcp        malloc.h                netrom      proc_service.h  sndfile.hh     termio.h     wchar.h
assert.h     elf.h           fts.h             iwlib.h         math.h                  netrose     protocols       sound          termios.h    wctype.h
audiofile.h  endian.h        ftw.h             KHR             mcheck.h                nettle      pthread.h       spawn.h        tgmath.h     wireless.h
aupvlist.h   envz.h          _G_config.h       langinfo.h      memory.h                nfs         pty.h           speex          thread_db.h  wordexp.h
bits         err.h           gconv.h           lastlog.h       menu.h                  nl_types.h  pwd.h           spirv          time.h       xen
blkid        errno.h         gcrypt.h          libgen.h        misc                    nss.h       rdma            ss             tinyalsa     xlocale.h
byteswap.h   error.h         getopt.h          libintl.h       mntent.h                obstack.h   readline        stab.h         ttyent.h     xtables.h
bzlib.h      et              GLES              libio.h         monetary.h              ogg         re_comp.h       stdc-predef.h  uapi         xtables-version.h
cairo        eti.h           GLES2             libiptc         mqueue.h                omapip      regex.h         stdint.h       uchar.h      zconf.h
CL           execinfo.h      GLES3             libltdl         mtd                     openssl     regexp.h        stdio_ext.h    ucontext.h   zlib.h
CL_HPP       expat_config.h  glob.h            libmnl          ncurses_dll.h           panel.h     resolv.h        stdio.h        ulimit.h
root@yyc-virtual-machine:/home/mywork/T507/qt-everywhere-src-5.12.9# ls /usr/aarch64-buildroot-linux-gnu/sysroot/usr/lib/
ao                     libdl.a                  libgpg-error.la         libm.so                          libnss_nisplus.so       libssl.so.1.1
audit                  libdl.so                 libgpg-error.so         libncurses.so                    libnss_nis.so           libss.so
ckport                 libdvdcss.la             libgpg-error.so.0       libncurses.so.6                  libogg.la               libss.so.2
crt1.o                 libdvdcss.so             libgpg-error.so.0.25.0  libncurses.so.6.1                libogg.so               libss.so.2.0
crti.o                 libdvdcss.so.2           libhistory.so           libneon.la                       libogg.so.0             libtag_c.so
crtn.o                 libdvdcss.so.2.2.0       libhistory.so.8         libneon.so                       libogg.so.0.8.3         libtag_c.so.0
engines-1.1            libe2p.a                 libhistory.so.8.0       libneon.so.27                    libomapi.a              libtag_c.so.0.0.0
gconv                  libe2p.so                libhogweed.so           libneon.so.27.3.2                libpanel.so             libtag.so
gcrt1.o                libe2p.so.2              libhogweed.so.4         libnetfilter_conntrack.la        libpanel.so.6           libtag.so.1
libanl.a               libe2p.so.2.3            libhogweed.so.4.5       libnetfilter_conntrack.so        libpanel.so.6.1         libtag.so.1.17.0
libanl.so              libEGL.so                libid3tag.la            libnetfilter_conntrack.so.3      libpcap.a               libthread_db.so
libao.la               libEGL.so.1              libid3tag.so            libnetfilter_conntrack.so.3.7.0  libpcap.so              libtinyalsa.a
libao.so               libEGL.so.1.4            libid3tag.so.0          libnettle.so                     libpcap.so.1            libtinyalsa.so
libao.so.4             libEGL.so.1.4.0          libid3tag.so.0.3.0      libnettle.so.6                   libpcap.so.1.9.0        libtinyalsa.so.1
libao.so.4.1.0         libexpat.la              libieee.a               libnettle.so.6.5                 libpixman-1.la          libtinyalsa.so.1.1.1
libasound.la           libexpat.so              libinproctrace.so       libnfnetlink.la                  libpixman-1.so          libusb-1.0.la
libasound.so           libexpat.so.1            libip4tc.la             libnfnetlink.so                  libpixman-1.so.0        libusb-1.0.so
libasound.so.2         libexpat.so.1.6.8        libip4tc.so             libnfnetlink.so.0                libpixman-1.so.0.34.0   libusb-1.0.so.0
libasound.so.2.0.0     libext2fs.a              libip4tc.so.0           libnfnetlink.so.0.2.0            libpng16.la             libusb-1.0.so.0.1.0
libaudiofile.la        libext2fs.so             libip4tc.so.0.1.0       libnl-3.la                       libpng16.so             libutil.a
libaudiofile.so        libext2fs.so.2           libip6tc.la             libnl-3.so                       libpng16.so.16          libutil.so
libaudiofile.so.1      libext2fs.so.2.4         libip6tc.so             libnl-3.so.200                   libpng16.so.16.36.0     libuuid.la
libaudiofile.so.1.0.0  libfontconfig.la         libip6tc.so.0           libnl-3.so.200.26.0              libpng.la               libuuid.so
libblkid.la            libfontconfig.so         libip6tc.so.0.1.0       libnl-genl-3.la                  libpng.so               libvorbisenc.la
libblkid.so            libfontconfig.so.1       libiptc.la              libnl-genl-3.so                  libpthread.a            libvorbisenc.so
libBrokenLocale.a      libfontconfig.so.1.12.0  libiptc.so              libnl-genl-3.so.200              libpthread_nonshared.a  libvorbisenc.so.2
libBrokenLocale.so     libform.so               libiptc.so.0            libnl-genl-3.so.200.26.0         libpthread.so           libvorbisenc.so.2.0.11
libbz2.a               libform.so.6             libiptc.so.0.0.0        libnl-idiag-3.la                 libreadline.so          libvorbisfile.la
libbz2.so              libform.so.6.1           libltdl.la              libnl-idiag-3.so                 libreadline.so.8        libvorbisfile.so
libbz2.so.1.0          libfreetype.la           libltdl.so              libnl-idiag-3.so.200             libreadline.so.8.0      libvorbisfile.so.3
libbz2.so.1.0.6        libfreetype.so           libltdl.so.7            libnl-idiag-3.so.200.26.0        libresolv.a             libvorbisfile.so.3.3.7
libc.a                 libfreetype.so.6         libltdl.so.7.3.1        libnl-nf-3.la                    libresolv.so            libvorbis.la
libcairo.la            libfreetype.so.6.16.1    libm.a                  libnl-nf-3.so                    librpcsvc.a             libvorbis.so
libcairo.so            libg.a                   libmad.la               libnl-nf-3.so.200                librt.a                 libvorbis.so.0
libcairo.so.2          libgcrypt.la             libmad.so               libnl-nf-3.so.200.26.0           librt.so                libvorbis.so.0.4.8
libcairo.so.2.11512.0  libgcrypt.so             libmad.so.0             libnl-route-3.la                 libsamplerate.la        libxtables.la
libcidn.so             libgcrypt.so.20          libmad.so.0.2.1         libnl-route-3.so                 libsamplerate.so        libxtables.so
libc_nonshared.a       libgcrypt.so.20.2.4      libmali.so              libnl-route-3.so.200             libsamplerate.so.0      libxtables.so.12
libcom_err.a           libGLESv1_CM.so          libmali.so.0            libnl-route-3.so.200.26.0        libsamplerate.so.0.1.8  libxtables.so.12.2.0
libcom_err.so          libGLESv1_CM.so.1        libmali.so.0.20.0       libnl-xfrm-3.la                  libsndfile.la           libz.so
libcom_err.so.2        libGLESv1_CM.so.1.1      libmcheck.a             libnl-xfrm-3.so                  libsndfile.so           libz.so.1
libcom_err.so.2.1      libGLESv1_CM.so.1.1.0    libmenu.so              libnl-xfrm-3.so.200              libsndfile.so.1         libz.so.1.2.11
libcrypt.a             libGLESv2.so             libmenu.so.6            libnl-xfrm-3.so.200.26.0         libsndfile.so.1.0.28    Mcrt1.o
libcrypto.a            libGLESv2.so.2           libmenu.so.6.1          libnsl.a                         libspeex.la             pkgconfig
libcrypto.so           libGLESv2.so.2.1         libmnl.la               libnsl.so                        libspeex.so             Scrt1.o
libcrypto.so.1.1       libGLESv2.so.2.1.0       libmnl.so               libnss_compat.so                 libspeex.so.1           terminfo
libcrypt.so            libgmp.la                libmnl.so.0             libnss_db.so                     libspeex.so.1.5.1       xtables
libc.so                libgmp.so                libmnl.so.0.2.0         libnss_dns.so                    libss.a
libcurses.so           libgmp.so.10             libmount.la             libnss_files.so                  libssl.a
libdhcpctl.a           libgmp.so.10.3.2         libmount.so             libnss_hesiod.so                 libssl.so

配置configure和qmake.conf

配置qmake.conf

打开qt-everywhere-src-5.12.9/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

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

GPU_VIV_SDK = /usr/aarch64-buildroot-linux-gnu/sysroot
QMAKE_INCDIR_OPENGL = $$GPU_VIV_SDK/usr/include
QMAKE_LIBDIR_OPENGL = $$GPU_VIV_SDK/usr/lib

QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_OPENGL
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL 
QMAKE_INCDIR_EGL        = $$QMAKE_INCDIR_OPENGL
QMAKE_LIBDIR_EGL        = $$QMAKE_LIBDIR_OPENGL 
QMAKE_INCDIR_OPENVG     =$$QMAKE_INCDIR_OPENGL 
QMAKE_LIBDIR_OPENVG     = $$QMAKE_LIBDIR_OPENGL
#看到别人移植会有下面的链接配置,但实际我移植过程中配置链接configure会配置不过,所以注释了
#QMAKE_LIBS_OPENGL_ES1       += -lGLESv1_CM -lEGL -lGAL  
#QMAKE_LIBS_OPENGL_ES1CL     += -lGLES_CL -lEGL -lGAL 
#QMAKE_LIBS_EGL         += -lEGL -lGAL
#QMAKE_LIBS_OPENGL_ES2  += -lGLESv2 -lEGL -lGAL
#QMAKE_LIBS_OPENVG      += -lOpenVG -lEGL -lGAL
# modifications to g++.conf
QMAKE_CC                = aarch64-linux-gnu-gcc
QMAKE_CXX               = aarch64-linux-gnu-g++
QMAKE_LINK              = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB        = aarch64-linux-gnu-g++
QMAKE_CFLAGS +=-DEGL_FBDEV -std=c++11 
QMAKE_CXXFLAGS +=-DEGL_FBDEV -std=c++11 

# modifications to linux.conf
QMAKE_AR                = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY           = aarch64-linux-gnu-objcopy
QMAKE_NM                = aarch64-linux-gnu-nm -P
QMAKE_STRIP             = aarch64-linux-gnu-strip
#QMAKE_INCDIR_OPENGL_ES2 += $$QT_GPU_INC
#QMAKE_LIBDIR_OPENGL_ES2 += $$QT_GPU_LIB
#QMAKE_LIBS_OPENGL_ES2 += -lGLESv2
#
load(qt_config)

配置configure

安装目录-prefix /opt/qt-5.12-armT507 \指定的是/opt/qt-5.12-armT507
但是指定了-sysroot $SYSROOT \,安装目录就还相对与sysroot 的根目录安装
绝对路劲对应的就是/usr/aarch64-buildroot-linux-gnu/sysroot/opt/qt-5.12-armT507
将下面的内容写进myconfigure.sh,执行myconfigure.sh配置configure

#!/bin/sh
PWD=`pwd`
QT_SRC_DIR=$PWD
		
export SYSROOT=/usr/aarch64-buildroot-linux-gnu/sysroot
export CROSS_COMPILE=/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export CPLUS_INCLUDE_PATH=$PWD/qtbase/src/3rdparty/angle/include:$CPLUS_INCLUDE_PATH
HOST=aarch64-linux-gnu
	$QT_SRC_DIR/configure \
		-opensource \
		-confirm-license \
		-prefix /opt/qt-5.12-armT507  \
		-xplatform linux-arm-gnueabi-g++ \
		-device-option CROSS_COMPILE=$CROSS_COMPILE \
		-sysroot $SYSROOT \
		-R /usr/lib \
		-no-strip \
		-c++std c++11 \
		-shared \
		-nomake examples \
		-accessibility \
		-no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci \
		-no-sql-odbc -no-sql-psql -no-sql-sqlite2  -no-sql-tds \
 		-no-sql-sqlite -plugin-sql-sqlite \
		-no-qml-debug \
		-no-sse2 \
		-no-sse3 \
		-no-ssse3 \
		-no-sse4.1 \
		-no-sse4.2 \
		-no-avx \
		-no-avx2 \
		-no-mips_dsp \
		-no-mips_dspr2 \
		-qt-zlib \
		-no-journald \
		-qt-libpng \
		-qt-libjpeg \
		-qt-freetype \
		-qt-harfbuzz \
		-no-openssl \
		-no-xcb-xlib \
		-no-glib \
		-no-pulseaudio \
		-alsa \
		-gui \
		-widgets \
		-v \
		-optimized-qmake \
		-no-cups \
		-no-iconv \
		-evdev \
		-no-icu \
		-no-fontconfig \
		-no-strip \
		-pch \
		-dbus \
		-no-use-gold-linker \
		-no-directfb \
		-linuxfb \
		-no-kms \
		-opengl \
		-opengl es2 \
		-qpa eglfs \
		-no-system-proxies \
		-no-slog2 \
		-no-pps \
		-no-imf \
		-no-lgmon \
		-no-tslib 

得到配置结果,要把EGLFS配置为yse
在这里插入图片描述
执行myconfigure.sh之后生成Makefile文件

root@yyc-virtual-machine:/home/mywork/T507/qt-everywhere-src-5.12.9# ls
_clang-format   config.tests    LICENSE.GPLv3                 qtactiveqt       qtdeclarative       qtmultimedia      qtscript      qttools            qtwebsockets
coin            configure       LICENSE.LGPLv21               qtandroidextras  qtdoc               qtnetworkauth     qtscxml       qttranslations     qtwebview
config.cache    configure.bat   LICENSE.LGPLv3                qtbase           qtgamepad           qt.pro            qtsensors     qtvirtualkeyboard  qtwinextras
config.log      configure.json  LICENSE.QT-LICENSE-AGREEMENT  qtcanvas3d       qtgraphicaleffects  qtpurchasing      qtserialbus   qtwayland          qtx11extras
config.opt      gnuwin32        Makefile                      qtcharts         qtimageformats      qtquickcontrols   qtserialport  qtwebchannel       qtxmlpatterns
config.status   LICENSE.FDL     myconfigure.sh                qtconnectivity   qtlocation          qtquickcontrols2  qtspeech      qtwebengine        README
config.summary  LICENSE.GPLv2   qt3d                          qtdatavis3d      qtmacextras         qtremoteobjects   qtsvg         qtwebglplugin
root@yyc-virtual-machine:/home/mywork/T507/qt-everywhere-src-5.12.9# 

然后make -j8,make出现问题
== /cstdlib:75:15: 致命错误: stdlib.h:没有那个文件或目录 #include_next <stdlib.h> 类似错误 ==
解决方法参考 GCC遇到的一些问题
make 通过后执行make install 会安装到-prefix /opt/qt-5.12-armT507 这个安装目录会根据是否指定–sysroot发生改变 参考上面的说明

移植完成后的结果

root@yyc-virtual-machine:/usr/aarch64-buildroot-linux-gnu/sysroot/opt/qt-5.12-armT507# ls
bin  doc  include  lib  mkspecs  plugins  qml  translations

ls plugins/platforms/会看到libqeglfs.so,是eglfs的驱动

root@yyc-virtual-machine:/usr/aarch64-buildroot-linux-gnu/sysroot/opt/qt-5.12-armT507# ls plugins/platforms/
libqeglfs.so  libqlinuxfb.so  libqminimalegl.so  libqminimal.so  libqoffscreen.so  libqvnc.so  libqwebgl.so

用file指令查看运行平台,是ARM aarch64, version 1
,到这里就移植完成了

root@yyc-virtual-machine:/usr/aarch64-buildroot-linux-gnu/sysroot/opt/qt-5.12-armT507# file plugins/platforms/libqeglfs.so 
plugins/platforms/libqeglfs.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=6a8f54db99a73ccb4c1e2a49936e21ebc949685d, with debug_info, not stripped

配置开发板运行环境脚本,这边官方给的

export QTDIR=/usr/local/Qt_5.12.5 这个是开放默认自带的,
实际自己重新移值的应该放到/usr/aarch64-buildroot-linux-gnu/sysroot/opt/qt-5.12-armT507这个目录,不然我发现是有问题的,板子自带的路劲能用就没管那么多了,重新移植是为了自己重新编译qt程序

export  QTDIR=/usr/local/Qt_5.12.5
if [ -d $QTDIR ];then

	#source /dbusrun.sh
	#dbus-uuidgen > /etc/machine-id
	#export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/dbusaddr`

	export  QT_ROOT=$QTDIR
	export  PATH=$QTDIR/bin:$PATH
	export  LD_LIBRARY_PATH=$QTDIR/lib:/usr/lib/cedarx/:$LD_LIBRARY_PATH

	export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
	export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
	export QT_QPA_FONTDIR=$QTDIR/fonts

	#export LD_PRELOAD=/usr/lib/libts.so
	#/usr/lib/preloadable_libiconv.so:

	TouchDevice=gt9xxnew_ts
	for InputDevices in /sys/class/input/input*
	do
		DeviceName=`cat $InputDevices/name`
		#echo $InputDevices name:$DeviceName
		if [ $DeviceName == $TouchDevice ];then
		   TouchDeviceNum=${InputDevices##*input}
		   export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event$TouchDeviceNum
		   echo "add "/dev/input/event$TouchDeviceNum "to Qt Application."
		   break
		fi
	done
	if [ ! -n "$TouchDeviceNum" ]; then
	 echo "Error:Input device $TouchDevice can not be found,plz check it!"
	fi

	export QT_QPA_PLATFORM=eglfs
	#export QT_QPA_GENERIC_PLUGINS=tslib
	export QT_QPA_GENERIC_PLUGINS=evdevtouch
	export QT_QPA_EGLFS_INTEGRATION=eglfs_mali
	#export QT_QPA_FB_HIDECURSOR=1
	#export QT_QPA_EGLFS_HIDECURSOR=1
	#export QT_QPA_EGLFS_ROTATION=90

	export QWS_MOUSE_PROTO=
	export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/dbusaddr`
	mkdir -p /dev/shm	
	ulimit -c unlimited
	#FRAMEBUFFER=/dev/fb0 Launcher &
	#FRAMEBUFFER=/dev/fb1 MediaUI &
	/usr/local/appRecord &
	echo "find qt5 installed done"                                     
fi

运行出错解决方法

参考Failed to load EGL device integration

;