You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Create disk image
qemu-img create -f qcow2 disk.qcow2 20G
# Boot from ISO
qemu-system-x86_64 \
-hda disk.qcow2 \
-cdrom os.iso \
-m 2048 \
-enable-kvm \
-boot d
# Basic system emulation
qemu-system-x86_64 \
-hda disk.img \
-m 2048 \
-nographic \
-net user \
-net nic
User-Mode Emulation
# Run ARM binary on x86
qemu-arm ./arm_binary
# Run with arguments
qemu-arm -L /path/to/arm/libs ./arm_binary arg1 arg2
# Debug with GDB
qemu-arm -g 1234 ./arm_binary
Monitor Commands
Basic Monitor
info cpus # Show CPU info
info registers # Display registers
info mem # Memory information
info mtree # Memory mapping
info blocks # Show blocks
info snapshots # List snapshots
VM Control
stop # Pause VM
cont # Continue VM
system_reset # Reset VM
quit # Exit QEMU
savevm name # Create snapshot
loadvm name # Load snapshot
delvm name # Delete snapshot
Debugging Features
GDB Integration
# Start QEMU with GDB server
qemu-system-x86_64 -s -S [other options]
# Connect with GDB
$ gdb
(gdb) target remote localhost:1234
(gdb) continue
Memory Analysis
# Monitor commands
xp /fmt addr # Physical memory examination
x /fmt addr # Virtual memory examination
memsave addr size file # Save memory to file
pmemsave addr size file # Save physical memory
Network Configuration
User Mode
# Basic NAT networking
-net user \
-net nic
# Port forwarding
-net user,hostfwd=tcp::2222-:22 \
-net nic
Tap Interface
# Create tap interface
sudo tunctl -u $USER -t tap0
sudo ip link set tap0 up
# Use tap interface
-netdev tap,id=net0,ifname=tap0,script=no \
-device e1000,netdev=net0
Advanced Features
CPU/Machine Options
# Specify CPU model
-cpu model
# SMP configuration
-smp cores=4,threads=2
# Machine type
-machine type=pc,accel=kvm
Disk Operations
# Convert disk formats
qemu-img convert -f raw -O qcow2 disk.img disk.qcow2
# Resize disk
qemu-img resize disk.qcow2 +10G
# Show disk info
qemu-img info disk.qcow2