Unverified Commit 16c58ab1 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Detect number of physical CPU sockets (#526)

parent 9acd65ad
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3,11 +3,11 @@ set -Eeuo pipefail

# Docker environment variables
: "${TPM:="N"}"         # Disable TPM
: "${SMM:="N"}"         # Disable SMM
: "${BOOT_MODE:="legacy"}"  # Boot mode

BOOT_DESC=""
BOOT_OPTS=""
SECURE=",smm=off"

if [[ "${BOOT_MODE,,}" == "windows"* ]]; then

@@ -17,6 +17,9 @@ if [[ "${BOOT_MODE,,}" == "windows"* ]]; then

fi

SECURE="off"
[[ "$SMM" == [Yy1]* ]] && SECURE="on"

case "${BOOT_MODE,,}" in
  uefi)
    BOOT_DESC=" with UEFI"
@@ -24,7 +27,7 @@ case "${BOOT_MODE,,}" in
    VARS="OVMF_VARS_4M.fd"
    ;;
  secure)
    SECURE=",smm=on"
    SECURE="on"
    BOOT_DESC=" securely"
    ROM="OVMF_CODE_4M.secboot.fd"
    VARS="OVMF_VARS_4M.secboot.fd"
@@ -35,7 +38,7 @@ case "${BOOT_MODE,,}" in
    ;;
  windows_secure)
    TPM="Y"
    SECURE=",smm=on"
    SECURE="on"
    BOOT_DESC=" securely"
    ROM="OVMF_CODE_4M.ms.fd"
    VARS="OVMF_VARS_4M.ms.fd"
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ USB_OPTS="-device $USB -device usb-tablet"
RAM_OPTS=$(echo "-m ${RAM_SIZE^^}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
CPU_OPTS="-cpu $CPU_FLAGS -smp $CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"
MON_OPTS="-monitor $MONITOR -name $PROCESS,process=$PROCESS,debug-threads=on"
MAC_OPTS="-machine type=${MACHINE}${SECURE},graphics=off,vmport=off,dump-guest-core=off,hpet=off${KVM_OPTS}"
MAC_OPTS="-machine type=${MACHINE},smm=${SECURE},graphics=off,vmport=off,dump-guest-core=off,hpet=off${KVM_OPTS}"
DEV_OPTS="-object rng-random,id=objrng0,filename=/dev/urandom"
DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
[[ "${BOOT_MODE,,}" != "windows"* ]] && DEV_OPTS="$DEV_OPTS -device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
+2 −1
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ HOST=$(hostname -s)
KERNEL=$(echo "$SYS" | cut -b 1)
MINOR=$(echo "$SYS" | cut -d '.' -f2)
ARCH=$(dpkg --print-architecture)
CPU=$(lscpu | grep -m 1 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/  */ /g')
SOCKETS=$(lscpu | grep -m 1 -i 'socket(s)' | awk '{print $(2)}')
CPU=$(lscpu | grep -m 1 -i 'model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | sed 's# @.*##g' | sed s/"(R)"//g | sed 's/[^[:alnum:] ]\+/ /g' | sed 's/  */ /g')

# Check system