Skip to content

Commit

Permalink
fix: CPU features
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Dec 25, 2023
1 parent 406d713 commit 8d9dcb4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/cpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
set -Eeuo pipefail

# Docker environment variables

: ${CPU_MODEL:='host'}
: ${CPU_FEATURES:='+ssse3,+sse4.1,+sse4.2'}

KVM_ERR=""
KVM_OPTS=""
Expand All @@ -21,14 +23,20 @@ if [[ "$ARCH" == "amd64" && "$KVM" != [Nn]* ]]; then
error "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance."
error "See the FAQ on how to enable it, or skip this error by setting KVM=N (not recommended)."
[[ "$DEBUG" != [Yy1]* ]] && exit 88
[[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max"
[[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max,$CPU_FEATURES"
else
KVM_OPTS=",accel=kvm -enable-kvm"
fi

else

[[ "$CPU_MODEL" == "host"* ]] && CPU_MODEL="max"
if [[ "$CPU_MODEL" == "host"* ]]; then
if [[ "$ARCH" == "amd64" ]]; then
CPU_MODEL="max,$CPU_FEATURES"
else
CPU_MODEL="qemu64,$CPU_FEATURES"
fi
fi

fi

Expand Down

0 comments on commit 8d9dcb4

Please sign in to comment.