Re: FreeBSD main on Apple M2 Ultra, likely via use of VM(s): any notes?

From: Alex Samorukov <samm_at_freebsd.org>
Date: Mon, 28 Aug 2023 05:13:15 UTC
On 2023/08/28 06:56, Mark Millard wrote:
> Is anyone using FreeBSD [main] on an Apple M2 Ultra (likely that would
> be via a VM)? If yes, is anyone willing to comment on the VM used to
> host FreeBSD, how it is used with FreeBSD, what works vs. not, or the
> like?
> 
I am using M1, don't think that difference will be significant. FreeBSD 
works very well on UTM, which is nothing but a wrapper for QEMU. You can 
also run it directly in QEMU, e.g. like this:

qemu-system-aarch64 \
   -M virt \
   -drive 
file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,format=raw,if=pflash,readonly=on 
\
   -smp 4 \
   -accel hvf \
   -cpu host \
   -m 1G \
   -drive 
file=FreeBSD-13.1-RELEASE-arm64-aarch64.qcow2,if=virtio,cache=writethrough,format=qcow2 
\
   -net user,hostfwd=tcp::10022-:22 \
   -net nic -device ramfb -device nec-usb-xhci,id=xhci -device usb-kbd \
   -nographic -serial mon:studio

USB emulation works as expected, at least I was able to pass usb-com 
device. About loading from external media - I think it may work, 
however, I never tested and I see very little sense in doing that.

One of the fun findings - you can't run FreeBSD/Armv[67] chroot on such 
FreeBSD as the host CPU does not have 32-bit commands, so it is not 
possible to use such a host for building armv7 packages natively.

> A point of interest would be if the VM environment can boot normal
> external USB3 media that is also able to be used to boot FreeBSD on
> other aarch64 systems (not just booting via VM usage).