Yocto environment

This guide shows you how to set up the tools needed to build Linux Yocto images. It also shows you how to create a cross development environment for the Navq Development Board (HoverGames2)

i.MX Linux Yocto Project for HoverGames

First we need to install repo utility

$ mkdir ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ PATH=${PATH}:~/bin

Download the yocto project repository

$ mkdir yocto
$ cd yocto
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-zeus -m imx-5.4.24-2.1.0_hovergames_demo.xml
$ repo sync

There are several options for both DISTRO and MACHINES to build on. For example, for HoverGames Navq we might use:

$ DISTRO=imx-desktop-xwayland MACHINE=imx8mmnavqubuntu source setup-hovergames-demo -b build-demo

"build-demo" is the directory name for our image build. Above command also sources the file "setup-hovergames-demo" which initializes the paths for variables needed for the build.

Now, to build the image we just need to do (under the build-demo directory)

$ bitbake imx-image-hovergames-demo

This will create a bunch of files under yocto/build-demo/tmp/deploy/images/imx-image-hovergames-demo. The fastest way to flash an image to an SD card is through BalenaEtcher App which you can download from following link. The app is very intuitive to use.

One of the archives created in the imx-image-hovergames-demo directory is the complete SD card image, ready to be flashed. First you need to unzip the SD card image with:

$ bunzip2 -dk -f imx-image-hovergames-demo.wic.bz2

Then just open BalenaEtcher app, select the unziped image and assign it to your memory card. Simply as that.

Cross development environment

Now, to create a useful cross development environment, we are gonna use another DISTRO and MACHINE options, compatible with the Navq board. This is because the demo image has a Ubuntu 20.04 rootfs and we are using Ubuntu18 as host computer (I have not tested the populate_sdk command on a Ubuntu20 machine) So, type:

$ cd yocto
$ DISTRO=fsl-imx-wayland MACHINE=imx8mmevk source imx-setup-release.sh -b build-wayland

Once the directory build-wayland is created the terminal automatically enters it. You have to execute:

$ bitbake imx-image-full -c populate_sdk

"imx-image-full" is the image we are building for. It contains Qt 5 and machine learning features. It also contains gstreamer and opencv.

The "populate_sdk" generates a script file that sets up a standalone environment without Yocto Project. It includes the tools, toolchain and a small rootfs to compile against to put on the host machine.

The script can be found under yocto/build-wayland/tmp/deploy/sdk. Enter the directory and execute it. By default, the SDK installs everything under de /opt directory, but you can specify another one.

Every time you want to use the toolchain, you must source all the variables, with:

$ source /opt/fsl-imx-wayland/5.4-zeus/environment-setup-aarch64-poky-linux
$ export ARCH=arm64