Table of Contents

QEMU Basics

QEMU comes in two variants: system mode for full machine emulation, and user mode for single-binary emulation. Install with apt install qemu-system qemu-user-static on Debian/Ubuntu.

qemu-system-arm -M versatilepb -kernel zImage -nographic    # full machine
qemu-arm ./binary                                             # single binary

System mode (qemu-system-*) emulates an entire machine—CPU, memory, disk, peripherals—and boots a full OS. User mode (qemu-arm, qemu-riscv64, etc.) emulates only CPU instructions for a single process, translating syscalls to the host kernel. User mode is lighter weight when you just need to run one foreign-architecture binary.

Common flags across both modes:

-M machine          machine/board type (versatilepb, virt, etc.)
-kernel file        load kernel image
-dtb file           load device tree
-append "args"      kernel command-line arguments
-nographic          no GUI, use serial console on terminal
-m size             memory (e.g., -m 512M, -m 4G)
-smp N              number of CPUs

User mode is invoked transparently via binfmt_misc when qemu-user-static is installed. A foreign-architecture binary executes as if native; QEMU intercepts syscalls and translates them.

System mode typically runs headless with -nographic for embedded testing. Remove -nographic to open a GUI window (useful for desktop OS testing, but slower over SSH).