docs: CHANGELOG in English, README without the mirror link; Haiku VM tooling
- CHANGELOG.md translated to English (GitHub release notes of v0.1.0 and v0.2.0 updated accordingly) - tools/haiku-vm.sh: Haiku R1/beta6 x86_64 VM under QEMU/KVM (verified image, 20 GB disk, virtual USB stick, SSH port forward, QMP socket) - tools/qmp.py: headless control through QMP (PNG screenshots, absolute clicks, typing, key combos, power-off) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
1 parent
32412fe6be
commit
1c1ccd631a
4 files changed
+285
-31
No files matched your search
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: MIT
|
||||
# Haiku R1/beta6 x86_64 development VM under QEMU (Linux / WSL2, KVM when available).
|
||||
#
|
||||
# tools/haiku-vm.sh fetch download + verify the official anyboot image
|
||||
# tools/haiku-vm.sh install boot the image with an empty 20 GB disk (run the Installer, see docs)
|
||||
# tools/haiku-vm.sh start boot the installed system (headless, VNC on 127.0.0.1:5901)
|
||||
# tools/haiku-vm.sh stop ACPI power-off (hard kill after 60 s)
|
||||
# tools/haiku-vm.sh ssh [cmd] ssh into the VM (port 2222, user "user")
|
||||
# tools/haiku-vm.sh status
|
||||
#
|
||||
# A 16 GB sparse raw image is attached as a USB mass-storage device ("the stick"), so the
|
||||
# Haiku USB backend can be tested end to end; inspect it from Linux with mtools.
|
||||
# The VM is driven with tools/qmp.py (screenshots, clicks, typing) through $VM_DIR/qmp.sock.
|
||||
set -eu
|
||||
|
||||
VM_DIR=${OPENPU_VM_DIR:-$HOME/openpu-vm}
|
||||
RELEASE=r1beta6
|
||||
ISO=$VM_DIR/haiku-$RELEASE-x86_64-anyboot.iso
|
||||
ISO_SHA256=bb7743474fd175aea511be1799764ba054465285bbdf54c4722ca61d1fb4f5c9
|
||||
ISO_URL=https://mirrors.rit.edu/haiku/$RELEASE/haiku-$RELEASE-x86_64-anyboot.iso
|
||||
DISK=$VM_DIR/haiku.qcow2
|
||||
STICK=$VM_DIR/haiku-usb.img
|
||||
QMP=$VM_DIR/qmp.sock
|
||||
PIDFILE=$VM_DIR/qemu.pid
|
||||
SSH_PORT=${OPENPU_VM_SSH_PORT:-2222}
|
||||
|
||||
mkdir -p "$VM_DIR"
|
||||
|
||||
running() { [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; }
|
||||
|
||||
qemu() {
|
||||
accel="-accel tcg"
|
||||
[ -w /dev/kvm ] && accel="-accel kvm -cpu host"
|
||||
[ -f "$STICK" ] || truncate -s 16G "$STICK"
|
||||
# shellcheck disable=SC2086
|
||||
qemu-system-x86_64 $accel -machine q35 -smp 4 -m 4096 \
|
||||
-drive file="$DISK",format=qcow2,if=none,id=hd0 -device ide-hd,drive=hd0,bus=ide.0 \
|
||||
-nic user,model=e1000,hostfwd=tcp:127.0.0.1:"$SSH_PORT"-:22 \
|
||||
-device qemu-xhci,id=xhci -device usb-tablet,bus=xhci.0 \
|
||||
-drive file="$STICK",format=raw,if=none,id=stick \
|
||||
-device usb-storage,bus=xhci.0,drive=stick,removable=on \
|
||||
-display none -vnc 127.0.0.1:1 \
|
||||
-qmp unix:"$QMP",server=on,wait=off \
|
||||
-daemonize -pidfile "$PIDFILE" "$@"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
fetch)
|
||||
[ -f "$ISO" ] || curl -fL -o "$ISO.part" "$ISO_URL" && { [ -f "$ISO" ] || mv "$ISO.part" "$ISO"; }
|
||||
echo "$ISO_SHA256 $ISO" | sha256sum -c -
|
||||
;;
|
||||
install)
|
||||
running && { echo "VM already running" >&2; exit 1; }
|
||||
[ -f "$DISK" ] || qemu-img create -f qcow2 "$DISK" 20G
|
||||
qemu -drive file="$ISO",media=cdrom,if=none,id=cd -device ide-cd,drive=cd,bus=ide.1 -boot d
|
||||
echo "installer booted (VNC 127.0.0.1:5901, QMP $QMP)"
|
||||
;;
|
||||
start)
|
||||
running && { echo "VM already running"; exit 0; }
|
||||
qemu -boot c
|
||||
echo "VM started (VNC 127.0.0.1:5901, ssh -p $SSH_PORT user@127.0.0.1)"
|
||||
;;
|
||||
stop)
|
||||
running || { echo "VM not running"; exit 0; }
|
||||
python3 "$(dirname "$0")/qmp.py" --socket "$QMP" powerdown || true
|
||||
for _ in $(seq 60); do running || { echo "stopped"; exit 0; }; sleep 1; done
|
||||
kill "$(cat "$PIDFILE")"; echo "killed"
|
||||
;;
|
||||
ssh)
|
||||
shift
|
||||
exec ssh -p "$SSH_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR \
|
||||
user@127.0.0.1 "$@"
|
||||
;;
|
||||
status)
|
||||
running && echo "running (pid $(cat "$PIDFILE"))" || echo "stopped"
|
||||
;;
|
||||
*)
|
||||
sed -n '3,12p' "$0" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user