From 2b423e82a420cafd406e32334fffa61ad0ef8555 Mon Sep 17 00:00:00 2001 From: Malte Voos Date: Tue, 13 Oct 2026 12:43:24 +0200 Subject: opportunistic KVM accel --- server.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server.nix b/server.nix index 78f9e29..f4aeb82 100644 --- a/server.nix +++ b/server.nix @@ -134,11 +134,17 @@ writeShellApplication { runtimeInputs = [ qemu ]; text = '' - rm -f ./reMder.qcow2 - qemu-img create -b ${diskImage} -F qcow2 -f qcow2 ./reMder.qcow2 - - qemu-system-arm \ - -machine virt \ + # check if we're on an aarch64 system with support for aarch32 at EL1 + if echo quit | qemu-system-aarch64 -machine virt -accel kvm -cpu host,aarch64=off \ + -display none -nodefaults -S -monitor stdio >/dev/null 2>&1; then + qemu="qemu-system-aarch64" + accel_opts=(-accel kvm -cpu "host,aarch64=off") + else + qemu="qemu-system-arm" + accel_opts=() + fi + + exec "$qemu" -machine virt "''${accel_opts[@]}" \ -m 2048 \ -kernel ${kernel}/zImage \ -snapshot \ -- cgit v1.3.1