You are browsing documentation for a version other than the latest stable release. Switch to the latest stable release, 1.5.

Example: QEMU


As an example, to illustrate potential pain points we will use a Versatile Express CortexA9x4 board, emulated under QEMU (vexpress-a9 target). The board comes with 128MB of CFI NOR flash, provided in form of 2 * 64MB dies. Respective details may slightly differ for NAND flash or SPI NOR flash devices.

It is possible to build a Yocto image and inspect all the details of Mender integration by adding the meta-mender-qemu layer to the build. The layer defines a vexpress-qemu-flash machine and includes all necessary pieces to enable MTD and UBI support.

In order to test raw flash support under QEMU, a QEMU version >= 2.9 is required (see the output of qemu-system-arm --version command). Earlier versions contain a bug in CFI flash support that renders flash support on vexpress-a9 unusable.

Add the following to local.conf and run bitbake core-image-minimal:

INHERIT += "mender-full-ubi"


MACHINE = "vexpress-qemu-flash"

A successful build will produce a vexpress-nor image in ${DEPLOYDIR}:

$ ls -shLl tmp/deploy/images/vexpress-qemu-flash/core-image-minimal-vexpress-qemu-flash.vexpress-nor
129M -rw-r--r-- 2 user user 129M 07-18 15:34 tmp/deploy/images/vexpress-qemu-flash/core-image-minimal-vexpress-qemu-flash.vexpress-nor

A vexpress-nor image is a tar file that contains an image for each of the nor 'drives' emulated by QEMU.

The image can be run by calling a mender-qemu helper script provided in meta-mender-qemu layer:

QEMU_SYSTEM_ARM=$HOME/qemu-install/bin/qemu-system-arm \
DISK_IMG=tmp/deploy/images/vexpress-qemu-flash/core-image-minimal-vexpress-qemu-flash.vexpress-nor \
MACHINE=vexpress-qemu-flash \

The QEMU_SYSTEM_ARM environment variable can be used to provide a path to qemu-system-arm binary. When empty or not defined, the script will call qemu-system-arm available in your $PATH.