Guides

Booting BSD

Boot FreeBSD's and OpenBSD's stock arm64 images through U-Boot and EFI, as on real hardware.

FreeBSD and OpenBSD boot the way they do on a real Arm board. U-Boot, in flash, starts the EFI loader on the disk, and the loader starts the kernel. Both need the U-Boot build for QEMU's virt board; see U-Boot.

FreeBSD

FreeBSD publishes raw arm64 disk images.

curl -LO https://download.freebsd.org/releases/VM-IMAGES/15.1-RELEASE/aarch64/Latest/FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xz
unxz FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw.xz

warm-system-aarch64 -m 1G -cpu cortex-a76 -bios u-boot.bin \
  -drive file=FreeBSD-15.1-RELEASE-arm64-aarch64-ufs.raw,if=virtio,format=raw -nographic

loader.efi runs, then the kernel boots, fsck and the rc scripts run, and you get a login prompt. Log in as root.

FreeBSD boots at EL1, as in QEMU. To boot it at EL2, where it uses the Virtualization Host Extensions, add -M virt,virtualization=on.

OpenBSD

OpenBSD's miniroot79.img is its installer on a small disk image. It boots to the installer's prompt, where you can install to a second disk or open a shell.

curl -LO https://cdn.openbsd.org/pub/OpenBSD/7.9/arm64/miniroot79.img

warm-system-aarch64 -m 1G -cpu cortex-a76 -bios u-boot.bin -drive file=miniroot79.img,if=virtio,format=raw -nographic
Welcome to the OpenBSD/arm64 7.9 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?

To install, create an empty disk and add it as a second drive:

warm-img create -f raw openbsd.img 8G
warm-system-aarch64 -m 1G -cpu cortex-a76 -bios u-boot.bin \
  -drive file=miniroot79.img,if=virtio,format=raw \
  -drive file=openbsd.img,if=virtio,format=raw -nographic

Notes

  • Both systems see QEMU's Cortex-A76 model and virt board, described by a device tree.
  • The images are opened in place, so anything the guest writes goes to the file. Add -snapshot to leave an image unchanged.

See also