diff --git a/README.md b/README.md index b6d14fc..d0eb4fc 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,17 @@ You can pass `qemu` flags (see `QEMU(1)`) to `./run.sh` directly or you can make theses flags permanent by editing `run.sh` (this VM only) or `lib.sh` (all VMs). +### Headless + +For a headless VM, just remove the `-vga` and `-audio` flags from `lib.sh`.
+To start the VM in the background: `./run.sh & disown` + ### CPU/RAM limit The CPU flag is not set by default, see `QEMU(1)` for default values.
Default RAM flag: `-m "2G,maxmem=$((HOST_RAM - 2))G"`. ``` -./run.sh -smp "$NB_CPUS,maxcpus=$MAX_CPUS" \ +./run.sh -smp "${NB_CPUS},maxcpus=${MAX_CPUS}" \ -m "${RAM}G,maxmem=${MAX_RAM}G" ``` diff --git a/lib.sh b/lib.sh index 99f0554..d76a796 100644 --- a/lib.sh +++ b/lib.sh @@ -55,21 +55,21 @@ function _getnet() { } function qemu() { + local ram=2G local maxram; maxram="$(_getmaxram)" local net; net="$(_getnet)" (set -x qemu-system-x86_64 -accel kvm \ -M q35 \ - -bios /usr/share/ovmf/x64/OVMF.fd \ -cpu host \ - -m "2G,maxmem=$maxram" \ + -m "$ram,maxmem=$maxram" \ -vga virtio \ - -drive if=virtio,file=hda.qcow2 \ -audio pipewire,model=hda \ + -drive if=virtio,file=hda.qcow2 \ -nic "model=virtio-net-pci,type=$net" \ -device qemu-xhci \ - -object memory-backend-ram,id=mem,size=2G,share=on \ + -object "memory-backend-ram,id=mem,size=$ram,share=on" \ -numa node,memdev=mem \ "${OPTS[@]}" \ "$@"