C

Building Your Own Embedded Linux Image

Boot to Qt for embedded Linux is built using the tools and resources from the Yocto Project, and is based on Yocto's reference distribution (Poky). You can use the same tools to build custom Boot to Qt images, and have control over which packages are included in the build and how the software stack is configured.

Note About Support Services for Yocto Tools

By default, The Qt Company will only provide customer support for the Yocto recipes on the TQC Supported platforms, as delivered with Qt for Device Creation, and setting up the development environment for them. Receiving support for any other configuration requires a separate service agreement between a customer and The Qt Company.

Note: Qt for Device Creation images for Qt 5.15.3 LTS.

Qt 5.15 LTS is a commercial only release and you will need a commercial license to access it. For more details please check the instructions at Using Meta-Qt 5.

Requirements

You should be familiar with the Yocto tools and the concept of recipes. For more information, see Yocto Project documentation.

To get started, you need to install the dependencies for the Yocto tools. In Ubuntu, the following packages are required:

sudo apt-get install gawk curl git-core git-lfs diffstat unzip texinfo build-essential \
chrpath libsdl1.2-dev xterm gperf bison gcc-multilib g++-multilib repo

Note: On Ubuntu 16.04 & older releases git-lfs is available via https://git-lfs.github.com

Setting Up Yocto Build Environment

Run 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 https://code.qt.io/cgit/yocto/boot2qt-manifest.git/tree/ repository. A separate manifest file is available for each release and all the current branches have manifests that follow the latest changes.

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=imx6qsabresd
source ./setup-environment.sh

The following table lists the MACHINE values for the available platforms:

BoardMACHINE value
Boundary Devices i.MX6 Boardsnitrogen6x
Boundary Devices Nitrogen7nitrogen7
Intel NUCintel-corei7-64
Kontron SMARC-sAMX6ismarc-samx6i
NVIDIA Jetson TX1jetson-tx1-devkit
NVIDIA Jetson TX2jetson-tx2-devkit
NXP i.MX7D SABREimx7dsabresd
NXP SABRE SD i.MX6Dualimx6dlsabresd
NXP SABRE SD i.MX6Quadimx6qsabresd
Raspberry Piraspberrypi
Raspberry Pi 2raspberrypi2
Raspberry Pi 3raspberrypi3
Raspberry Pi 4raspberrypi4
Raspberry Pi Zeroraspberrypi0
Renesas R-Car H3 Starter Kit Premierh3ulcb
Renesas R-Car M3 Starter Kit Prom3ulcb
Renesas Salvator-Xsalvator-x
Toradex Apalis iMX6apalis-imx6
Toradex Apalis iMX8apalis-imx8
Toradex Colibri iMX6colibri-imx6
Toradex Colibri iMX7colibri-imx7

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-qt5-image
bitbake meta-toolchain-b2qt-embedded-qt5-sdk

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

For Qt Automotive targets, run the build as follows:

bitbake b2qt-automotive-qt5-image
bitbake meta-toolchain-b2qt-automotive-qt5-sdk

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

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

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

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

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/. 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 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.

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.