QEMU support
Introduction
Clea OS supports building and running an image for the Quick EMUlator (QEMU).
QEMU is a generic and open source machine emulator and virtualizer.
QEMU can be used in several different modes. Clea OS supports QEMU System Emulation, which provides a virtual model of an entire machine (CPU, memory and emulated devices) to run a guest OS. In this mode the CPU may be fully emulated, or it may work with a hypervisor such as KVM to allow the guest to run directly on the host CPU.
QEMU also provides a number of standalone command line utilities, such as the qemu-img
disk image utility that allows you to create, convert and modify disk images.
The Yocto Project supports QEMU
in the sense that it uses an implementation of QEMU as part of the Yocto Project development
tool set. In Yocto, the easiest way to use QEMU is to build the Yocto SDK and use it with the
runqemu script, also part of the SDK.
See here for more
details.
Clea OS builds on top of Yocto's native support for QEMU.
QEMU support is useful for testing images and applications without having actual hardware.
Helper script (runqemu)
The Yocto Project maintains a helper script, runqemu, as part of the Yocto SDK.
This script allows running instances of QEMU with Yocto images.
Based on what you provide on the command line, runqemu tries to figure out what
you are trying to do. For example, by default, it looks for the most recently built image
according to the timestamp when it needs to look for an image.
runqemu can call bitbake and examine its environment variables to figure out where
all the files it needs are (qemu executables, configuration file, kernel/bootloader/firmware/rootfs
images).
By default, when building for a QEMU machine, Yocto outputs a .qemuboot.conf file in the
deploy directory which is read by runqemu and contains runtime configuration parameters,
e.g. what storage device to use for rootfs, or the number of CPU cores available in the guest.
The qemuboot.conf file is built by the qemuboot class from a set of Yocto variables (see here for a complete list).
Local setup
Clea OS introduces a second qemuboot.conf file, with extension .local.qemuboot.conf, which
is a patched version of the qemuboot.conf file that allows using runqemu without the yocto SDK,
using a local installation of QEMU.
The Clea OS images also install runqemu and its dependencies to DEPLOY_DIR_IMAGE.
These features are provided by the clea-os-qemu class located in meta-seco-clea-os.
Supported emulated platforms
Clea OS currently supports the following emulated machines:
| Yocto machine name | Architecture | QEMU -machine |
|---|---|---|
| qemuarm | arm | virt |
| qemuarm64 | aarch64 | virt |
| qemux86 | x86 | q35 |
| qemux86-64 | x86-64 | q35 |
The machine files are located in poky, specifically
in meta/conf/machine/.