THE WRITER MUST EAT -> patreon.com/trn1ty <-

| \    |   | blah!
|\ | `\|\  | the rantings and ravings
|/ |(_|| | * of a depraved lunatic

<^>

2024-06-21

: running openbsd in qemu

$ qemu-system-x86_64 \
	-M pc -cpu qemu64 -m 512M \
	-device rtl8139,netdev=lan \
	-netdev user,id=lan \
	-nographic \
	-drive file="$HOME"/Machines/obsd.qcow2,media=disk,if=virtio \
	-cdrom install75.iso
[blank lines abridged]
SeaBIOS (version 1.14.0-2)
iPXE (http://ipxe.org) 00:02.0 CA00 PCI2.10 PnP PMM+1FF8F200+1FECF200 CA00
Booting from Hard Disk...
Boot failed: not a bootable disk
Booting from DVD/CD...
CD-ROM: E0
Loading /7.5/AMD64/CDBOOT
probing: pc0 com0 mem[639K 510M a20=on] 
disk: hd0+* cd0
&rt;&rt; OpenBSD/amd64 CDBOOT 3.65
boot&rt;
cannot open cd0a:/etc/random.seed: No such file or directory
booting cd0a:/7.5/amd64/bsd.rd: 4076463+1688576+3891240+0+708608 [109+464016+317
541]=0xaa40e8
entry point at 0xffffffff8100100

And then it hangs. What's going on?

<https://www.reddit.com/r/openbsd/comments/l4c1zo
	/openbsd_hangs_after_entry_point_at/>
says perhaps I'm using a 32b processor rather than 64b. The software I'm
writing needs to work on 32b so whatever, let's try the i386 install75.iso.

$ qemu-system-x86_64 \
	-M pc -cpu qemu64 -m 512M \
	-device rtl8139,netdev=lan \
	-netdev user,id=lan \
	-nographic \
	-drive file="$HOME"/Machines/obsd.qcow2,media=disk,if=virtio \
	-cdrom install75\(1\).iso
SeaBIOS (version 1.14.0-2)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+1FF8F470+1FECF470 CA00
Booting from Hard Disk...
Boot failed: not a bootable disk
Booting from Floppy...
Boot failed: could not read the boot disk
Booting from DVD/CD...
CD-ROM: E0
Loading /7.5/I386/CDBOOT
probing: pc0 com0 apm pci mem[639K 510M a20=on] 
disk: fd0 hd0+* cd0
&rt;&rt; OpenBSD/i386 CDBOOT 3.65
boot&rt; 
cannot open cd0a:/etc/random.seed: No such file or directory
booting cd0a:/7.5/i386/bsd.rd: 3279379+1442816+4362248+0+417792 [88+160+28]=0x91
2300
entry point at 0x20100

No dice. I'm gonna try using -hda rather than -drive. No clue the difference.
Works the same. -cpu max instead of qemu64. Works the same. I know this CPU
configuration works because it's the same one from 2024-05-15 that boots
(tested) Windows XP x64. What next to troubleshoot?

$ qemu-system-x86_64 \
	-M pc -cpu max -m 512M \
	-device rtl8139,netdev=lan \
	-netdev user,id=lan \
	-nographic \
	-hda "$HOME"/Machines/obsd.qcow2 
SeaBIOS (version 1.14.0-2)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+1FF8F4C0+1FECF4C0 CA00
Booting from Hard Disk...
Boot failed: not a bootable disk
Booting from Floppy...
Boot failed: could not read the boot disk
Booting from DVD/CD...
CD-ROM: E0
Loading /7.5/AMD64/CDBOOT
probing: pc0 com0 mem[639K 510M a20=on] 
disk: fd0 hd0+* cd0
&rt;&rt; OpenBSD/amd64 CDBOOT 3.65
boot&rt; set tty com0
switching console to com&rt;&rt; OpenBSD/amd64 CDBOOT 3.65
boot&rt; boot
0
cannot open cd0a:/etc/random.seed: No such file or directory
booting cd0a:/7.5/amd64/bsd.rd: 4076463+1688576+3891240+0+708608 [109+464016+317541]=0xaa40e8
entry point at 0xffffffff81001000
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2024 OpenBSD. All rights reserved.  https://www.OpenBSD.org
OpenBSD 7.5 (RAMDISK_CD) #76: Wed Mar 20 15:53:54 MDT 2024
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/RAMDISK_CD

We got it. I just needed to set the tty to the serial port I was monitoring
with QEMU. Now that I understand the theory I'd really like to get arm64
emulation working because I imagine it'd be a little easier on my poor CM4. I
foumd a guide on booting OpenBSD/arm64 on QEMU:
<https://www.nechtan.io/articles/openbsd_arm64_qemu.html>
and stripped the weird shit out of it to see if that works.

$ qemu-system-aarch64 \
	-M virt -cpu cortex-a57 -m 512M \
	-bios "$HOME"/Machines/QEMU_EFI.fd \
	-device rtl8139,netdev=lan 
	-device virtio-rng-device 
	-netdev user,id=lan 
	-nographic 
	-hda "$HOME"/Machines/obsd.qcow2
and it works. Hell yeah.

<^>

No rights reserved, all rights exercised, rights turned to lefts, left in this
corner of the web.