# Installing Windows 10X (from cabs with Device Image Generator) on real hardware

| Created: February 2, 2021 | Last Update: February 4, 2021                                |
| ------------------------- | ------------------------------------------------------------ |
| Authors:                  | [NT Authority](https://twitter.com/NTAuthority), [Albacore](https://twitter.com/thebookisclosed), [Gustave Monce](https://twitter.com/gus33000), [Rafael Rivera](https://twitter.com/WithinRafael), [Daniel Kornev](https://twitter.com/danielko) |
| Status:                   | **Draft**                                                    |
| Supported Windows 10X Version:      | 20279 |

**Disclaimer: Some drivers may fail to load, the guide will be updated with extra tips on extending driver compatibility later**
## Overview
Here's some quick notes on installing Windows 10X on real hardware from cabs using the user-friendly Device Image Generator made by [Albacore](https://twitter.com/thebookisclosed). For this example, we're assuming a system with _no_ other critical disks installed, and a helpful host system being around to set up the initial image.

This guide has been created for the 20279 version of Windows 10X. 



## Prerequisites
### Host
* Windows 10 Iron or Cobalt (20279 or 21xxx+) - though 20H2 can also work just fine
* Utility USB flash drive of ~8GB+

### Target
* Graphics card with DCHU drivers available
* UEFI system firmware with the ability to **disable Secure Boot**
* Boot drive larger than 100 GiB
* Learn how to disable Secure Boot in your device, and change its boot order to allow booting from the USB Flash Drive

### Peripherals
**Note:** If your device doesn't have a built-in Ethernet adapter, prepare an external Ethernet adapter (USB/USB-C/USB-C Hub with Ethernet). You **won't be able to pass through the OOBE without internet connection**.

## Common: Files & Tools
### Workspace
1. Create a folder called 10X in the root of your drive, e.g, ```C:\10X```
2. Create a subfolder called ```Sources```
3. If you are running on a machine that is not the target machine (the one you want to flash Windows 10X onto) create a subfolder called ```DCHUDrivers```
4. Use [v0.3.0.0. release](https://github.com/gus33000/UUPMediaCreator/releases/tag/0.3.0.0) of the Gus's UUPMediaCreator(https://github.com/gus33000/UUPMediaCreator)) to download bits by typing this command in the Command Prompt (where ```dlfolder``` is the place to put downloaded bits, e.g., `C:\10X\dlfolder`, and ```amd64``` specifies the architecture; you can specify ```arm64``` for ARM64 build of Windows 10X):

```
uupdownload -o dlfolder -s Lite -t amd64 -r External -b Dev -a CB -c fe_release_10x -v 10.0.20279.1002 -z test
```

**Note:** you **must** use ```-z Test``` param to download **Test** build of Windows 10X which includes non-production components.

5. Put them into ```Sources``` folder (e.g., ```C:\10X\Sources```)
6. Make sure that bits are in ```Sources``` folder directly (```\10X\Sources\*compdb*.cab``` should be at this level)
7. [Download ```overlay.zip```](https://gist.github.com/riverar/53d204bb275003fa9fcb387ff6a72530) from Rafael
8. Unpack it to your ```Sources``` folder (e.g., ```C:\10X\Sources```)
9. Open command line in the ```Sources``` folder and run ```fixup.cmd``` in it
10. Copy the appx folder from the downloaded folder (with bits) to the root of your packages folder (e.g., ```C:\10X\Sources```)
11. Create ```Tools``` folder
12. Create ```Devices``` folder
13. Create ```FFUs``` folder
14. Create ```FMFiles``` folder
15. Extract ```FM.xml``` files from **all CABs that contain FM~** in their name into a folder called ```FMFiles``` by using this command (thanks to [Steve Troughton-Smith](https://twitter.com/stroughtonsmith/) ([Tweet](https://twitter.com/stroughtonsmith/status/1356637737223348224))):

```
expand -i Sources\Retail\AMD64\fre\*FM~*.cab -f:*FM.xml Sources\FMFiles\
```

   
16. Your resulting folder structure should look like this:

```
(disk root)
|
-----10X
     |
     ------DCHUDrivers (only if your target machine differs from the one you will build this image)
     ------FMFiles
     ------Sources
           |
           -----appx (includes folders for each AppX)
           -----Retail
                |
                -----%Architecture_Name% (e.g., AMD64)
                     |
                     -----fre (includes the rest of the cabs)
           -----(several top-most cabs with compdb in the name, and .uupmcreplay file)
     ------Tools
     ------Devices
     ------FFUs
```

### Install Tools
**Note:** Both ADK and WinPE should have the same or higher version as your Windows 10X Image.
1. [Optional] If you have previous kits (e.g., WP8 Tools), remove them
2. [Download the ADK Insider Preview ISO](https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK) for your host OS version (only tested with ```Windows_InsiderPreview_ADK_en-us_20279.iso```)
3. Install **Deployment Tools**, **ICD**, **Configuration Designer**, and uncheck the rest if possible/as needed
4. [Download the Windows Preinstallation Environment ISO](https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewADK) for your host OS version (only tested with 20279 version)
5. Install **Windows Preinstallation Environment**
6. [Download Windows Image Generator](https://mega.nz/file/KjIQDRyT#qPR_GNHcRYivreZyhDICSOhmngsKJsWuW5JSpIA6P6M) (see [tweet](https://twitter.com/thebookisclosed/status/1356074468330917888))
7. Unpack it to ```(disk root)\10X\Tools```
8. [Download updates to it](https://mega.nz/file/q2QSGLRC#Z8Vy8N8Qz0Bn6wR9gxOlhlad0FP6nwbzCzRxheRlVmI)
9. Unpack it over the existing files to ```(disk root)\10X\Tools```

### Configure Your BSP
Board Support Packages (BSP) is a collection of drivers/settings required to run Windows 10X on a hardware platform. The BSP also includes a set of device drivers that are specific to the components/silicon used in the device, mostly in the form of .inf files and their associated .sys/.dll files.

You will need a BSP for your device if you want it to use all of its devices (WiFi, Cameras, etc.).

To configure your BSP, you need to obtain DCH (Universal) Drivers for your device, and then prepare the ```OEMDriversFM.xml``` feature manifest XML file with the links to your drivers.

#### Prepare DCHU Drivers for Your Hardware
##### Common Steps
1. Go to ```(disk root)\10X\Tools\``` and open ```DevImgGen.exe```

[![](https://osg.wiki/uploads/images/gallery/2021-02/scaled-1680-/kFPXOYOEzbiGOkwW-image-1612453756539.png)](https://osg.wiki/uploads/images/gallery/2021-02/kFPXOYOEzbiGOkwW-image-1612453756539.png)

##### Extracting Drivers From Your Target Machine
This is the case when your target machine is the same you're building this image on. 

*Example: you have Surface Pro 6 and you want to flash it with Windows 10X. You use Device Image Generator to extract current drivers from your Windows 10 machine.*

1. In the **Windows Device Image Generator** use the first menu option ("Export drivers from this PC") to extract drivers from the current machine
2. Specify location for storing your drivers package in the opened window to ```10X\Devices```

[![
](https://osg.wiki/uploads/images/gallery/2021-02/scaled-1680-/mUT9KzvV4nlJK9Ms-image-1612453910260.png)](https://osg.wiki/uploads/images/gallery/2021-02/mUT9KzvV4nlJK9Ms-image-1612453910260.png)

3. Click on "Start export"

##### Using Downloaded Drivers
This is the case when your target machine is different from the one you're building this image on.

*Example: you have Surface Pro 6 and Surface Go. You want to flash your Surface Go with Windows 10X. You use Device Image Generator to generate device driver package from the drivers you've downloaded for your Surface Go.*

1. Obtain DCHU Drivers for your hardware (especially GPU)
2. In the **Windows Device Image Generator** use the second menu option to generate device drivers package from your DCHU drivers folder
3. In the "Create configuration packages" specify location of your DCHU drivers (```(disk root)\10X\DCHUDrivers```), and specify location for storing your drivers package in the opened window to ```10X\Devices```
3. Click "Process drivers"


#### [Optional] Edit A BSP for Your Hardware
This is only needed if some of the devices shall not be used.

1. Use ```DeviceDriversPackageFM.xml``` generated by the Device Image Generator, located at ```(disk root)\10X\Devices``` and comment out items that shall not be used: 

```xml
	<?xml version="1.0" encoding="utf-8"?>
	<FeatureManifest Revision="1" SchemaVersion="1.2" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/embedded/2004/10/ImageUpdate">
		<Drivers>
			<BaseDriverPackages>
				<DriverPackageFile Path="C:\10X\DCHUDrivers\Intel\bin\Drivers\iigd_oc" Name="iigd_dc_base.inf"/>
				<!-- <DriverPackageFile Path="C:\10X\DCHUDrivers\SurfaceACPIBattery\bin\Drivers\iigd_oc" Name="SurfaceACPIBattery.inf"/>-->
				<DriverPackageFile Path="C:\10X\DCHUDrivers\SurfacePen\bin\Drivers\SurfacePen" Name="SurfacePen.inf"/>
			</BaseDriverPackages>
		</Drivers>
	</FeatureManifest>
```

**Note:** If your target machine is **Surface Go**, **remove** reference to ```SurfaceACPIBattery.inf```.



### [Optional] Configure Your Image
**Note:** Not yet supported by the tool (```OEMInput.xml``` is generated on the fly currently).
1. Edit ```OEMInput.xml``` if needed. 


### Build Your Image
1. Prepare your environment: 

Start > open **elevated** ***Deployment and Imaging Tools Environment**
	
2. In that window, type this (where ```C:\``` is the drive where your Windows 10 Insider Preview ADK is installed):
```
C:\> cd c:\Program Files (x86)\Windows Kits\10\Tools\bin\i386
```
3. Unless you use a non-prod machine, run this command to unregister the imaging toolchain overrides:
```
C:\> "%ProgramFiles(x86)%\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\%PROCESSOR_ARCHITECTURE%\DISM\wimmountadksetup%PROCESSOR_ARCHITECTURE%.exe" /q /uninstall
```
4. Use third option in the **Windows Device Image Generator** to begin generation of your Image (ffu). Use ```(disk root)\10X\Sources``` as the location of OS packages. Use ```(disk root)\10X\FFUs``` folder for storing your resulting FFU. Use ```(disk root)\10X\Devices``` as the location of your driver configuration packages.
5. Click on "Start building", and make sure to allow the separate elevated process to start. It will start the process of building the image.

[![](https://osg.wiki/uploads/images/gallery/2021-02/scaled-1680-/jCEcrcwMqQnGfPd8-image-1612454099131.png)](https://osg.wiki/uploads/images/gallery/2021-02/jCEcrcwMqQnGfPd8-image-1612454099131.png)

## Prepare USB Drive for Flashing
**Note:** You can follow Microsoft docs ([Part I: Create Multipartition USB Drive](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe--use-a-single-usb-key-for-winpe-and-a-wim-file---wim#create-two-partition-drive), [Part II: Install WinPE](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-create-usb-bootable-drive)), or you can follow these instructions (taken from the docs):
1. Get an empty Flash drive (with size at least 8GB)
2. In the same **Deployment and Imaging Tools Environment**'s elevated **Command Prompt window** open **diskpart** and press `Enter`
3. Follow these instructions to create two disks:
```	
List disk 
select disk X (where X is your USB drive) 
clean 
create partition primary size=2048 
active 
format fs=FAT32 quick label="WinPE" 
assign letter=P 
create partition primary 
format fs=NTFS quick label="Images" 
assign letter=I 
exit
```

4. Create Working WinPE files by using this command (where ```C:\WinPE_amd64``` is the location of your choice):

```
copype amd64 C:\WinPE_amd64
```

5. Create bootable media with it (where ```P:``` is the letter of the FAT32 partition of your USB Flash drive):

```
MakeWinPEMedia /UFD C:\WinPE_amd64 P:
```

6. Copy your Image (```.ffu``` file) to the ```I:``` drive (the second partition of your Flash drive formatted with NTFS)
7. Download and add ```gdisk64.exe``` file to the root of your WinPE partition (```P:``` in this example)

### Apply Your Image
#### Apply Your Image on Machine Without Windows 10X Installed On It
1. Boot from WinPE drive
2. Open **diskpart** 
3. Type this:

```
list disk
```

Take a note of the name of your device's main disk drive, e.g., ```disk 0```
4. Type **exit** to leave **diskpart**
5. Use this command (and specify the correct path to the ffu that you created above, as well the id of your physical drive):

```
dism /apply-ffu /imagefile:C:\\YourDevice.ffu /applydrive:\\.\physicaldrive0
```
6. Once complete, remove your USB flash drive
7. Type **exit** in the **Command Prompt window**

#### Apply Your Image on Machine With Windows 10X Installed On It
1. Boot from WinPE drive 
2. Type **notepad** to open notepad
3. Use ```File-->Open``` to find the name of your WinPE disk
4. Type this to identify the id of your physical drive:

```
spaceutil get-drive -poolname ospool
```

5. Type this (where ```D:\``` is the name of your WinPE disk and ```0``` in the end of ```physicaldrive0``` is the id of your physical drive):

```
cd D:\
gdisk64 -l \\.\physicaldrive0
```

6. Make sure that it contains OSPool and other partitions of Windows 10X
7. Type this to clean up the drive (where ```0``` in the end of ```physicaldrive0``` is the id of your physical drive):

```
gdisk64 \\.\physicaldrive0
o
w
```
and press ```Enter```

8. Use this command (and specify the correct path to the ffu that you created above, as well the id of your physical drive):

```
dism /apply-ffu /imagefile:C:\YourDevice.ffu /applydrive:\\.\physicaldrive0
```
9. Once complete, remove your USB flash drive
10. Type **exit** in the **Command Prompt window**

### Load Windows 10X
At this time, your Windows 10X will boot. If everything is correct you should see the OOBE.