Site Tools


wiki:qemu-kernel-booting

Table of Contents

QEMU Kernel Booting

Kernel booting is the fastest way to test a freshly cross-compiled kernel without needing a full disk image. Load the kernel, device tree, and command-line arguments directly.

qemu-system-arm -M versatilepb -kernel zImage -dtb versatile.dtb \
  -append "console=ttyAMA0 earlycon" -nographic

-kernel loads the kernel image (typically Image or zImage depending on architecture). -dtb provides the device tree file that describes the board's memory layout, peripherals, and clocks. Without a device tree, the kernel cannot initialize hardware.

-append sets kernel command-line arguments passed at boot. console=ttyAMA0 tells the kernel to use that serial port for output; earlycon enables serial output before the main console is initialized, useful for debugging early boot.

The -nographic flag redirects the serial port to your terminal. The kernel's boot output appears on stdout; you can interact with it as if it were a serial console.

Common QEMU boards for embedded testing:

qemu-system-arm -M versatilepb       # ARM Versatile PB (well-supported, stable)
qemu-system-riscv64 -M virt          # RISC-V virtual machine
qemu-system-arm -M raspi2            # Raspberry Pi 2 (partial support)

Kernel boot is read-only by default—no rootfs, no persistent filesystem. Good for testing boot sequence, but to test with a running system, use a disk image (QEMU Disk Images).

The kernel panics and shuts down when it can't find init. Add panic=1 to halt immediately on panic instead of looping indefinitely, useful for automated testing.

wiki/qemu-kernel-booting.md · Last modified: by 127.0.0.1