Introduction
The Yocto Project consists of recipes, dependencies and metadata to instruct the build system how to build software packages for installation into a target embedded operating system.
The official Mender documentation explains how Mender works. This is a board-specific complement to the official documentation for the QEMU platform.
Board description
QEMU (short for Quick Emulator ) is a free and open-source emulator that performs hardware virtualization.
QEMU is a hosted virtual machine monitor, it emulates the machine’s processor through dynamic and provides a set of different hardware and device models for the machine, enabling it to run a variety of guest operating systems. It also can be used with KVM to run virtual machines at near-native speed (by taking advantage of hardware extensions such as Intel VT-x).
QEMU machines are something that we at Mender use heavily during development and this is also the primary target for our integration tests.
URL: https://qemu.weilnetz.de/doc/qemu-doc.html
Wiki: Documentation - QEMU
Test results
The tutorial has been verified on Debian 11, as of 2023-08-04
This tutorial uses kirkstone as the primary target, which is the current LTS release by the Yocto Project. You can find more infomation on releases here. Supported releases for following the tutorial are:
Yocto Project | Tutorial applies | Maintenance |
---|---|---|
nanbield (4.3) | development | |
mickledore (4.2) | current stable | |
langdale (4.1) | stable | |
kirkstone (4.0) | LTS | |
honister (3.4) | EOL | |
hardknott (3.3) | EOL | |
gatesgarth (3.2) | EOL | |
dunfell (3.1) | LTS | |
zeus (3.0) | EOL | |
warrior (2.7) | EOL | |
thud (2.6) | EOL | |
sumo (2.5) | EOL | |
rocko (2.4) | EOL |
Please note: a failure in the “tutorial applies” column indicates that the instructions do not work without modification. Depending on the combination of release and host Linux distribution, installing other python versions or dependencies might provide a functional state.
Get started
Prerequisites
- A supported Linux distribution and dependencies installed on your workstation/laptop as described in the Yocto Mega Manual
- NOTE. Instructions depend on which Yocto version you intend to use.
- Google repo tool installed and in your
PATH
.
Configure the build
Setup the Yocto environment
Set the Yocto Project branch you are building for:
# set to your branch, make sure it is supported (see table above)
export BRANCH="kirkstone"
Create a directory for your mender-qemu
setup to live in and clone the
meta information.
mkdir mender-qemu && cd mender-qemu
Initialize repo manifest:
repo init -u https://github.com/mendersoftware/meta-mender-community \
-m meta-mender-qemu/scripts/manifest-qemu.xml \
-b ${BRANCH}
Fetch layers in manifest:
repo sync
Setup build environment
Initialize the build environment:
source setup-environment qemu
Configure Mender server URL (optional)
This section is not required for a successful build but images that are generated by default are only suitable for usage with the Mender client in standalone mode, due to lack of server configuration.
You can edit the conf/local.conf
file to provide your Mender server configuration, ensuring the generated images and Mender Artifacts are connecting to the Mender server that you are using. There should already be a commented section in the generated conf/local.conf
file and you can simply uncomment the relevant configuration options and assign appropriate values to them.
Build for Hosted Mender:
# To get your tenant token:
# - log in to https://hosted.mender.io
# - click your email at the top right and then "My organization"
# - press the "COPY TO CLIPBOARD"
# - assign content of clipboard to MENDER_TENANT_TOKEN
#
MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = "<copy token here>"
Building the image
You can now proceed with building an image:
MACHINE=qemux86-64 bitbake core-image-base
Replace core-image-base
with your desired image target.
NOTE. Other supported targets are vexpress-qemu
and vexpress-qemu-flash
but it is recommend to run the qemux86-64
as this is the only one that is able to utilize hardware accelerated emulation resulting in a near-native experience. The vexpress
targets which emulates ARM machines are slow due to not being able to utilize e.g KVM.
Using the build output
After a successful build, the images and build artifacts are:
- tmp/deploy/images/qemux86-64/core-image-base-qemux86-64.uefiimg.gz
- tmp/deploy/images/qemux86-64/core-image-base-qemux86-64.mender
The disk image .uefiimg.gz
is used to provision the device storage for devices without Mender running already. Please proceed to the official documentation on provisioning a new device for steps to do this.
On the other hand, if you already have Mender running on your device and want to deploy a rootfs update using this build, you should use the Mender Artifact files, which have .mender
suffix. You can either deploy this Artifact in managed mode with the Mender server (upload it under Releases in the server UI) or by using the Mender client standalone mode.
Using the virtual environment
To start the virtual environment run:
../sources/meta-mender/meta-mender-qemu/scripts/mender-qemu core-image-base
If this post was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!