Building Boot2qt from source

Difficulty Levels: Intermediate
Date added: October 31, 2019
Affected Products: PICO-IMX6 , PICO-IMX7 , PICO-IMX8M , PICO-IMX8M-MINI , PICO-PI-8M , PICO-PI-IMX6 , PICO-PI-IMX7 , PICO-PI-IMX8M , PICO-PI-IMX8M-MINI

Qt for Device Creation, is an easy way to quickly set started with building embedded devices that run Qt applications.  Boot2Qt is a short name for the embedded Linux platform image that is used with Qt for Device Creation.

Boot2Qt is an embedded software image based on the Yocto Poky distribution. This article takes you through the steps of building a Boot2Qt image from source. You could find this useful because many applications require platform modifications such as a custom kernel or bootloader, or additional applications and dependent libraries to be loaded onto the runtime image.

To support Boot2Qt, techNexion has forked and modified the OpenEmbedded meta-boot2qt layer. It can be found on Github:

https://github.com/TechNexion-customization/meta-boot2qt

As a reference, the original build instructions for Boot2Qt can be found here on the Qt website:

The following article focuses on building Boot2Qt version 5.12.5.

Building Boot2Qt for TechNexion boards

Step 1) Get Boot2Qt in your working directory

Make a working directory:
$ mkdir <your_work_dir>
$ cd <your_work_dir>
Clone our Boot2Qt repository using git:
$ git clone https://github.com/TechNexion-customization/meta-boot2qt.git sources/meta-boot2qt -b sumo-tn-boot2qt-5.12.5-wip

Step 2) Initialize and set up the environment

Initialize the build for the specific product you are using:

For PICO-IMX8M:

$ ./sources/meta-boot2qt/b2qt-init-build-env init --device pico-imx8mq

For PICO-IMX8M-MINI:

$ ./sources/meta-boot2qt/b2qt-init-build-env init --device pico-imx8mm

For PICO-IMX6:

$ ./sources/meta-boot2qt/b2qt-init-build-env init --device pico-imx6

For PICO-IMX7:

$ ./sources/meta-boot2qt/b2qt-init-build-env init --device pico-imx7

2.  Setup the environment

It is very important to set the MACHINE environment variable so that the subsequent scripts know that you are building for the specific MACHINE:

For PICO-IMX8M:

$ export MACHINE=pico-imx8mq

For PICO-IMX8M-MINI:

$ export MACHINE=pico-imx8mm

For PICO-IMX6:

$ export MACHINE=pico-imx6

For PICO-IMX7:

$ export MACHINE=pico-imx7

Then, run the setup-environment script:

$ source ./setup-environment.sh

Once the setup-environment script has run (completed), your working directory is automatically changed to the build directory (build-[MACHINE]).

Step 3) Build the image and toolchain

From the build directory, you can now run bitbake to build the runtime image, and the toolchain.

$ bitbake b2qt-embedded-qt5-image

Building the image requires a lot of storage space, system memory (RAM), and, depending on the processing capabilities of the host computer, it can take a long time to build the first time. It can take several hours.

After the image has been built, you can build the toolchain (SDK) for Linux.

$ bitbake meta-toolchain-b2qt-embedded-qt5-sdk

To build Toolchain for QtCreator (Windows):

$ SDKMACHINE=i686-mingw32 bitbake meta-toolchain-b2qt-embedded-qt5-sdk

To build a QBSP, which is a complete image + the toolchain:

$ bitbake meta-b2qt-embedded-qbsp

Step 4) Locate the results

The Boot2Qt image (the run time image) is located in the directory structure here:

<YoctoBuildDir>/tmp/deploy/images/${MACHINE}/b2qt-automotive-qt5-image-${MACHINE}.img

The toolchain for QtCreator (Linux) is located in:

<YoctoBuildDir>/tmp/deploy/sdk/b2qt-x86_64-meta-toolchain-b2qt-automotive-qt5-sdk-${MACHINE}.sh

The target QBSP file:

<YoctoBuildDir>/tmp/deploy/qbsp/meta-b2qt-embedded-qbsp-x86_64-${MACHINE}.qbsp

 

Stay up to date with all the latest TechNexion news...

Sign-up for our Newsletter