How to natively build Windows 11 device drivers for ARM64 on an ARM64 system?

1k Views Asked by At

How to natively build Windows 11 device drivers for ARM64 on an ARM64 system?

Using:

  • Windows 11 21H2 on an ARM64 virtual machine (host: MacBook M1)
  • Visual Studio 17.5.2
  • Windows Driver Kit 10.0.22621.382

I have a simple WDM driver for Windows 11.

  • It natively builds and works for x64, on a Windows 11 x64 machine.
  • It cross-compiles on Windows 11 x64 for target ARM64. When moving the generated binaries on an ARM64 machine, it works.
  • However, natively building the driver on an ARM64 system fails.

Building the associated userland applications works on ARM64. Only the driver fails to build.

The build error message is

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".

It seems that the WDK is not properly installed on the ARM64 machine.

Building Windows drivers for ARM64 is described here:

However, this article never clearly mentions on which type of system, x64 or ARM64, VS and the WDK are installed. As a matter of fact, doing this on a x64 machine and cross-building for ARM64 works.

On ARM64, installing the WDK works up to point where the integration with VS is started, at the end of the installation. The error message is "This extension is not installable on any currently installed products". Manually restarting this installation using "C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\10.0.22621.0\WDK.vsix" gives the same result.

The install log contains this:

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

The supported products only include VS for amd64, not for ARM64.

However, I cannot find a link to a WDK which installs on Windows 11 for ARM64. Any solution?

1

There are 1 best solutions below

1
On

Use EWDK . You should be able to build your driver without issue since it has all dependency.

Msbuild -p:Configuration=Release/Debug; Platform=ARM64