Skip to content

Commit be0644c

Browse files
foxletmgalgs
andcommitted
[CONF] New headless mode.
Co-authored-by: Mitchel Humpherys <mitch@directangular.com>
1 parent 0f99ccb commit be0644c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

headless.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
OSK="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
4+
VMDIR=$PWD
5+
OVMF=$VMDIR/firmware
6+
7+
[[ -z "$MEM" ]] && {
8+
MEM="1G"
9+
}
10+
11+
[[ -z "$CPUS" ]] && {
12+
CPUS=1
13+
}
14+
15+
[[ -z "$SYSTEM_DISK" ]] && {
16+
echo "Please set the SYSTEM_DISK environment variable"
17+
exit 1
18+
}
19+
20+
[[ -r "$SYSTEM_DISK" ]] || {
21+
echo "Can't read system disk image: $SYSTEM_DISK"
22+
exit 1
23+
}
24+
25+
MOREARGS=()
26+
27+
[[ "$HEADLESS" = "1" ]] && {
28+
MOREARGS+=(-nographic -vnc :0 -k en-us)
29+
}
30+
31+
qemu-system-x86_64 \
32+
-enable-kvm \
33+
-m $MEM \
34+
-machine q35,accel=kvm \
35+
-smp $CPUS \
36+
-cpu Penryn,vendor=GenuineIntel,kvm=on,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc \
37+
-device isa-applesmc,osk="$OSK" \
38+
-smbios type=2 \
39+
-drive if=pflash,format=raw,readonly,file=$OVMF/OVMF_CODE.fd \
40+
-drive if=pflash,format=raw,file=$OVMF/OVMF_VARS-1024x768.fd \
41+
-vga qxl \
42+
-usb -device usb-kbd -device usb-tablet \
43+
-netdev user,id=net0 \
44+
-device e1000-82545em,netdev=net0,id=net0,mac=52:54:00:0e:0d:20 \
45+
-device ich9-ahci,id=sata \
46+
-drive id=ESP,if=none,format=qcow2,file=ESP.qcow2 \
47+
-device ide-hd,bus=sata.2,drive=ESP \
48+
-drive id=InstallMedia,format=raw,if=none,file=BaseSystem.img \
49+
-device ide-hd,bus=sata.3,drive=InstallMedia \
50+
-drive id=SystemDisk,if=none,file="${SYSTEM_DISK}" \
51+
-device ide-hd,bus=sata.4,drive=SystemDisk \
52+
${MOREARGS[@]}

0 commit comments

Comments
 (0)