OpenBSD ARM64 on QEMU --------------------- I was able to get OpenBSD ARM64 running on qemu 6.2.0 on MacOSX 11 (Big Sur) on M1 using the steps below. Preliminary Notes ----------------- I installed qemu from MacPorts (https://www.macports.org/), but this should work with qemu compiled from source or installed using Homebrew, see: https://gist.github.com/nrjdalal/e70249bb5d2e9d844cc203fd11f74c55 Installing OpenBSD 7.0 ARM64 under QEMU --------------------------------------- 1. Download the Tianocore EDK2 firmware / bios for ARM64: https://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/4480/QEMU-AARCH64/RELEASE_GCC5/QEMU_EFI.fd 2. Download the OpenBSD install image for ARM64: https://ftp.openbsd.org/pub/OpenBSD/7.1/arm64/install71.img 3. Create a virtual disk / disk image on which to install OpenBSD: $ qemu-img create -f qcow2 OpenBSD-7.1-arm64.qcow2 [size]G where [size] is the virtual disk's size in gigabytes. I normally use 16G for the disk size. 4. Boot qemu with the OpenBSD ARM64 installer: $ qemu-system-aarch64 -M virt,highmem=off,accel=hvf \ -m [memory] -cpu cortex-a72 -smp 4,core=2 \ -drive if=none,file=install70.img,format=raw,id=hd \ -device virtio-blk-device,drive=hd \ -netdev user,id=mynet -device virtio-net-pci,netdev=mynet \ -no-reboot \ -hda OpenBSD-7.1-arm64.qcow2 \ -bios QEMU_EFI.fd where [memory] is the amount of memory for the virtual machine. I normally use 1024 (1GB) for the virtual machine's memory. The above command assumes that the OpenBSD arm install image is located in the current directory. If you have downloaded it to a different location, you will need to change the -drive option to specify the full path to the install image. The above command also assumes that the virtual machine's disk image is located in the current directory. If you have placed that disk image in a different directory, you will need to change the -hda option to specify the full path to the disk image. Finally, the above command assumes that the firmware / bios downloaded in step 1 is located in the current directory. If you have placed the bios in a different directory, you will need to change the -bios option to specify the full path the firmware / bios. 5. In QEMU's View menu, switch to serial0 from default compat_monitor0, so that you can interact with the installer. 6. OpenBSD should boot into its standard installer. Once the installer completes, quit QEMU. Running OpenBSD ARM64 under QEMU -------------------------------- Start OpenBSD as follows: $ qemu-system-aarch64 -M virt,highmem=off,accel=hvf \ -m [memory] -cpu cortex-a72 -smp 4,core=2 \ -hda OpenBSD-7.1-arm64.qcow2 \ -netdev user,id=mynet,hostfwd=tcp:127.0.0.1:[port]-:22 \ -device virtio-net-pci,netdev=mynet \ -no-reboot \ -bios QEMU_EFI.fd where [memory] is the amount of memory for the virtual machine (I normally use 1024 (1GB) for the virtual machine's memory) and [port] is the port on the host system that can be used to connect to sshd running on the OpenBSD ARM64 QEMU virtual machine, e.g.: $ ssh -p [port] [user]@localhost or $ sftp -P [port] [user]@localhost or $ scp -P [port] [user]@localhost Optional Post Install Steps --------------------------- 1. Configure doas to allow a non-privileged user in the wheel group to perform privileged commands: a. As root, edit /etc/doas.conf and add on of the following: permit :wheel or permit persist :wheel See: https://www.vultr.com/docs/introduction-to-doas-on-openbsd https://man.openbsd.org/afterboot 2. Disable root login and .rhosts / .shosts in /etc/ssh/sshd_config: PermitRootLogin no IgnoreRhosts yes 3. Enable password-less SSH login: https://srirangav.github.io/notes/ssh_nopass.html 4. Install all available patches $ doas syspatch See: https://man.openbsd.org/syspatch 5. Install curl, git, gnupg2, xorriso, lscpu, and sysclean $ doas pkg_add curl $ doas pkg_add git $ doas pkg_add gnupg2 $ doas pkg_add xorriso $ doas pkg_add lscpu $ doas pkg_add sysclean 6. Update installed packages: $ doas pkg_add -u 7. Enable softupdates: https://www.openbsd.org/faq/faq14.html#SoftUpdates 8. Make /tmp a ramdisk: 8.1 Secure the permissions on /tmp $ doas umount /tmp $ chmod 1777 /tmp 8.2 Add the following to /etc/fstab: swap /tmp mfs rw,nodev,nosuid,-s=300m 0 0 This creates a 300MB ramdisk for /tmp, the size can be change as needed From: https://dataswamp.org/~solene/2018-05-08-mfs-tmp.html 9. Shutting down the system: $ doas shutdown -p now References ---------- The following references were helpful in getting this working: QEMU Wiki: https://wiki.qemu.org/Documentation/Platforms/ARM NetBSD/evbarm under QEMU: https://wiki.netbsd.org/ports/evbarm/qemu_arm/ OpenSUSE under QEMU: https://en.opensuse.org/openSUSE:AArch64#Using_an_emulator Installing Debian on QEMU: https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/ https://translatedcode.wordpress.com/2017/07/24/installing-debian-on-qemus-64-bit-arm-virt-board/ ArsTechnica Forums: https://arstechnica.com/civis/viewtopic.php?f=19&t=1473419 OpenBSD 7.0 to 7.1 Upgrade Guide: https://www.openbsd.org/faq/upgrade71.html History ------- 04/21/2022 - Updates for OpenBSD 7.1 03/14/2022 - Add additional optional post-install steps, correct typos 12/16/2021 - Updates for qemu 6.2.0 10/21/2021 - Initial version