Abstract
Architecture specific notes for OpenBSD guests under QEMU, with working command lines where installation succeeds and failure points where it does not.
These notes generalise the working cases from
obsd.sh, a sysupgrade(8)
influenced helper for headless OpenBSD VMs with serial console output.
With current QEMU on an amd64 host, emulated systems are fast enough for
ports work; riscv64 builds gcc-16.1.0 in 1 to 2 days, close to a real
sparc64 machine.
amd64
OpenBSD/amd64 works with standard qemu-system-x86_64 emulation and
virtio networking:
qemu-system-x86_64 \
-nographic \
-m 16G \
-smp 4 \
-hda amd64.qcow2 \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0qemu-system-x86_64 \
-nographic \
-m 16G \
-smp 4 \
-hda amd64.qcow2 \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0Serial console selection remains manual:
stty com0 115200
set tty com0arm64
OpenBSD/arm64 works on the QEMU virt machine with U-Boot from the
OpenBSD u-boot-aarch64 port:
qemu-system-aarch64 \
-machine virt \
-cpu cortex-a57 \
-nographic \
-bios /usr/local/share/u-boot/qemu_arm64/u-boot.bin \
-m 16G \
-smp 4 \
-drive file=arm64.qcow2,format=qcow2,if=none,id=hd0 \
-device virtio-blk-pci,drive=hd0,bootindex=1 \
-netdev user,id=net0 \
-device virtio-net-device,netdev=net0qemu-system-aarch64 \
-machine virt \
-cpu cortex-a57 \
-nographic \
-bios /usr/local/share/u-boot/qemu_arm64/u-boot.bin \
-m 16G \
-smp 4 \
-drive file=arm64.qcow2,format=qcow2,if=none,id=hd0 \
-device virtio-blk-pci,drive=hd0,bootindex=1 \
-netdev user,id=net0 \
-device virtio-net-device,netdev=net0armv7
OpenBSD/armv7 works on the QEMU virt machine with cortex-a15, U-Boot
from the OpenBSD u-boot-arm port, 3G of RAM, and a uniprocessor
guest:
qemu-system-arm \
-machine virt,virtualization=on \
-cpu cortex-a15 \
-nographic \
-bios /usr/local/share/u-boot/qemu_arm/u-boot.bin \
-m 3G \
-smp 1 \
-drive file=armv7.qcow2,format=qcow2,if=none,id=hd0 \
-device virtio-blk-device,drive=hd0,bootindex=1 \
-netdev user,id=net0 \
-device virtio-net-device,netdev=net0qemu-system-arm \
-machine virt,virtualization=on \
-cpu cortex-a15 \
-nographic \
-bios /usr/local/share/u-boot/qemu_arm/u-boot.bin \
-m 3G \
-smp 1 \
-drive file=armv7.qcow2,format=qcow2,if=none,id=hd0 \
-device virtio-blk-device,drive=hd0,bootindex=1 \
-netdev user,id=net0 \
-device virtio-net-device,netdev=net0OpenBSD/armv7 does not support SMP; with more than 3G of RAM U-boot
failure:
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootarm.efi
** Reading file would overwrite reserved memory **
Failed to load 'efi/boot/bootarm.efi'Virtio networking needs an OpenBSD if_vio.c alignment fix1. USB
networking avoids that path, but the installer and installed system use
different interface names, cdce0 and urndis0; other NICs, including
em0 and e1000, also hung.
The target disk has an MSDOS boot partition visible as i:, so
autopartitioning must fit within 14 OpenBSD partitions.
hppa
OpenBSD/hppa works on the QEMU B160L machine with SCSI disk and
e1000 networking:
qemu-system-hppa \
-machine B160L \
-nographic \
-m 4G \
-smp 2 \
-boot c \
-drive file=hppa.qcow2,format=qcow2,if=scsi,index=0 \
-netdev user,id=net0 \
-device e1000,netdev=net0qemu-system-hppa \
-machine B160L \
-nographic \
-m 4G \
-smp 2 \
-boot c \
-drive file=hppa.qcow2,format=qcow2,if=scsi,index=0 \
-netdev user,id=net0 \
-device e1000,netdev=net0i386
OpenBSD/i386 follows the same path as OpenBSD/amd64: headless boot, virtio networking, and manual serial console selection2.
qemu-system-i386 \
-nographic \
-m 4G \
-smp 2 \
-hda i386.qcow2 \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0qemu-system-i386 \
-nographic \
-m 4G \
-smp 2 \
-hda i386.qcow2 \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0octeon
OpenBSD/octeon works on the prototype QEMU octeon3 machine from the
submitted Octeon III EBB7304 series3, with U-Boot from the OpenBSD
u-boot-octeon port:
qemu-system-mips64 \
-machine octeon3 \
-accel tcg,thread=multi \
-nographic \
-bios /usr/local/share/u-boot/octeon_ebb7304/u-boot.bin \
-m 16G \
-smp 4 \
-drive file=octeon.qcow2,format=qcow2,if=none,id=hd0 \
-device usb-storage,drive=hd0 \
-netdev user,id=net0 \
-device e1000,netdev=net0qemu-system-mips64 \
-machine octeon3 \
-accel tcg,thread=multi \
-nographic \
-bios /usr/local/share/u-boot/octeon_ebb7304/u-boot.bin \
-m 16G \
-smp 4 \
-drive file=octeon.qcow2,format=qcow2,if=none,id=hd0 \
-device usb-storage,drive=hd0 \
-netdev user,id=net0 \
-device e1000,netdev=net0powerpc64
OpenBSD/powerpc64 works on the QEMU powernv9 machine with patched
QEMU4 and talos-ii-pnor-bootkernel installed:
qemu-system-ppc64 \
-machine powernv9 \
-cpu power9 \
-nographic \
-bios /usr/local/share/qemu/skiboot.lid \
-kernel /usr/local/share/talos-ii-pnor/pnor.BOOTKERNEL \
-m 16G \
-smp 4 \
-device ich9-ahci,id=ahci0,bus=pcie.0 \
-drive file=powerpc64.qcow2,format=qcow2,if=none,id=hd0 \
-device ide-hd,bus=ahci0.0,drive=hd0,bootindex=1 \
-netdev user,id=net0 \
-device e1000e,bus=pcie.1,netdev=net0qemu-system-ppc64 \
-machine powernv9 \
-cpu power9 \
-nographic \
-bios /usr/local/share/qemu/skiboot.lid \
-kernel /usr/local/share/talos-ii-pnor/pnor.BOOTKERNEL \
-m 16G \
-smp 4 \
-device ich9-ahci,id=ahci0,bus=pcie.0 \
-drive file=powerpc64.qcow2,format=qcow2,if=none,id=hd0 \
-device ide-hd,bus=ahci0.0,drive=hd0,bootindex=1 \
-netdev user,id=net0 \
-device e1000e,bus=pcie.1,netdev=net0riscv64
OpenBSD/riscv64 works with OpenSBI and U-Boot from the OpenBSD
u-boot-riscv64 port:
qemu-system-riscv64 \
-machine virt \
-nographic \
-bios /usr/local/share/opensbi/generic/fw_jump.bin \
-kernel /usr/local/share/u-boot/qemu-riscv64_smode/u-boot.bin \
-m 16G \
-smp 4 \
-hda riscv64.qcow2 \
-netdev user,id=net0 \
-device virtio-net-device,netdev=net0qemu-system-riscv64 \
-machine virt \
-nographic \
-bios /usr/local/share/opensbi/generic/fw_jump.bin \
-kernel /usr/local/share/u-boot/qemu-riscv64_smode/u-boot.bin \
-m 16G \
-smp 4 \
-hda riscv64.qcow2 \
-netdev user,id=net0 \
-device virtio-net-device,netdev=net0sparc64
OpenBSD/sparc64 works on the QEMU sun4u machine with a patched 5
6 7 OpenBIOS image8 and one CPU:
qemu-system-sparc64 \
-machine sun4u \
-nographic \
-prom-env boot-device=disk \
-bios /path/to/openbios-sparc64-fixed.elf \
-m 16G \
-smp 1 \
-hda sparc64.qcow2 \
-net nic,model=sunhme \
-net userqemu-system-sparc64 \
-machine sun4u \
-nographic \
-prom-env boot-device=disk \
-bios /path/to/openbios-sparc64-fixed.elf \
-m 16G \
-smp 1 \
-hda sparc64.qcow2 \
-net nic,model=sunhme \
-net userUnsupported
OpenBSD/alpha is blocked by QEMU firmware support. QEMU provides only
the clipper machine with emulation PALcode, not an SRM console able to
boot OpenBSD media. Direct -kernel loading bypasses the OpenBSD boot
path and does not provide the PROM state OpenBSD expects.
OpenBSD/landisk has no matching QEMU machine. QEMU provides r2d-plus,
not the IO-DATA LANDISK platform. Disk boot lacks LANDISK firmware,
and direct kernel entry resets before the console is initialized.
OpenBSD/luna88k has no matching QEMU m88k system emulator.
OpenBSD/macppc reaches the OpenBSD ramdisk under qemu-system-ppc, but
hangs after mounting rd0 and printing the clock warning.
The required OpenBSD
if_vio.cpatch was posted toopenbsd-bugsand is available at https://marc.info/?l=openbsd-tech&m=178111370945923&q=raw. ↩︎QEMU 11.0.1 and probably 11.0.0 has a separate i386 issue: https://gitlab.com/qemu-project/qemu/-/work_items/3537. ↩︎
The initial QEMU Octeon III EBB7304 machine series was posted to
qemu-develand is available at https://marc.info/?l=qemu-devel&m=178394159207899&w=2. ↩︎The required patch was posted to
qemu-develand is available at https://marc.info/?l=qemu-devel&m=178097910779871&q=raw. ↩︎The OpenBIOS patch fixing crashes with non installer OpenBSD kernels is available at https://github.com/catap/openbios/commit/9151118aea489f9fffa40c60ee3b1d93383fb96b.patch. ↩︎
The OpenBIOS patch fixing crashes on reboot is available at https://github.com/catap/openbios/commit/8d5ed09f0420389a27394b7c1b7d40ae7aab9d32.patch. ↩︎
The OpenBIOS patch allowing more than
4Gof RAM is available at https://github.com/catap/openbios/commit/cd90de7bda9006e2382d10302555a4cf825ea425.patch. ↩︎A prebuilt OpenBIOS image with these patches is available at https://github.com/catap/obsd.sh/raw/66b429b7ece9710d939bc81987d714e160ee311f/openbios-sparc64-obsd-cd90de7.elf. ↩︎