Setup an OpenBSD SPARC64 VM in QEMU

Last modification on 2018-07-19

This describes how to setup an OpenBSD SPARC64 VM in QEMU.

 

Create a disk image

To create a 5GB disk image:

qemu-img create -f qcow2 fs.qcow2 5G

 

Install

In this guide we'll use the installation ISO to install OpenBSD. Make sure to download the latest (stable) OpenBSD ISO, for example install62.iso.

Start the VM:

#!/bin/sh
LC_ALL=C QEMU_AUDIO_DRV=none \
qemu-system-sparc64 \
	-machine sun4u,usb=off \
	-realtime mlock=off \
	-smp 1,sockets=1,cores=1,threads=1 \
	-rtc base=utc \
	-m 1024 \
	-boot c \
	-drive file=fs.qcow2,if=none,id=drive-ide0-0-1,format=qcow2,cache=none \
	-cdrom install62.iso \
	-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-1,id=ide0-0-1 \
	-msg timestamp=on \
	-serial pty -nographic \
	-net nic,model=ne2k_pci -net user

The VM has the following properties:

From your host connect to the serial device indicated by QEMU, for example:

(qemu) 2017-11-19T15:14:20.884312Z qemu-system-sparc64: -serial pty: char device redirected to /dev/ttyp0 (label serial0)

Then type to attach:

cu -l /dev/ttyp0

to detach the cu(1) man page says:

Typed characters are normally transmitted directly to the remote machine
(which does the echoing as well).  ) appearing as the first
character of a line is an escape signal; the following are recognized:

    ~^D or ~.  Drop the connection and exit.  Only the connection is
               the login session is not terminated.

On boot you have to type:

root device: wd0a
for swap use the default (wd0b) Press enter

 

Initial settings on first boot (optional)

Automatic network configuration using DHCP

echo "dhcp" > /etc/hostname.ne0

To bring up the interface (will be automatic on the next boot):

sh /etc/netstart

Add a mirror to /etc/installurl for package installation. Make sure to lookup the most efficient/nearby mirror site on the OpenBSD mirror page.

echo "https://ftp.hostserver.de/pub/OpenBSD" > /etc/installurl

 

I hope this is useful. Have fun.