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=imx8qmmek
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-corei7-64
NVIDIA Jetson TX1jetson-tx1
NVIDIA Jetson TX2jetson-tx2
NXP i.MX7D SABREimx7dsabresd
NXP i.MX6QuadPlus/Quad/DualLite SABREimx6qdlsabresd
NXP i.MX 8M Mini Evaluation Kitimx8mmevk
NXP i.MX 8M Nano Evaluation Kitimx8mnevk
NXP i.MX 8MQuad Evaluation Kitimx8mqevk
NXP i.MX 8QuadMax Multisensory Enablement Kitimx8qmmek
NXP i.MX 8QuadXPlus Multisensory Enablement Kitimx8qxpmek
Raspberry Piraspberrypi
Raspberry Pi 2raspberrypi2
Raspberry Pi 3raspberrypi3
Raspberry Pi 4raspberrypi4
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
WaRP7imx7s-warp

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}.img, and the new toolchain is in <YoctoBuildDir>/tmp/deploy/sdk/b2qt-x86_64-meta-toolchain-b2qt-embedded-qt6-sdk-${MACHINE}.sh.

For Qt for Automation targets, run the build as follows:

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

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

Toolchain for Windows

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

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

You get the toolchain for Windows by extracting the generated .7z under <YoctoBuildDir>/tmp/deploy/sdk/. After you have extracted the .7z file, you need to modify the qt.conf file that is used by the qmake tool in Windows Yocto SDK. You find the qt.conf file under <path where toolchain was extracted>/sysroots/i686-pokysdk-mingw32/usr/bin.

By default, the qt.conf file has paths that point to the Linux default installation path, that is, /opt/b2qt/x.x.x/. You need to replace them with the Windows paths. The Windows paths must point to directories under the extracted .7z. Remember to use the forward slash as a path separator. For example, C:/Qt/Boot2Qt/device/toolchain/.

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.

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.