原创 使用 YoctoProject集成Qt6

2023-3-10 11:32 1523 10 10 分类: MCU/ 嵌入式

By Toradex胡珊逢

在嵌入式领域中 Qt 作为普遍选择的 UI 方案目前已经发布 Qt6 版本。本文将介绍如何为 Toradex 的计算机模块使用  Yocto Project Qt6 集成到镜像里。

 

首先根据这里的说明,准备好 Yocto Project 的编译环境。这里我们选择 Toradex 最新的 Linux BSP V6 为例,其基于 kirkstone 分支,这也是一个 LTS 版本。

 

进入 layers 目录,使用下面命令下载 Qt6.4.3 版本的 meta-qt6 文件。

-------------------------------

git clone -b 6.4.3 git://code.qt.io/yocto/meta-qt6.git

-------------------------------

 

 

meta-qt6/classes/ 目录下创建 populate_sdk_qt6.bbclass 文件。

-------------------------------

SUMMARY = "Meta package for building an installable Qt6 toolchain and SDK"

inherit populate_sdk populate_sdk_qt6_base

TOOLCHAIN_HOST_TASK:append = " nativesdk-packagegroup-qt6-toolchain-host"
TOOLCHAIN_TARGET_TASK:append = " packagegroup-qt6-modules"

FEATURE_PACKAGES_qtcreator-debug = "packagegroup-qt6-qtcreator-debug"

-------------------------------

 

 

meta-qt6/recipes-qt/packagegroups/ 目录下创建  packagegroup-qt6-qtcreator-debug.bb 文件。

-------------------------------

SUMMARY = "Remote debugging tools for QtCreator integration"
LICENSE = "MIT"

inherit packagegroup

# Override by distro if needed
VIRTUAL-RUNTIME_qtcreator-debug-ssh-daemon ?= "openssh-sshd"

RDEPENDS:${PN} = " \
    gdbserver \
    ${VIRTUAL-RUNTIME_qtcreator-debug-ssh-daemon} \
    openssh-sftp-server \
    qtdeclarative \
"

-------------------------------

 

meta-toradex-demos/recipes-images/images/ 目录下创建  packagegroup-tdx-qt6.bb 文件。

-------------------------------

SUMMARY = "Packagegroup which provides most QT6 libraries and a QT6 demo"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit packagegroup

PROVIDES = "${PACKAGES}"
PACKAGES += " \
    ${PN}-fonts \
    ${PN}-libs \
"

RRECOMMENDS:${PN} = " \
    ${PN}-fonts \
    ${PN}-libs \
"

SUMMARY:${PN}-fonts = "Some fonts useful for QT5"
RRECOMMENDS:${PN}-fonts = " \
    ttf-dejavu-common \
    ttf-dejavu-sans \
    ttf-dejavu-sans-mono \
    ttf-dejavu-serif \
"

SUMMARY:${PN}-libs = "QT5 libraries"
RRECOMMENDS:${PN}-libs = " \
    qt3d \
    qtbase \
    qtcharts \
    qtcoap \
    qtconnectivity \
    qtdatavis3d \
    qtdeclarative \
    qtimageformats \
    qtlottie \
    qtmqtt \
    qtmultimedia \
    qtnetworkauth \
    qtopcua \
    qtquick3d \
    qtquicktimeline \
    qtremoteobjects \
    qtscxml \
    qtsensors \
    qtserialbus \
    qtserialport \
    qtsvg \
    qttools \
    qttranslations \
    qtvirtualkeyboard \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'qtwayland', '', d)} \
    qtwebchannel \
    qtwebsockets \
"

-------------------------------

 

meta-toradex-demos/recipes-images/images/ 目录下创建  tdx-reference-multimedia-qt6-image.bb 文件。

-------------------------------

require tdx-reference-minimal-image.bb

SUMMARY = "Toradex Embedded Linux Reference Multimedia Image"
DESCRIPTION = "Image for BSP verification with QT and multimedia features"

inherit populate_sdk_qt6

#Prefix to the resulting deployable tarball name
export IMAGE_BASENAME = "Reference-Multimedia-Image"

IMAGE_FEATURES += " \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'weston', \
       bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11-base', '', d), d)} \
"

IMAGE_INSTALL += " \
    packagegroup-tdx-cli \
    packagegroup-tdx-graphical \
    packagegroup-tdx-qt6 \
    packagegroup-fsl-isp \
    \
    bash \
    coreutils \
    less \
    makedevs \
    mime-support \
    net-tools \
    util-linux \
    v4l-utils \
    \
    gpicview \
    media-files \
"

-------------------------------

 

build/conf/bblayers.conf meta-qt6 添加进来,并移除原来的 meta-qt5

-------------------------------

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "7"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  ${TOPDIR}/../layers/meta-toradex-nxp \
  ${TOPDIR}/../layers/meta-freescale \
  ${TOPDIR}/../layers/meta-freescale-3rdparty \
  \
  ${TOPDIR}/../layers/meta-toradex-bsp-common \
  \
  ${TOPDIR}/../layers/meta-openembedded/meta-oe \
  ${TOPDIR}/../layers/meta-openembedded/meta-filesystems \
  ${TOPDIR}/../layers/meta-openembedded/meta-gnome \
  ${TOPDIR}/../layers/meta-openembedded/meta-xfce \
  ${TOPDIR}/../layers/meta-openembedded/meta-networking \
  ${TOPDIR}/../layers/meta-openembedded/meta-multimedia \
  ${TOPDIR}/../layers/meta-openembedded/meta-python \
  ${TOPDIR}/../layers/meta-freescale-distro \
  ${TOPDIR}/../layers/meta-toradex-demos \
  ${TOPDIR}/../layers/meta-qt5 \
  \
  \
  ${TOPDIR}/../layers/meta-toradex-distro \
  ${TOPDIR}/../layers/meta-yocto/meta-poky \
  ${TOPDIR}/../layers/openembedded-core/meta \
"
#${TOPDIR}/../layers/meta-qt5

-------------------------------

 

build/conf/local.conf 添加下面两个配比,移除 X11 directfb 相关配置。

-------------------------------

DISTRO_FEATURES:remove = " directfb x11"
IMAGE_INSTALL:remove = " gpicview"

-------------------------------

 

 

最后使用 bitbake 命令即可编译包含 Qt6 的镜像和 SDK

作者: hai.qin_651820742, 来源:面包板社区

链接: https://mbb.eet-china.com/blog/uid-me-1864768.html

版权声明:本文为博主原创,未经本人允许,禁止转载!

文章评论0条评论)

登录后参与讨论
我要评论
0
10
关闭 站长推荐上一条 /2 下一条