Skip to content

Commit

Permalink
Meta: allow override of QEMU -cpu argument via environment variable
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
peterdn authored and awesomekling committed Aug 14, 2020
1 parent d9a1cb4 commit a8ad0d1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Meta/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit a8ad0d1

Please sign in to comment.