- 适用于 Hyper-V 虚拟机内 Linux 的 GPU-PV 部署。
无论是否勾选“安装 OpenGL/Vulkan 图形驱动”,都会执行:
install_dxgkrnl.sh(编译/安装 dxgkrnl)configure_system.sh(部署/usr/lib/wsl、配置延迟加载服务等)
勾选“安装 OpenGL/Vulkan 图形驱动”时,额外执行:
setup_graphics.shconfigure_system.sh enable_graphics
未勾选时执行:
configure_system.sh no_graphics
说明:
setup_graphics.sh只在勾选图形驱动时运行。configure_system.sh始终运行,但图形相关配置(如 Arch 下 Xorgkmsdev修复、GALLIUM_DRIVER、LIBVA_DRIVER_NAME)仅在enable_graphics分支处理。
Arch 滚动内核可能出现兼容性波动。建议优先使用 LTS66 方案。
已编译可复用版本:
管理员 PowerShell:
$VMName = "你的虚拟机名称"
Set-VM -GuestControlledCacheTypes $true -VMName $VMName
Set-VM -HighMemoryMappedIoSpace 64GB -VMName $VMName
Set-VM -LowMemoryMappedIoSpace 1GB -VMName $VMName
# Windows 11 / Server 2022+
$GpuPath = (Get-VMHostPartitionableGpu | Select-Object -First 1 -ExpandProperty Name)
Add-VMGpuPartitionAdapter -VMName $VMName -InstancePath $GpuPath
# Windows 10 / Server 2019(可改用)
# Add-VMGpuPartitionAdapter -VMName $VMNamemkdir -p ~/exhyperv_deploy
cd ~/exhyperv_deploy
curl -fL -o install_dxgkrnl.sh https://raw.githubusercontent.com/Justsenger/ExHyperV/main/src/Linux/script/install_dxgkrnl.sh
curl -fL -o setup_graphics.sh https://raw.githubusercontent.com/Justsenger/ExHyperV/main/src/Linux/script/setup_graphics.sh
curl -fL -o configure_system.sh https://raw.githubusercontent.com/Justsenger/ExHyperV/main/src/Linux/script/configure_system.sh
chmod +x *.sh将宿主机 DriverStore/FileRepository 对应显卡目录复制到:
~/exhyperv_deploy/drivers/sudo ./install_dxgkrnl.sh若输出 STATUS: REBOOT_REQUIRED,先重启,再执行一次 install_dxgkrnl.sh。
仅当你需要 OpenGL/Vulkan 时:
sudo ./setup_graphics.sh
sudo ./configure_system.sh enable_graphics若不需要 OpenGL/Vulkan:
sudo ./configure_system.sh no_graphics最后重启:
sudo rebootsetup_graphics.sh 在 Arch 分支会做:
- 安装
mesa mesa-utils vulkan-tools vulkan-icd-loader libva-utils libva-mesa-driver - 优先安装
vulkan-dzn,否则尝试vulkan-swrast - 检测 DZN ICD(包括
dzn_icd.json)并写入VK_ICD_FILENAMES
基础验证:
lsmod | grep dxgkrnl
ls -l /dev/dxg
systemctl status load-dxg-late.service --no-pagerVulkan 验证:
vulkaninfo --summary | grep -E "driverName|deviceName|driverID"常见成功特征:
driverName = DozendeviceName = Microsoft Direct3D12 (...)
优先检查 /dev/dxg 和 load-dxg-late.service 状态。
缺少 /dev/dxg 说明 dxg 通道未就绪。
通常是 Xorg kmsdev 选错。
当前脚本在 Arch + enable_graphics 且存在 /dev/dri/card1 时,会写入:
/etc/X11/xorg.conf.d/20-exhyperv-modesetting.conf
通常是 ICD 选错(只命中 nvidia_icd.json)。检查:
ls /usr/share/vulkan/icd.d
echo "$VK_ICD_FILENAMES"这是无图形会话下 DISPLAY 未设置导致的正常现象,不代表 Vulkan/D3D12 路径失效。