fix: Custom CPU model (#13)

This commit is contained in:
Kroese 2024-02-05 08:15:38 +01:00 committed by GitHub
parent 644cca0786
commit c1a7398356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,8 +5,8 @@ set -Eeuo pipefail
: "${KVM:="Y"}"
: "${CPU_FLAGS:=""}"
: "${CPU_MODEL:=""}"
: "${DEF_MODEL:="cortex-a53"}"
: "${CPU_MODEL:="$DEF_MODEL"}"
[[ "$ARCH" != "arm"* ]] && KVM="N"
@ -24,7 +24,7 @@ if [[ "$KVM" != [Nn]* ]]; then
if [ -n "$KVM_ERR" ]; then
KVM="N"
error "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance."
error "KVM acceleration not available $KVM_ERR, this will cause a major loss of performance."
error "See the FAQ on how to enable it, or continue without KVM by setting KVM=N (not recommended)."
[[ "$DEBUG" != [Yy1]* ]] && exit 88
fi
@ -33,25 +33,30 @@ fi
if [[ "$KVM" != [Nn]* ]]; then
if [[ "$CPU_MODEL" == "$DEF_MODEL" ]]; then
CPU_MODEL="host"
fi
KVM_OPTS=",accel=kvm -enable-kvm"
CPU_FEATURES="kvm=on,migratable=no"
WIN_FEATURES=""
#CPU_FEATURES="kvm=on,l3-cache=on,migratable=no"
CPU_FEATURES="kvm=on"
KVM_OPTS=",accel=kvm -enable-kvm"
#CPU_FEATURES="kvm=on,l3-cache=on"
#WIN_FEATURES="+hypervisor,+invtsc,hv_passthrough"
if [ -z "$CPU_MODEL" ]; then
CPU_MODEL="host"
CPU_FEATURES="$CPU_FEATURES,migratable=no"
fi
else
KVM_OPTS=""
CPU_FEATURES=""
WIN_FEATURES=""
KVM_OPTS=" -accel tcg,thread=multi"
#KVM_OPTS=" -accel tcg,thread=multi"
if [ -z "$CPU_MODEL" ]; then
if [[ "$ARCH" == "arm"* ]]; then
if [[ "$CPU_MODEL" == "$DEF_MODEL" ]]; then
CPU_MODEL="max"
else
CPU_MODEL="$DEF_MODEL"
fi
fi