Last Updated on April 21, 2023

How to install and use the Reliable Embedded Systems – Robert Berger e.U. Yocto Project®/OpenEmbedded build framework

Objectives

This post shows you how to install and use the Reliable Embedded Systems – Robert Berger e.U. Yocto Project®/OpenEmbedded build framework.

Prerequisites

A somewhat recent Linux distro should be fine. I’ll show you how to install the framework on something like Ubuntu 18, 20 or 22.

Install the Build framework

Install docker

sudo apt install docker.io
sudo usermod -aG docker ${USER}
sudo reboot

Install git

sudo apt install git

Default gitconfig

In case you don’t already have a proper gitconfig you can use the one provided with here:

pushd ~
wget https://raw.githubusercontent.com/RobertBerger/manifests/master/gitconfig
mv gitconfig .gitconfig
popd

Create a directory where you have plenty of space

mkdir -p ~/projects/resy-playground
cd ~/projects/resy-playground
sudo ln -sf ~/projects/resy-playground /workdir

You might need to fix some permissions.

Download the latest version

mkdir -p /workdir/sources
pushd /workdir/sources
git clone https://github.com/RobertBerger/manifests.git
popd

cd /workdir
ln -sf sources/manifests/resy.sh resy.sh
chmod +x resy.sh
./resy.sh

Pick e.g. experimental. The script pulls lot’s of meta-layers as well as a couple of “helper scripts”.

Let’s build something

Start the poky build container

./resy-poky-container.sh

This will pull the “container” when you do it the first time:

+ docker pull reliableembeddedsystems/poky-container:2021-05-07-master-local-gcc-9-gui-icecc-ub18
...
Digest: sha256:3f83f549071bfb1bdf1609b0bb977d4ba494ac5cdaa262e641a09a7d1827cb4a
Status: Downloaded newer image for reliableembeddedsystems/poky-container:2021-05-07-master-local-gcc-9-gui-icecc-ub18
docker.io/reliableembeddedsystems/poky-container:2021-05-07-master-local-gcc-9-gui-icecc-ub18
+ set +x
 -- interactive mode --
source /workdir/resy-cooker.sh in container
+ press <ENTER> to go on

You should end up at a command line shell inside the container.

+ docker run --name poky_container --rm -it --add-host mirror:192.168.42.1 --net=host -p ::10245/tcp -p ::8765/tcp -p ::8766/tcp -p ::8765/udp -v /home/student/projects:/projects -v /opt:/nfs -v /workdir:/workdir -v /workdir:/workdir reliableembeddedsystems/poky-container:2021-05-07-master-local-gcc-9-gui-icecc-ub18 --workdir=/workdir
WARNING: Published ports are discarded when using host network mode
pokyuser@e450-6:/workdir$ 

You may want to inspect the script and adjust some settings on top of it. What I would suggest as a good starting point is this:

#!/bin/bash
# this enables building all the images 
# for a specific MACHINE as defined in resy-cooker.sh
# set to "yes" if you want this to happen in non-interactive mode
BUILD_ALL_VAR="no"
USE_GUI="no"
USE_MIRROR="no"
DOCKER_PULL="yes"
USE_ICECC="no"
USE_QEMU="no"

This needs to be done from inside of the container

Get preconfigured build environments

pokyuser@e450-6:/workdir$ source /workdir/resy-cooker.sh

This is what is currently available:

/workdir /workdir
--> USAGE 1 <--
usage:
source /workdir/resy-cooker.sh MACHINE or MACHINE-sw-variant
source /workdir/resy-cooker.sh container-x86-64
available targets:
am335x-phytec-wega-mender
am335x-phytec-wega-wic
am335x-phytec-wega-wic-master
am335x-pocketbeagle-wic-master
am335x-regor-rdk-wic-master
beagle-bone-black-mender
beagle-bone-black-virt-wic
beagle-bone-black-wic
beagle-bone-black-wic-master
beagle-bone-green-wic
beagle-bone-green-wic-master
container-arm-v7
container-arm-v7-master
container-arm-v7-phoronix
container-arm-v7-tig
container-raspberrypi-4-64-ml-phoronix
container-x86-64
container-x86-64-golang
container-x86-64-golang-master
container-x86-64-java
container-x86-64-java-master
container-x86-64-master
container-x86-64-tensorflow
container-x86-64-tensorflow-master
container-x86-64-tig
container-x86-64-tig-master
de0-nano-soc-kit-wic-master
imx6q-phytec-mira-rdk-nand-mender
imx6q-phytec-mira-rdk-nand-virt-mender
imx6q-phytec-mira-rdk-nand-virt-wic
imx6q-phytec-mira-rdk-nand-virt-wic-mc
imx6q-phytec-mira-rdk-nand-virt-wic-mc-master
imx6q-phytec-mira-rdk-nand-wic  
imx6q-phytec-mira-rdk-nand-wic-master
imx6sx-udoo-neo-full-wic-master 
imx6ul-phytec-segin-systemd-wic-master
imx6ul-phytec-segin-virt-telegraf-wic-master
imx6ul-phytec-segin-wic-master  
imx8mmevk-master
karo-imx6ul-txul
multi-v7-mender
multi-v7-ml
multi-v7-ml-bpf-master
multi-v7-ml-debug
multi-v7-ml-debug-training
multi-v7-ml-debug-training-libs 
multi-v7-ml-debug-training-lic  
multi-v7-ml-debug-training-pkgs 
multi-v7-ml-master
multi-v7-ml-pkgs
multi-v7-ml-prt
multi-v7-ml-qt5
multi-v7-ml-virt
multi-v7-ml-virt-docker-master  
multi-v7-ml-virt-podman-master  
multi-v7-ml-xenomai
omap3-beagle-xm-wic-master
phyboard-polis-imx8mm-wic
phyboard-polis-imx8mm-wic-virt  
qemux86-64-virt-master
raspberrypi-4-64-ml-kernel-wic  
raspberrypi-4-64-ml-kernel-wic-virt-all-sdcard
raspberrypi-4-64-ml-kernel-wic-virt-tftp-nfs
raspberrypi-4-64-raspi-kernel-wic
stm32mp157c-dk2-systemd-wic-master
stm32mp157c-dk2-wic-master
--> $#: 0
pokyuser@e450-6:/workdir/build$ 

