29 May Developing Qt5 applications natively on Wind River Linux
By Nathan Hartman
Wind River Linux provides the technologies essential to building a flexible, stable, and secure platform for your embedded devices.
Based on OpenEmbedded releases from the Yocto Project, it is designed to let you customize your platform to include only the packages and features you need. Powered by bitbake, it provides the ability to build an entire Linux distribution from source by following repeatable recipes. This is really powerful, but can be foreign to application developers that already have a workflow they are comfortable with.
Developers building graphical user interfaces (GUI) have their own set of tools that they rely on. Often they prefer to use an Integrated Development Environment (IDE) tailored to the language and frameworks they are working with. Typically this IDE and the tools it uses are running natively on the same platform they are building for.
Fortunately, these developers can still do this on Wind River Linux. This tutorial describes building Wind River Linux with the GCC toolchain and Qt Creator included to enable native application development.
Building the entire platform has a few simple requirements to get started. Many Linux distributions are self-hosted meaning you can only build the next version of the distribution with the previous release.
Wind River Linux supports a wide variety of hosts. The official supported list of hosts is below, but many newer releases have been tested and known to work.
Supported Distribution for Wind River Linux LTS 19:
- CentOS 7.6
- Fedora 30
- openSUSE Leap 15
- Red Hat Enterprise Linux 7.6 and 8.0
- SUSE Linux Enterprise Desktop 15
- Ubuntu Desktop 16.04 and 18.04 LTS
For details on necessary Linux Host System Libraries and Executables please refer to the documentation.
For example, on Ubuntu systems the following packages must be installed:
$ sudo apt install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping libsdl1.2-dev xterm file git bmap-tools coreutils parted e2fsprogs
In addition, the deployment steps require root or sudo access for deploying to an SD Card or USB flash device.
Lastly, this tutorial has been validated for the Raspberry Pi 4 and Intel NUC devices (NUC5i3MYBE, NUC6i7KYK, NUC7i5DNK). These instructions should work on other devices, however we tested these devices specifically to ensure that the hardware acceleration was enabled for top performance.
Cloning the Wind River Linux repository
The first step is to clone the Wind River Linux GitHub repository.
Create a directory for the tools needed to create the Wind River Linux image. This will be referred to as the parent directory from this point onwards:
$ mkdir wrlinux_qt $ cd wrlinux_qt
In a Linux terminal, clone the repository into your build folder with the following command:
$ git clone https://github.com/WindRiver-Labs/wrlinux-x.git
Note: A clone of wrlinux-x defaults to the WRLINUX_10_19_BASE branch with the latest update tagged. WRLINUX_10_19_BASE_UPDATE0003 or greater is required for the Raspberry Pi 4 BSP. This tutorial was written using WRLINUX_10_19_BASE_UPDATE0007.
Configure the build for your device
This section describes the usage of the Wind River setup.sh tool for easy configuration of the build. We will use it to specify the target board, download the layers required, and pre-populate the configuration file.
In the parent directory that wrlinux-x was cloned into (wrlinux_qt), run the setup.sh script. Accept the End User License Agreement (EULA).
For Raspberry Pi 4 use:
$ ./wrlinux-x/setup.sh --machine bcm-2xxx-rpi4 --dl-layers
For an Intel NUC use:
$ ./wrlinux-x/setup.sh --machine intel-x86-64 --dl-layers
Note: The –machine flag specifies that it should include the board support package for your device, the –dl-layers flag downloads the package source now instead of later at build time.
After some time, you will see:
Fetching projects: 100% (16/16), done. Syncing work tree: 100% (16/16), done.
At which point the following files and directories should have been generated:
$ ls -al total 64 drwxr-xr-x 8 nhartman users 4096 May 25 16:53 . drwxr-xr-x 3 nhartman users 4096 May 25 15:44 .. drwxr-xr-x 5 nhartman users 4096 May 25 16:53 bin lrwxrwxrwx 1 nhartman users 22 May 25 16:53 bitbake -> layers/oe-core/bitbake drwxr-xr-x 5 nhartman users 4096 May 25 16:42 config -rw-r--r-- 1 nhartman users 2279 May 25 16:42 default.xml lrwxrwxrwx 1 nhartman users 89 May 25 16:42 environment-setup-x86_64-wrlinuxsdk-linux -> /home/nhartman/wrlinux_qt/bin/buildtools/environment-setup-x86_64-wrlinuxsdk-linux drwxr-xr-x 8 nhartman users 4096 May 25 16:53 .git -rw-r--r-- 1 nhartman users 111 May 25 16:42 .gitconfig -rw-r--r-- 1 nhartman users 147 May 25 16:42 .gitignore -rw-r--r-- 1 nhartman users 61 May 25 16:42 .gitmodules drwxr-xr-x 16 nhartman users 4096 May 25 16:53 layers lrwxrwxrwx 1 nhartman users 19 May 25 16:53 meta -> layers/oe-core/meta lrwxrwxrwx 1 nhartman users 32 May 25 16:53 oe-init-build-env -> layers/oe-core/oe-init-build-env -rw-r--r-- 1 nhartman users 2882 May 25 16:42 README drwxr-xr-x 7 nhartman users 4096 May 25 16:53 .repo -rw-r--r-- 1 nhartman users 205 May 25 16:42 .repo_.gitconfig.json lrwxrwxrwx 1 nhartman users 22 May 25 16:53 scripts -> layers/oe-core/scripts -rw-r--r-- 1 nhartman users 73 May 25 16:42 .templateconf drwxr-xr-x 5 nhartman users 4096 May 25 13:53 wrlinux-x
Run the environment setup scripts that were generated in the parent directory. They will create and change to the build sub-directory.
$ . ./environment-setup-x86_64-wrlinuxsdk-linux $ . ./oe-init-build-env You had no conf/local.conf file. This configuration file has therefore been created for you with some default values. You may wish to edit it to, for example, select a different MACHINE (target hardware). See conf/local.conf for more information as common configuration options are commented. You had no conf/bblayers.conf file. This configuration file has therefore been created for you with some default values. To add additional metadata layers into your configuration please add entries to conf/bblayers.conf. The Yocto Project has extensive documentation about OE including a reference manual which can be found at: ...