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

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 the following:

  • Install the Boot to Qt source packages. You can find these by running the MaintenanceTool application located in the Qt for Device Creation installation directory and selecting Package Manager. The Yocto meta layer package contains the additional recipes required to make the image compatible with Boot to Qt.
  • 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 p7zip-full texinfo \
    gcc-multilib build-essential chrpath libsdl1.2-dev xterm gperf bison \
    g++-multilib
    git-lfs install

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

Setting Up Yocto Build Environment

Run the setup script that initializes the Yocto environment. Using Freescale SABRE SD i.MX6Quad as an example:

cd <BuildDir>
<INSTALL_DIR>/5.9/Boot2Qt/sources/meta-boot2qt/b2qt-init-build-env init --device imx6qsabresd

b2qt-init-build-env has the following additional command line options:

  • list-devices: show all supported devices that can be used for a Boot to Qt build
  • mirror: create a local mirror of the yocto repositories. This enables you to use the same repository downloads for multiple build environments, when initializing with init --reference <mirror path>.

For all command line options, see:

<INSTALL_DIR>/5.9/Boot2Qt/sources/meta-boot2qt/b2qt-init-build-env help

Note: Support for Kontron SMARC-sAMX6i requires additional Yocto Board Support Package that is downloadable from Kontron Customer Section.

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

To build a toolchain for Windows, see Toolchain for Windows.

The following table lists the MACHINE values for our reference platforms:

BoardMACHINE value
Boundary Devices i.MX6 Boardsnitrogen6x
Boundary Devices Nitrogen7nitrogen7
Emulatoremulator
Intel NUCintel-corei7-64
Kontron SMARC-sAMX6ismarc-samx6i
NVIDIA Jetson TX1jetson-tx1
NVIDIA Jetson TX2jetson-tx2
NXP i.MX7D SABREimx7dsabresd
NXP SABRE SD i.MX6Dualimx6dlsabresd
NXP SABRE SD i.MX6Quadimx6qsabresd
Raspberry Piraspberrypi
Raspberry Pi 2raspberrypi2
Raspberry Pi 3raspberrypi3
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
Toradex Colibri VFcolibri-vf
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-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=i686-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 Tools > Options > Build & Run > 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.