如何在 ARM64 系统上原生构建适用于 ARM64 的 Windows 11 设备驱动程序?

Thi*_*ard 5 wdk device-driver windows-arm64

如何在 ARM64 系统上原生构建适用于 ARM64 的 Windows 11 设备驱动程序?

使用:

  • ARM64 虚拟机上的 Windows 11 21H2(主机:MacBook M1)
  • 视觉工作室17.5.2
  • Windows 驱动程序工具包 10.0.22621.382

我有一个适用于 Windows 11 的简单 WDM 驱动程序。

  • 它在 Windows 11 x64 计算机上原生构建并适用于 x64。
  • 它在 Windows 11 x64 上针对目标 ARM64 进行交叉编译。当在 ARM64 机器上移动生成的二进制文件时,它可以工作。
  • 但是,在 ARM64 系统上本地构建驱动程序会失败。

在 ARM64 上构建相关的用户态应用程序。只有驱动程序无法构建。

构建错误消息是

1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(442,5):
error MSB8020: The build tools for WindowsKernelModeDriver10.0 (Platform Toolset = 'WindowsKernelModeDriver10.0') cannot be found.
To build using the WindowsKernelModeDriver10.0 build tools, please install WindowsKernelModeDriver10.0 build tools.
Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution,
and then selecting "Retarget solution".
Run Code Online (Sandbox Code Playgroud)

看来WDK没有正确安装在ARM64机器上。

此处描述了为 ARM64 构建 Windows 驱动程序:

然而,本文从未明确提及安装在哪种类型的系统上,x64还是ARM64,VS和WDK。事实上,在 x64 机器上执行此操作并针对 ARM64 进行交叉构建是可行的。

在 ARM64 上,安装 WDK 会在安装结束时开始与 VS 集成。错误消息是“此扩展无法安装在任何当前安装的产品上”。使用“C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\10.0.22621.0\WDK.vsix”手动重新启动此安装会产生相同的结果。

安装日志包含以下内容:

3/20/2023 5:51:24 PM - Extension Details...
3/20/2023 5:51:24 PM -  Identifier         : Microsoft.Windows.DriverKit
3/20/2023 5:51:24 PM -  Name               : Windows Driver Kit
3/20/2023 5:51:24 PM -  Author             : Microsoft Corporation
3/20/2023 5:51:24 PM -  Version            : 10.0.22621.0
3/20/2023 5:51:24 PM -  Description        : A set of extensions that integrates Windows Driver development into Visual Studio.
3/20/2023 5:51:24 PM -  Locale             : en-US
3/20/2023 5:51:24 PM -  MoreInfoURL        : 
3/20/2023 5:51:24 PM -  InstalledByMSI     : False
3/20/2023 5:51:24 PM -  SupportedFrameworkVersionRange : [4.7,)
3/20/2023 5:51:25 PM -  SignatureState     : ValidSignature
3/20/2023 5:51:25 PM -  SignedBy           : Microsoft Corporation
3/20/2023 5:51:25 PM -  Certificate Info   : 
3/20/2023 5:51:25 PM -      -------------------------------------------------------
3/20/2023 5:51:25 PM -      [Subject]       : CN=Microsoft Corporation, OU=OPC, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
3/20/2023 5:51:25 PM -      [Issuer]        : CN=Microsoft Code Signing PCA 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
3/20/2023 5:51:25 PM -      [Serial Number] : 3300000464961666FD3445B10C000000000464
3/20/2023 5:51:25 PM -      [Not Before]    : 9/2/2021 11:26:31 AM
3/20/2023 5:51:25 PM -      [Not After]     : 9/1/2022 11:26:31 AM
3/20/2023 5:51:25 PM -      [Thumbprint]    : 4E6167417BC954B1F6BEB22EFE58F0C2824800AD
3/20/2023 5:51:25 PM -  Supported Products : 
3/20/2023 5:51:25 PM -      Microsoft.VisualStudio.Community
3/20/2023 5:51:25 PM -          Version : [17.0,18.0)
3/20/2023 5:51:25 PM -          ProductArchitecture : amd64
3/20/2023 5:51:25 PM -      Microsoft.VisualStudio.Pro
3/20/2023 5:51:25 PM -          Version : [17.0,18.0)
3/20/2023 5:51:25 PM -          ProductArchitecture : amd64
3/20/2023 5:51:25 PM -      Microsoft.VisualStudio.Enterprise
3/20/2023 5:51:25 PM -          Version : [17.0,18.0)
3/20/2023 5:51:25 PM -          ProductArchitecture : amd64
Run Code Online (Sandbox Code Playgroud)

支持的产品仅包括针对 amd64 的 VS,不包括针对 ARM64 的 VS。

但是,我找不到安装在 Windows 11 for ARM64 上的 WDK 的链接。有什么解决办法吗?

小智 -1

使用EWDK。您应该能够毫无问题地构建驱动程序,因为它具有所有依赖性。

Msbuild -p:配置=发布/调试; 平台=ARM64