feat: Headless docs + remove uefi

This commit is contained in:
ange 2024-03-10 23:09:51 +01:00
parent ce1f1f0c33
commit 4eee1c4119
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
2 changed files with 10 additions and 5 deletions

View File

@ -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`.<br>
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.<br>
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"
```

8
lib.sh
View File

@ -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[@]}" \
"$@"