QEMU provides system emulators, user-mode CPU emulators, and storage tools. A system emulator models a complete machine, including CPUs, memory, firmware, buses, and devices. A user-mode emulator translates a foreign-architecture userspace program and maps its system calls to the host kernel; it does not boot a guest kernel.
System Emulation #
qemu-system-x86_64 creates an x86-64 virtual machine. -m selects guest memory and -smp selects virtual CPUs. Firmware is part of the machine configuration: SeaBIOS provides legacy BIOS on x86, while OVMF provides UEFI firmware. Storage backends and devices are distinct: -blockdev defines a backend and -device attaches a guest controller or device. -drive is a convenient shorthand for common combinations.
qemu-img create -f qcow2 guest.qcow2 32G
qemu-system-x86_64 \
-m 4G -smp 4 \
-drive file=guest.qcow2,format=qcow2,if=virtio \
-cdrom installer.iso \
-boot order=d \
-display gtk-boot order=d selects the CD-ROM for the initial boot. Use -monitor stdio only when the QEMU monitor should share the controlling terminal; serial-console guests commonly use -serial stdio instead. KVM acceleration is enabled with -accel kvm on a compatible Linux host and changes execution speed, not guest-device semantics.
Supporting Tools #
qemu-img creates, converts, checks, and snapshots disk images. qemu-nbd exposes an image through the Network Block Device protocol. qemu-io issues controlled I/O to an image for testing. qemu-storage-daemon serves storage backends through QEMU’s block layer. qemu-pr-helper assists SCSI persistent reservations, and qemu-edid tests EDID generation.
User-mode executables include commands such as qemu-aarch64, qemu-riscv64, and qemu-mips. They require a target userspace library tree when the program has a dynamic interpreter; -L selects that prefix. Binfmt integration can register a user-mode emulator for foreign executables, but the host kernel still provides the system-call implementation.
Comments
Read or comment on GitHub (sign-in required to comment)