From a8ad0d120d2b0d0e827acc122ea072617cf50a77 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 14 Aug 2020 11:45:31 +0100 Subject: [PATCH] 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" --- Meta/run.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Meta/run.sh b/Meta/run.sh index 30a2d14feed..90ddf3804c5 100755 --- a/Meta/run.sh +++ b/Meta/run.sh @@ -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