omarchy-utm-make runs builder/build-utm.sh in a privileged linux/arm64 container: a 32G sparse GPT disk with the ISO's Btrfs subvolume layout, Arch Linux ARM plus the aarch64 Omarchy packages, Limine on the UEFI fallback path, omarchy-apply-system --defer-provisioning in the chroot, first-boot provisioning staged with the arm64 Node tarball, one limine-update, then a sealed and checked disk converted to compressed qcow2. The host wraps it as a .utm bundle (no serial device: iOS has no Ptty mode), zips it, and writes a sha256. omarchy-utm-boot boots the result under qemu's interpreter, the closest stand-in for UTM SE. fstab is written from the partition UUIDs directly: genfstab named the hand-made loop device nodes, which sent the first boot into emergency mode. Claude-Session: https://claude.ai/code/session_019krxFwnSbEM2n2QNQ1rG1K
54 lines
1.7 KiB
Bash
Executable File
54 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
usage() {
|
|
echo "Usage: $0 <omarchy-utm-se.qcow2|Omarchy.utm> [--hvf]" >&2
|
|
echo "Boots the appliance disk under qemu-system-aarch64 with the devices the UTM bundle declares." >&2
|
|
echo "TCG emulation is the default, the closest stand-in for UTM SE; --hvf uses Apple's hypervisor instead." >&2
|
|
exit 1
|
|
}
|
|
|
|
(( $# >= 1 )) || usage
|
|
disk="$1"
|
|
shift
|
|
accel=tcg
|
|
cpu=cortex-a72
|
|
if (( $# > 0 )); then
|
|
[[ $1 == "--hvf" ]] || usage
|
|
accel=hvf
|
|
cpu=host
|
|
fi
|
|
if [[ -d $disk ]]; then
|
|
disk=$(ls "$disk"/Data/*.qcow2 | head -n1)
|
|
fi
|
|
[[ -f $disk ]] || { echo "Error: $disk is not a disk image" >&2; exit 1; }
|
|
|
|
firmware=""
|
|
for candidate in "$(brew --prefix 2>/dev/null)/share/qemu" /usr/share/qemu /usr/share/edk2/aarch64; do
|
|
if [[ -f $candidate/edk2-aarch64-code.fd ]]; then
|
|
firmware="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
[[ -n $firmware ]] || { echo "Error: no edk2-aarch64-code.fd found; install qemu" >&2; exit 1; }
|
|
|
|
run_dir="${TMPDIR:-/tmp}/omarchy-utm-boot"
|
|
mkdir -p "$run_dir"
|
|
vars="$run_dir/efi_vars.fd"
|
|
[[ -f $vars ]] || cp "$firmware/edk2-arm-vars.fd" "$vars"
|
|
echo "QMP socket: $run_dir/qmp.sock serial log: $run_dir/serial.log ssh: localhost:2222"
|
|
|
|
exec qemu-system-aarch64 \
|
|
-machine virt -cpu "$cpu" -accel "$accel" -smp 2 -m 2048 \
|
|
-drive if=pflash,format=raw,readonly=on,file="$firmware/edk2-aarch64-code.fd" \
|
|
-drive if=pflash,format=raw,file="$vars" \
|
|
-drive file="$disk",format=qcow2,if=none,id=drive0 \
|
|
-device virtio-blk-pci,drive=drive0 \
|
|
-device virtio-gpu-pci -device virtio-keyboard-pci -device virtio-mouse-pci \
|
|
-netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-:22 -device virtio-net-pci,netdev=net0 \
|
|
-device virtio-rng-pci \
|
|
-serial file:"$run_dir/serial.log" \
|
|
-qmp unix:"$run_dir/qmp.sock",server,nowait \
|
|
-display default
|