Skip to content

Commit

Permalink
feat: Fix time synchronization on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored May 7, 2024
1 parent f8f125a commit 6b18312
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ BOOT_DESC=""
BOOT_OPTS=""
SECURE=",smm=off"

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

BOOT_OPTS="-rtc base=localtime"
BOOT_OPTS="$BOOT_OPTS -global ICH9-LPC.disable_s3=1"
BOOT_OPTS="$BOOT_OPTS -global ICH9-LPC.disable_s4=1"

if [ -e /sys/module/kvm/parameters/ignore_msrs ]; then
if [ "$(cat /sys/module/kvm/parameters/ignore_msrs)" == "N" ]; then
echo 1 | tee /sys/module/kvm/parameters/ignore_msrs > /dev/null 2>&1 || true
fi
fi

fi

case "${BOOT_MODE,,}" in
uefi)
BOOT_DESC=" with UEFI"
Expand All @@ -24,20 +38,17 @@ case "${BOOT_MODE,,}" in
windows | windows_plain)
ROM="OVMF_CODE_4M.fd"
VARS="OVMF_VARS_4M.fd"
BOOT_OPTS="-global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1"
;;
windows_secure)
TPM="Y"
SECURE=",smm=on"
BOOT_DESC=" securely"
ROM="OVMF_CODE_4M.ms.fd"
VARS="OVMF_VARS_4M.ms.fd"
BOOT_OPTS="-global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1"
;;
windows_legacy)
BOOT_DESC=" (legacy)"
USB="usb-ehci,id=ehci"
BOOT_OPTS="-global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1"
;;
legacy)
BOOT_OPTS=""
Expand Down Expand Up @@ -104,12 +115,4 @@ if [[ "$TPM" == [Yy1]* ]]; then

fi

if [[ "${BOOT_MODE,,}" == "windows"* ]]; then
if [ -e /sys/module/kvm/parameters/ignore_msrs ]; then
if [ "$(cat /sys/module/kvm/parameters/ignore_msrs)" == "N" ]; then
echo 1 | tee /sys/module/kvm/parameters/ignore_msrs > /dev/null 2>&1 || true
fi
fi
fi

return 0

0 comments on commit 6b18312

Please sign in to comment.