Skip to content

QEMU ARM

Board Identification

QEMU ARM is a generic and open source ARM machine emulator and virtualizer. It can emulate more than 100 boards. We support one.

Identifier: qemuarm/virt/cortex-a15

Yocto MACHINE: qemuarm-welma

Documentation:

Features:

  • Networking
  • Storage
  • Memory
  • Serial

In order to run the emulator your need the program qemu-system-arm (at least version 4.2.1):

  • Either Built by Yocto in your build environment
  • Or available in most GNU/Linux desktop distributions

Boot Sequence

QEMU ARM with Welma has the following boot sequence:

  • QEMU ARM starts U-Boot (via argument -bios).
  • U-Boot loads the Linux kernel from a vfat of ext4 partition (available via virtio-blk) and starts it.
  • The kernel mounts the initial ram file system (initramfs) and starts Init

First Installation

No first installation needed. See Regular Boot.

Regular Boot

QEMU ARM starts with 2 files:

  • u-boot.bin
  • A SD card image (eg: generated by wic)

Example:

$ QEMU=$TOPDIR/tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/qemu-system-arm
$ SDIMG=$TOPDIR/tmp/deploy/images/qemuarm-welma/welma-image-minimal-dev-qemuarm-welma.wic
$ UBOOT=$TOPDIR/tmp/deploy/images/qemuarm-welma/u-boot.bin
$ $QEMU -drive id=disk0,file=$SDIMG,if=none,format=raw -device virtio-blk-device,drive=disk0 \
        -bios $UBOOT \
        -machine virt -m 256 -nographic

U-Boot 2022.01 (Jan 10 2022 - 18:46:34 +0000)
...
Booting Welma...
...
[    0.000000] Booting Linux on physical CPU 0x0
...
login:

Runqemu

runqemu is a helper script provided by Yocto within the build environment.

Note

runqemu is sometimes configured to set up network interfaces, and therefore needs sudo. To prevent the need for sudo, set: QB_NET=none.

Networking Host to Guest

A simple way to forward a specific host port to a guest port is to use the option hostfwd=hostip:hostport-guestip:guestport.

This does not require having sudo nor being root.

Example to enable a SSH connection from the host to the guest:

$ qemu-system-arm ... -net user,hostfwd=tcp::2222-:22 -net nic

Host programs can then connect to the guest as follows:

$ ssh localhost -p 2222

Appendix

Qemu Basic Controls

Excerpt:

C-a h    print this help
C-a x    exit emulator
C-a t    toggle console timestamps
C-a c    switch between console and monitor

Hardware Watchdog

Not configured.

Device Tree

QEMU ARM supplies the DTB in RAM dynamically (at address 0x40000000). For instance, the 2 following command lines do not result in the same DTB:

  • qemu-system-arm -machine virt
  • qemu-system-arm -machine virt,highmem=off -cpu cortex-a15 -smp 4 -m 1024