# qemu-args.sh -- the demo machine, sourced by make-snapshot.sh and start-session.sh. # # A session resumes a machine saved by make-snapshot.sh, and QEMU can resume a saved machine only # into the same machine: the same board, CPU, memory, firmware and devices. Both scripts build the # command line here, so they cannot drift apart. It is the machine `make -f kernel/Makefile # ARCH=amd64 qemu` boots (q35, TCG, 1 GiB, OVMF, the ISO as a CD), less what a visitor must not # have: no network device, no Artemis disk, no display, and QEMU's seccomp sandbox on. # # demo_qemu_args -> fills the array QEMU_ARGS # # /StarshipOS.iso is the image; /identity.img, if there, is the identity # drive every session gets (issue #111), attached with its writes discarded. OVMF_CODE=${OVMF_CODE:-/usr/share/OVMF/OVMF_CODE_4M.fd} demo_qemu_args() { local dir=$1 vars=$2 QEMU_ARGS=( -machine q35,accel=tcg -cpu qemu64,+rdrand -m 1024 -smp 1 -drive "if=pflash,format=raw,readonly=on,file=$OVMF_CODE" -drive "if=pflash,format=raw,file=$vars" -drive "if=none,id=cd,media=cdrom,readonly=on,file=$dir/StarshipOS.iso" -device ide-cd,drive=cd,bootindex=0 -device qemu-xhci,id=xhci0,p2=16,p3=16 # kernel/Makefile XHCI_PORTS -nic none -display none -no-reboot -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny ) if [ -f "$dir/identity.img" ]; then QEMU_ARGS+=(-drive "if=none,id=ident,format=raw,snapshot=on,file=$dir/identity.img" -device usb-storage,bus=xhci0.0,port=1,drive=ident) fi }