C

How to Create Boot to Qt Image

This topic guides how you can 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.

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 some of the target devices available in the meta-boot2qt meta layer. More target devices can be available in other meta layers.

BoardMACHINE value
Intel NUCintel-skylake-64
NVIDIA Jetson TX1jetson-tx1-devkit
NVIDIA Jetson TX2jetson-tx2-devkit
NXP i.MX7D SABREimx7dsabresd
NXP i.MX6QuadPlus/Quad/DualLite SABREimx6qdlsabresd
NXP i.MX 8M Mini DDR4 Evaluation Kitimx8mm-ddr4-evk
NXP i.MX 8M Mini LPDDR4 Evaluation Kitimx8mm-lpddr4-evk
NXP i.MX 8M Nano DDR4 Evaluation Kitimx8mn-ddr4-evk
NXP i.MX 8M Nano LPDDR4 Evaluation Kitimx8mn-lpddr4-evk
NXP i.MX 8M Plus LPDDR4 Evaluation Kitimx8mp-lpddr4-evk
NXP i.MX 8MQuad Evaluation Kitimx8mq-evk
NXP i.MX 8QuadMax Multisensory Enablement Kitimx8qm-mek
NXP i.MX 8QuadXPlus Multisensory Enablement Kitimx8qxp-mek
Raspberry Piraspberrypi
Raspberry Pi 2raspberrypi2
Raspberry Pi 3raspberrypi3
Raspberry Pi 4raspberrypi4
Raspberry Pi 4 64-bitraspberrypi4-64
Raspberry Pi Zeroraspberrypi0
Toradex Apalis iMX6apalis-imx6
Toradex Apalis iMX8apalis-imx8
Toradex Colibri iMX6colibri-imx6
Toradex Colibri iMX6ULLcolibri-imx6ull
Toradex Colibri iMX7colibri-imx7
Toradex Colibri iMX7 eMMCcolibri-imx7-emmc
Toradex Colibri iMX8Xcolibri-imx8x

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-qt5-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 Tools > Options > 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.