0x1: Qemu as an environment for embedded board emulation

Table of contents

Introduction

QEMU is a CPU emulator using dynamic binary translation to convert guest CPU instructions into host CPU instructions[1]. It supports many architectures from x86, through ARM and MIPS, to MicroBlaze. According to compilation configuration target list QEMU targets 26 different softmmu types. Only for ARM it supports 33 machines (like ARM Versatile/PB (ARM926EJ-S) or Samsung NURI board (Exynos4210)) and 28 CPUs (with cortex-a9 and pxa270). It gives access to network, storage, video, usb, serial and other peripheral, also user defined. It is developed under GNU GPL, so everybody are free to make modifications, improve and extend it. This properties makes QEMU very good candidate for virtual board emulator.

Compilation

Let’s start creating our Virtual Development Board. As usually I will use latest greatest version from git:

1
git clone http://git.qemu.org/git/qemu.git

Compile it and install. Right now I will use only arm-softmmu target because it will emulate whole arm system for me. ARM right now dominated big part of embedded market but we will see if situation won’t change in feature.

1
2
3
4
cd qemu
./configure --target-list=arm-softmmu
make
make install

During configuration process you can encounter lack of pixman, just accept qemu offer to initialize it as a submodule.

1
2
3
git submodule update --init pixman
make # restart compilation process
make install

If compilation ends without problem than our first component is ready to use. Right now we can emulate our ARM based board with many types of CPUs. List of all available can be retrieved by running command qemu-system-arm -cpu ?, list of emulated machines by -M ?. Now, let’s talk about toolchains.

Kudos

[1] Dynamically Translating x86 to LLVM using QEMU


Piotr Król
I’m into open-source firmware, drawing inspiration from the classic hacker ethos of collaborative innovation and transparency. At 3mdeb, we’re excited about our two main projects: Zarhus OS, an Embedded Linux distribution based on Yocto, and Dasharo, a coreboot downstream. Both are about the value of open development, embedded firmware resilience, platform security transparency, the right to repair, and digital sovereignty. Community is at the center of our activity. By being involved in the Dasharo Users Group, Dasharo Developers vPub, and events like the Qubes OS Summit, we connect with others who share our passion for open-source.