QEMU is an an open source processor emulator (and virtualizer). This document descripes howto run the OpenWrt x86 port in QEMU.
- qemu an example setup
It is mixed descriptions from windows and linux, so please read through all of it before starting.
Choosing different emulation settings can affect performance greatly.
Example: 30s iperf-s@openwrt(qemu running on host) to host
ne2k_pci:0.0-31.3 sec 14.6 MBytes 3.92 Mbits/sec pcnet: 0.0-30.0 sec 2.38 GBytes 682 Mbits/sec e1000: 0.0-30.0 sec 6.23 GBytes 1.79 Gbits/sec vmxnet3: 0.0-30.0 sec 8.67 GBytes 2.48 Gbits/sec virtio-net-pci: 0.0-30.0 sec 44.6 GBytes 12.8 Gbits/sec
Qemu runs on many different systems.
Many Linux Distributions like Debian, Ubuntu, Suse, Fedora provide a qemu package in their package repositories.
Example for Debian 7 (Wheezy):
sudo apt-get install qemu
Qemu is rapidly developing so features, syntax might change between versions.
The QEMU Wiki Links page provides you with several unoffical download links of Windows builds.
The "realview" platform is meant for use with QEMU for emulating an ARM system. This platform might not be available in the standard downloads (it isn't at time of writing), but it currently appears when building from scratch.
As of QEMU 1.1.2, use the following on the command line to get it booting:
qemu-system-arm -M realview-eb-mpcore -kernel openwrt-realview-vmlinux.elf -net nic -net user -nographic
Basically, use the generated image as the `-kernel` parameter.
Trunk: kernel image does not boot; initramfs image works Trunk: untested: use SD card with rootfs, NFS rootfs, NBD rootfs Trunk: no sound, pcibus, usb emulation in qemu possible?
The "malta" platform is meant for use with QEMU for emulating a MIPS system.
The malta platform is broken in trunk since gcc was switched to 4.8. Compile with gcc 4.6 to get it working or disable MIPS16. ticket #16881
qemu-git has the potential fix since October 2014
depending on the malta variant
qemu-system-mipsel -kernel openwrt-malta-le-vmlinux-initramfs.elf -nographic -m 256
The x86-64 target has support for ESXI images by default. Booting the VMDK / VDI images might not work with newer qemu versions.
IMG/VDI/VMDK with "-hda" switch do not work with qemu 2.x .
pc-q35-2.0 / q35 emulates a different machine. With new syntax (no -hda , -net) the IMG / VDI / VMDK works here.
- 2 HDDs (1 openwrt image, 1 data)
- 1 drive per bus, 6 bus available (until ide.5)
- 2 Network cards : 1 bridged to host (need higher permission) and 1 "user" (default, NAT 10.x.x.x)
Some emulated network cards might have performance issues.
qemu-system-x86_64 \ -enable-kvm \ -M pc-q35-2.0 \ -drive file=openwrt-x86_64-combined-ext4.vdi,id=d0,if=none \ -device ide-hd,drive=d0,bus=ide.0 \ -drive file=data.qcow2,id=d1,if=none \ -device ide-hd,drive=d1,bus=ide.1 \ -soundhw ac97 \ -netdev bridge,br=virbr0,id=hn0 \ -device e1000,netdev=hn0,id=nic1 \ -netdev user,id=hn1 \ -device e1000,netdev=hn1,id=nic2 qemu-system-x86_64 -M q35 -drive file=openwrt-x86_64-combined-ext4.img,id=d0,if=none,bus=0,unit=0 -device ide-hd,drive=d0,bus=ide.0
doc/howto/qemu.txt · Last modified: 2014/10/27 09:38 by theoradicus