C

How to Create Boot to Qt Image

This topic describes how to build a custom Boot to Qt image. Before you start building the image, ensure that you have set up the Yocto environment as instructed in Setting Up Environment for Building Boot to Qt.

Initializing Yocto Build Environment

Use the Google repo tool to initialize the Yocto environment:

cd <BuildDir>
repo init -u git://code.qt.io/yocto/boot2qt-manifest -m <manifest>
repo sync

Where manifest is one of the XML manifest files available in the boot2qt-manifest repository. A separate manifest file is available for each Qt release and all the current development branches have manifests that follow the latest Qt changes. Some hardware vendors' targets are using their own manifests. For more information on the currently supported targets and their manifests, see the table below.

Building the Image and Toolchain

After the Yocto environment is set up, you need to configure the build environment for your target device.

To configure the build environment for Linux, run the following commands in a terminal:

export MACHINE=imx8qm-mek
source ./setup-environment.sh

The following table lists the MACHINE values for the currently supported target devices. More target devices can be available in other meta layers.

BoardMACHINEmanifest
Intel NUCintel-skylake-64v6.2.12-lts.xml
NVIDIA Jetson TX2jetson-tx2-devkitv6.2.12-lts.xml
NXP i.MX 8M Mini DDR4 Evaluation Kitimx8mm-ddr4-evkv6.2.12-lts.xml
NXP i.MX 8M Mini LPDDR4 Evaluation Kitimx8mm-lpddr4-evkv6.2.12-lts.xml
NXP i.MX 8M Nano DDR4 Evaluation Kitimx8mn-ddr4-evkv6.2.12-lts.xml
NXP i.MX 8M Nano LPDDR4 Evaluation Kitimx8mn-lpddr4-evkv6.2.12-lts.xml
NXP i.MX 8M Plus LPDDR4 Evaluation Kitimx8mp-lpddr4-evkv6.2.12-lts.xml
NXP i.MX 8MQuad Evaluation Kitimx8mq-evkv6.2.12-lts.xml
NXP i.MX 8QuadMax Multisensory Enablement Kitimx8qm-mekv6.2.12-lts.xml
NXP i.MX 8QuadXPlus Multisensory Enablement Kitimx8qxp-mekv6.2.12-lts.xml
Raspberry Pi 4 64-bitraspberrypi4-64v6.2.12-lts.xml
Renesas R-Car M3 Starter Kit Prom3ulcbrenesas/v6.2.12-lts.xml
Renesas R-Car H3 Starter Kit Premierh3ulcbrenesas/v6.2.12-lts.xml
Renesas R-Car H3 M3 Salvator-X(S)"salvator-xrenesas/v6.2.12-lts.xml
ST STM32MP15 Evaluationstm32mp15-evalst/v6.2.12-lts.xml
ST STM32MP15 Discoverystm32mp15-discost/v6.2.12-lts.xml
TI AM62xam62xx-evmti/v6.2.12-lts.xml
Toradex Apalis iMX6apalis-imx6toradex/v6.2.12-lts.xml
Toradex Apalis iMX8apalis-imx8toradex/v6.2.12-lts.xml
Toradex Colibri iMX6ULLcolibri-imx6ulltoradex/v6.2.12-lts.xml

Yocto recipes for Boot to Qt for embedded Linux have two main targets to build: the target image, and the external toolchain that can be used with Qt Creator for building Qt applications. For Boot to Qt for embedded Linux targets, run the build as follows:

bitbake b2qt-embedded-qt6-image
bitbake meta-toolchain-b2qt-embedded-qt6-sdk

The target rootfs image is located in the <YoctoBuildDir>/tmp/deploy/images/${MACHINE}/b2qt-embedded-qt6-image-${MACHINE}.wic.xz, and the new toolchain is in <YoctoBuildDir>/tmp/deploy/sdk/b2qt-x86_64-meta-toolchain-b2qt-embedded-qt6-sdk-${MACHINE}.sh.

Note: You can use Flashing Wizard also with Yocto builds:

~/Qt/Tools/b2qt/b2qt-flashing-wizard tmp/deploy/images/${MACHINE}

Toolchain for Windows

To build a toolchain for Windows, run the following commands in a terminal:

SDKMACHINE=x86_64-mingw32 bitbake meta-toolchain-b2qt-embedded-qt6-sdk

You get the toolchain for Windows by extracting the generated .7z under <YoctoBuildDir>/tmp/deploy/sdk/.

Configuring Qt Creator for Linux Toolchain

Once the toolchain is built, you can install it by running the generated .sh script. After you have built and installed the toolchain, you must also set up Qt Creator in order to start developing for your device. The following script does this for you.

<TOOLCHAIN_DIR>/configure-qtcreator.sh

This will set up a new kit in Qt Creator, using the toolchain and Qt from the installed toolchain. The new kit is visible under Edit > Preferences > Kits.

Configuring Qt Creator for Windows Toolchain

You must set up Qt Creator in order to start developing for your device. To add a Qt version, kit, compilers, and a debugger in Qt Creator, see Checking Build and Run Settings.

The Windows toolchain uses an environment variable SDKPATH, which must point to the location of the extracted toolchain. You must add this variable to the Kit settings in Qt Creator. Remember to use forward slash as a path separator. For example:

SDKPATH=C:/Qt/Boot2Qt/device/toolchain

Using Toolchain without Qt Creator

The toolchain can be also used without Qt Creator. qmake, which can be used directly for building Qt application, is located in sysroots/x86_64-pokysdk-linux/usr/bin/qmake.

To use the toolchain for more generic cross-development, you need to set up the environment by sourcing the environment setup script from the toolchain. For more information, see the Yocto Project documentation.

Available under certain Qt licenses.
Find out more.