Tizen 模拟器与 WLS2 不兼容

问题描述

我发现在 win10 上运行 tizen 模拟器所需的设置与 WSL2 不兼容。特别是 hypervisorlaunchtype 必须设置为关闭才能工作,这会阻止 WSL2 启动。我创建了两个脚本来在需要时打开和关闭它,它们在答案中,但它们唯一要做的就是提升自己并运行 bcdedit /set hypervisorlaunchtype (auto/off)。如果有人设法让两人一起玩得很好,请告诉我们如何。希望这会在未来对某人有所帮助。

解决方法

关闭虚拟机管理程序的脚本(tizen 模拟器工作):

If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
  # Relaunch as an elevated process:
  Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
  exit
}
# Now running elevated so launch the script:
& bcdedit /set hypervisorlaunchtype off

打开管理程序的脚本(WSL2 有效):

If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
  # Relaunch as an elevated process:
  Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
  exit
}
# Now running elevated so launch the script:
& bcdedit /set hypervisorlaunchtype auto