summaryrefslogtreecommitdiff
path: root/Building-Locally.md
blob: 77f747a03cdc5add1a9e98d50e70516c0b46c097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# How to build locally

## Step 1: Install Git and PowerShell 7

```
winget install --id Microsoft.Powershell --source winget
winget install --id Git.Git --source winget
```

## Step 2: Create a "driver build environment"

There are multiple ways to achieve this. For example, [install Visual Studio and the Windows Driver Kit](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk#download-and-install-the-windows-11-version-22h2-wdk). 

You can also use the Enterprise WDK (EWDK), a standalone, self-contained command-line environment for building drivers:
  * Download the Windows 11, version 22H2 EWDK ISO image from the [official site](https://learn.microsoft.com/en-us/legal/windows/hardware/enterprise-wdk-license-2022)
  * Mount ISO image
  * Open a terminal
  * `.\LaunchBuildEnv`
  
## Step 3: Clone Windows Driver Samples and checkout main branch

```
cd path\to\your\repos
git clone --recurse-submodules https://github.com/microsoft/Windows-driver-samples.git
cd Windows-driver-samples
```

## Step 4: Check all samples builds with expected results for all flavors

```
pwsh
.\Build-AllSamples
```
Above builds all samples for all configurations and platforms.  

You can refine, for example as follows:
```
pwsh
.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug','Release' -Platforms 'x64','arm64'
```

Expected output:
```
Samples:              153
Configurations:       2 (Debug Release)
Platforms:            2 (x64 arm64)
Combinations:         612
Logical Processors:   12
Throttle factor:      5
Throttle limit:       60

T: Combinations
B: Built
R: Build is running currently
P: Build is pending an available build slot

S: Built and result was 'Succeeded'
E: Built and result was 'Excluded'
U: Built and result was 'Unsupported' (Platform and Configuration combination)
F: Built and result was 'Failed'

Building all combinations...

Built all combinations.

Elapsed time:         12 minutes, 34 seconds.
Samples:              153
Configurations:       2 (Debug Release)
Platforms:            2 (x64 arm64)
Combinations:         612
Succeeded:            326
Excluded:             56
Unsupported:          230
Failed:               0
Log files directory:  .\_logs
Overview report:      .\_logs\_overview.htm
```