Meta: allow override of QEMU -cpu argument via environment variable

Introduces a SERENITY_QEMU_CPU environment variable that allows
overriding of the qemu -cpu command line parameter. If not specified,
the argument defaults to "max".

The primary motivation behind this is to be able to enable or disable
specific features for the vCPU in order to workaround QEMU issues with
certain hardware accelerators. For example, QEMU on Windows with WPHX
sometimes fails to start unless Virtual Machine eXtensions are
disabled. This can now be done with:

  export SERENITY_QEMU_CPU="max,vmx=off"
This commit is contained in:
Peter Nelson 2020-08-14 11:45:31 +01:00 committed by Andreas Kling
parent d9a1cb440c
commit a8ad0d120d
Notes: sideshowbarker 2024-07-19 03:39:09 +09:00

View file

@ -20,6 +20,8 @@ die() {
[ -z "$SERENITY_RAM_SIZE" ] && SERENITY_RAM_SIZE=256M
[ -z "$SERENITY_QEMU_CPU" ] && SERENITY_QEMU_CPU="max"
[ -z "$SERENITY_DISK_IMAGE" ] && {
if [ "$1" = qgrub ]; then
SERENITY_DISK_IMAGE="grub_disk_image"
@ -31,7 +33,7 @@ die() {
[ -z "$SERENITY_COMMON_QEMU_ARGS" ] && SERENITY_COMMON_QEMU_ARGS="
$SERENITY_EXTRA_QEMU_ARGS
-s -m $SERENITY_RAM_SIZE
-cpu max
-cpu $SERENITY_QEMU_CPU
-d guest_errors
-smp 2
-device VGA,vgamem_mb=64
@ -45,7 +47,7 @@ $SERENITY_EXTRA_QEMU_ARGS
[ -z "$SERENITY_COMMON_QEMU_Q35_ARGS" ] && SERENITY_COMMON_QEMU_Q35_ARGS="
$SERENITY_EXTRA_QEMU_ARGS
-s -m $SERENITY_RAM_SIZE
-cpu max
-cpu $SERENITY_QEMU_CPU
-machine q35
-d guest_errors
-smp 2