Option A (Visual Studio)
- Visual Studio 2017
- Install at least the following components: Universal Windows Platform development, Desktop development with C++.
- Windows SDK for Windows 10
- Windows Driver Kit (WDK) for Windows 10
Note that the version/build number of Windows SDK must match that of WDK. In particular, the Windows 10 SDK installed by Visual Studio 2017 (version 1709, build 10.0.16299 as of this writing) may not be the latest version. If you want to use the latest WDK (version 1803 as of this writing), you may need to download and install the latest Windows 10 SDK (version 1803, build 10.0.17134 as of this writing).
Option B (EWDK)
- Enterprise WDK (EWDK) 10 with Visual Studio Build Tools 15.6
- Install the downloaded ISO image by mounting it or extracting it to an empty folder.
- NuGet CLI tool (
nuget.exe
) version 4.x or later
Option A (Visual Studio)
- Open
platforms\windows\haxm.sln
in Visual Studio 2017. - Select either
Debug
orRelease
configuration.- The
Debug
configuration also signs the driver with a test certificate. TheRelease
configuration does not do that.
- The
- Select either
x64
orWin32
platform. - Build solution.
Option B (EWDK)
cd X:\path\to\EWDK\
LaunchBuildEnv.cmd
cd X:\path\to\haxm\
cd platforms\windows
X:\path\to\nuget.exe restore
msbuild haxm.sln /p:Configuration="Debug" /p:Platform="x64"
- Use
Release
instead ofDebug
to build an optimized driver that is suitable for release. Note that theRelease
configuration does not sign the driver with a test certificate. - Use
Win32
instead ofx64
to build a 32-bit driver that works on 32-bit Windows. - Add
/t:rebuild
for a clean rebuild instead of an incremental build.
- Use
If successful, the driver binary (IntelHaxm.sys
) will be generated in
X:\path\to\haxm\platforms\windows\build\out\x64\{Debug,Release}\
(or
X:\path\to\haxm\platforms\windows\build\out\Win32\{Debug,Release}\
if
Platform="Win32"
), and will be able to run on Windows 7 and later.
Note that these are requirements for the test environment, which does not have to be the same as the build environment.
- An Intel CPU that supports Intel VT-x with Extended Page Tables (EPT).
- Here is a list of CPUs that meet this requirement. As a rule of thumb, if you have an Intel Core i3, i5, i7 or i9 (any generation), you are good to go.
- EPT is an advanced feature of Intel VT-x. CPUs that support EPT also support Unrestricted Guest (UG), which is another advanced feature of VT-x. It may still be possible to run HAXM on very old (pre-2010) CPUs, e.g. Intel Core 2 Duo, which implement an earlier version of VT-x that does not include either EPT or UG. However, the legacy code that enables HAXM to work in non-EPT and non-UG modes may be removed soon.
- Windows 7 or later; both 32-bit and 64-bit Windows are supported.
- Running HAXM in a nested virtualization setup, where Windows itself runs as a guest OS on another hypervisor, may be possible, but this use case is not well tested.
The following steps prepare the test environment for installing a test-signed
IntelHaxm.sys
, i.e. one that is built using the Debug
configuration. For
more details, please read this article.
- Disable Hyper-V and enable Test Mode:
- Open an elevated (i.e. Run as administrator) Command Prompt.
bcdedit /set hypervisorlaunchtype off
- Note: In some cases, this command is not enough to completely disable Hyper-V on Windows 10. See below for a more reliable method.
bcdedit /set testsigning on
- Reboot.
- Install the test certificate:
- Copy
IntelHaxm.cer
from the build environment to the test environment (if the two are not the same). This file is generated alongsideIntelHaxm.sys
by theDebug
build configuration. - In the test environment, open an elevated Command Prompt and run
certmgr /add X:\path\to\IntelHaxm.cer /s /r localMachine root
- Copy
- Optionally, install DebugView to capture HAXM debug output.
Certain advanced Windows 10 features, such as Device Guard (in particular, Hypervisor-protected code integrity or HVCI) and Credential Guard, can prevent Hyper-V from being completely disabled. In other words, when any of these features are enabled, so is Hyper-V, even though Windows may report otherwise.
The Device Guard and Credential Guard hardware readiness tool released by Microsoft can disable the said Windows 10 features along with Hyper-V:
- Download the latest version of the tool from here. The following steps assume version 3.6.
- Unzip.
- Open an elevated (i.e. Run as administrator) Command Prompt.
@powershell -ExecutionPolicy RemoteSigned -Command "X:\path\to\dgreadiness_v3.6\DG_Readiness_Tool_v3.6.ps1 -Disable"
- Reboot.
HaxmLoader
is a small tool that can load and unload a test-signed driver
without using an INF file. You can download it from the
Releases page, or building HaxmLoader/HaxmLoader.sln
yourself using Visual Studio or EWDK.
Basically, kernel-mode drivers like HAXM are managed by Windows Service Control
Manager as services. Each such service has a unique name, a corresponding driver
file, and a state. For example, when the HAXM installer installs the
release-signed driver to C:\Windows\System32\drivers\IntelHaxm.sys
, it also
creates a service for it. This service is named intelhaxm
and is started at
boot time. HaxmLoader
works in a similar manner: when loading a test driver,
it creates a temporary service and starts it; when unloading the test driver, it
stops and then deletes the service.
To load the test driver:
- Open an elevated Command Prompt.
- Make sure no other HAXM driver is loaded.
- If
sc query intelhaxm
shows theintelhaxm
service asRUNNING
, you must stop it first:sc stop intelhaxm
- Otherwise, unload the previously loaded test driver, if any:
HaxmLoader.exe -u
- If
- Load the test driver:
HaxmLoader.exe -i X:\path\to\IntelHaxm.sys
- Note that
HaxmLoader
can load a driver from any folder, so there is no need to copy the test driver toC:\Windows\System32\drivers\
first.
- Note that
To unload the test driver:
- Open an elevated Command Prompt.
HaxmLoader.exe -u
- Optionally, you may want to restore the original, release-signed driver
(i.e.
C:\Windows\System32\drivers\IntelHaxm.sys
):sc start intelhaxm
- Launch DebugView (
Dbgview.exe
) as administrator. - In the Capture menu, select everything except Log Boot. DebugView will now start capturing debug output from all kernel-mode drivers.
- In order to filter out non-HAXM logs, go to Edit > Filter/Highlight...,
enter
hax*
for Include, and click on OK.