Windows PE boot

Test

Boot into a Windows PE operating system generated according to these instructions via TFTP.

DUT configuration

No physical disks present. System configured to boot from NIC equipped with gPXE ROM.

Environment configuration

TFTP server hosting WinPE files. DHCP server providing network configuration and path to WinPE's \Boot\pxeboot.n12 file.

Result

Success is defined as reaching WinPE's X:\Windows\system32 command prompt.

Detailed test procedure

Prerequisites
AIK installation

The Vista AIK is distributed as an image of an ISO 9660 filesystem. Mount it on a Linux machine or otherwise extract it. (TODO: this step should be more detailed)

Run STARTCD.EXE from the CD image. Select “Windows AIK Setup” and follow the defaults until installation is complete.

WinPE setup

Run the Windows PE Tools Command Prompt (Start → All Programs → Microsoft Windows AIK → Windows PE Tools Command Prompt). Note that administrative privilege is required for some of the following commands, so the command prompt must be run elevated (Right click → Run as administrator) if using Vista with UAC.

Run the following commands in this command prompt:

mkdir C:\Temp
call copype.cmd x86 C:\Temp\Boot
del /Q etfsboot.com
move ISO\boot\boot.sdi boot.sdi
rmdir /S /Q ISO
imagex /mount winpe.wim 1 mount
copy mount\Windows\Boot\PXE\pxeboot.n12 pxeboot.n12
copy mount\Windows\Boot\PXE\bootmgr.exe bootmgr.exe
copy mount\Windows\System32\bcdedit.exe bcdedit.exe
imagex /unmount mount
rmdir /Q mount
bcdedit -createstore BCD
set BCDEDIT=bcdedit -store BCD
%BCDEDIT% -create {ramdiskoptions} -d "Ramdisk options"
%BCDEDIT% -set {ramdiskoptions} ramdisksdidevice boot
%BCDEDIT% -set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
for /f "tokens=3" %i in ('%BCDEDIT% -create -d "Windows PE" -application osloader') do set GUID=%i
%BCDEDIT% -set %GUID% systemroot \Windows
%BCDEDIT% -set %GUID% detecthal Yes
%BCDEDIT% -set %GUID% winpe Yes
%BCDEDIT% -set %GUID% osdevice ramdisk=[boot]\Boot\winpe.wim,{ramdiskoptions}
%BCDEDIT% -set %GUID% device ramdisk=[boot]\Boot\winpe.wim,{ramdiskoptions}
%BCDEDIT% -create {bootmgr} -d "Windows Boot Manager"
%BCDEDIT% -set {bootmgr} timeout 30
%BCDEDIT% -set {bootmgr} displayorder %GUID%
del /Q bcdedit.exe

Note that these commands cannot be directly entered into a batch file due to the extra % substition in the for loop. (TODO: rewrite it so it works in a batch file)

TFTP server setup

Copy C:\Temp\Boot to the TFTP server's directory, so that the files are in /Boot/*. Preserve case on filenames when copying.

Configure the TFTP server to allow backslash as a directory separator (as in tftp_backslash). Ensure the TFTP server is restarted after the configuration change.

Add a DHCPD configuration file fragment to boot the Windows PE loader from the TFTP server:

filename "\\Boot\\pxeboot.n12";
next-server tftp.server.ip.here;

Boot from gPXE as usual; after some time, the Windows PE command prompt should appear.