Pick one

e.g. imx6q-phytec-mira-rdk-nand-wic-master: This is an SD card image for an imx6q-phytec-mira-rdk-nand board from master git branches.

pokyuser@e450-6:/workdir/build$ source /workdir/resy-cooker.sh imx6q-phytec-mira-rdk-nand-wic-master
/workdir /workdir/build /workdir
MACHINE or MACHINE-sw-variant: imx6q-phytec-mira-rdk-nand-wic-master
initial SITE_CONF=../../sources/meta-resy/template-common/site.conf.sample
TEMPLATECONF: ../meta-u-boot-wic-bsp-master/template-imx6q-phytec-mira-rdk-nand-master
source ../sources/poky-master/oe-init-build-env imx6q-phytec-mira-rdk-nand-wic-master
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:   
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal

You can also run generated qemu images with a command like 'runqemu qemux86'
conf
├── bblayers.conf
├── local.conf
├── site.conf
└── templateconf.cfg

0 directories, 4 files
/workdir/build /workdir
--> $#: 1
pokyuser    74    21  0 11:29 pts/0    00:00:00 /bin/bash /workdir/killall_bitbake.sh
pokyuser    76    74  0 11:29 pts/0    00:00:00 grep bitbake
pokyuser    74    21  0 11:29 pts/0    00:00:00 /bin/bash /workdir/killall_bitbake.sh
pokyuser    81    74  0 11:29 pts/0    00:00:00 grep bitbake
rm -f /workdir/build/imx6q-phytec-mira-rdk-nand-wic-master/hashserve.sock
to ./resy-poky-container.sh:
 -- non-interactive mode --
 add the image you want to build to the command line ./resy-poky-container.sh <MACHINE> <image>
 -- interactive mode --
   enter it with - ./resy-poky-container.sh <no param>
   bitbake <image>
   source /workdir/resy-cooker.sh <MACHINE>
pokyuser@e450-6:/workdir/build$ 

Let’s build a “core-image-minimal” with BitBake:

pokyuser@e450-6:/workdir/build$ bitbake core-image-minimal

Please note, that since those are “master branches” it’s not guaranteed to build out of the box. You might want to use a “non-master” configuration for something which will build out-of-the-box with a much higher probability. Anyways, if you get lucky, you’ll see something like this:

NOTE: Started PRServer with DBfile: /workdir/build/imx6q-phytec-mira-rdk-nand-wic-master/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 41854, PID: 21366
Loading cache: 100% |##########################################################################################################################################################| Time: 0:00:00
Loaded 3676 entries from dependency cache.
Parsing recipes: 100% |########################################################################################################################################################| Time: 0:00:00
Parsing of 2394 .bb files complete (2393 cached, 1 parsed). 3677 targets, 137 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.49.2"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-resy-linux-gnueabi"
MACHINE              = "imx6q-phytec-mira-rdk-nand"
DISTRO               = "resy"
DISTRO_VERSION       = "3.3"
TUNE_FEATURES        = "arm armv7a vfp thumb callconvention-hard"
TARGET_FPU           = "hard"
meta
meta-poky
meta-yocto-bsp       = "master:e1839b58ebe05242a52fe050aa9a08140136aa0a"
meta-multi-v7-ml-bsp-master = "master:00f716ef03a6d37489cf8f1704a566938d3c7c64"
meta-u-boot-wic-bsp-master = "master:4d38425039ff45f8e314f8d1127875b6694d5a1e"
meta-resy-master     = "master:48562f43bed481ad342d92b9cdcb45fa75487f58"
meta-oe
meta-networking
meta-filesystems
meta-python          = "master:a23fa069d0a60cf348dcc6399f7990de59105c21"

Initialising tasks: 100% |#####################################################################################################################################################| Time: 0:00:01
Sstate summary: Wanted 0 Local 0 Network 0 Missed 0 Current 1036 (0% match, 100% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 2843 tasks of which 2843 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 1 seconds
pokyuser@e450-6:/workdir/build/imx6q-phytec-mira-rdk-nand-wic-master/conf$ 

Conclusion

That’s just a small demo of how a “Build Container” can be used.

Appendix

For a blog post that describes how to build the upstream kernel without the Yocto Project® have a look here. If you want to learn how Embedded Linux works have a look here. To learn more about the Yocto Project® have a look here.

Upcoming Events

Our 3 points

of differentiation

We provide host and target hardware during all our teaching.

Three or more people from the same company? We provide private customized training – consulting included.

Subject matter experts develop high-quality, job-related, up-to-date, authentic courseware.