Additional configuration is required to make WinPE works well with PXE.
Prepare Boot Configuration file: BCD
Boot Configuration Data (BCD) contain information required by Windows boot kernel how to load Windows operating system. The following batch script shows how to prepare a single BCD that may boot from 4 available WinPE images:
- vista_x86.wim
- vista_x64.wim
- win7_x86.wim
- win7_x64.wim
These files should be keep in TFTP’s folder: /windows_pe/
@echo off Del BCD_PXE bcdedit /createstore BCD_PXE bcdedit /store BCD_PXE /create {ramdiskoptions} bcdedit /store BCD_PXE /set {ramdiskoptions} ramdisksdidevice boot bcdedit /store BCD_PXE /set {ramdiskoptions} ramdisksdipath \windows.pe\boot.sdi bcdedit /store BCD_PXE /create {88C83FCF-809E-4B72-8921-D91E37DCD052} /application osloader /d "Windows Vista 32-bit PE" bcdedit /store BCD_PXE /set {88C83FCF-809E-4B72-8921-D91E37DCD052} systemroot \Windows bcdedit /store BCD_PXE /set {88C83FCF-809E-4B72-8921-D91E37DCD052} detecthal Yes bcdedit /store BCD_PXE /set {88C83FCF-809E-4B72-8921-D91E37DCD052} winpe Yes bcdedit /store BCD_PXE /set {88C83FCF-809E-4B72-8921-D91E37DCD052} osdevice ramdisk=[boot]\windows.pe\vista_x86.wim,{ramdiskoptions} bcdedit /store BCD_PXE /set {88C83FCF-809E-4B72-8921-D91E37DCD052} device ramdisk=[boot]\windows.pe\vista_x86.wim,{ramdiskoptions} bcdedit /store BCD_PXE /create {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} /application osloader /d "Windows Vista 64-bit PE" bcdedit /store BCD_PXE /set {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} systemroot \Windows bcdedit /store BCD_PXE /set {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} detecthal Yes bcdedit /store BCD_PXE /set {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} winpe Yes bcdedit /store BCD_PXE /set {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} osdevice ramdisk=[boot]\windows.pe\vista_x64.wim,{ramdiskoptions} bcdedit /store BCD_PXE /set {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} device ramdisk=[boot]\windows.pe\vista_x64.wim,{ramdiskoptions} bcdedit /store BCD_PXE /create {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} /application osloader /d "Windows 7 32-bit PE" bcdedit /store BCD_PXE /set {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} systemroot \Windows bcdedit /store BCD_PXE /set {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} detecthal Yes bcdedit /store BCD_PXE /set {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} winpe Yes bcdedit /store BCD_PXE /set {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} osdevice ramdisk=[boot]\windows.pe\win7_x86.wim,{ramdiskoptions} bcdedit /store BCD_PXE /set {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} device ramdisk=[boot]\windows.pe\win7_x86.wim,{ramdiskoptions} bcdedit /store BCD_PXE /create {0341BB74-EF1A-463C-8AFB-4025472EC7DB} /application osloader /d "Windows 7 64-bit PE" bcdedit /store BCD_PXE /set {0341BB74-EF1A-463C-8AFB-4025472EC7DB} systemroot \Windows bcdedit /store BCD_PXE /set {0341BB74-EF1A-463C-8AFB-4025472EC7DB} detecthal Yes bcdedit /store BCD_PXE /set {0341BB74-EF1A-463C-8AFB-4025472EC7DB} winpe Yes bcdedit /store BCD_PXE /set {0341BB74-EF1A-463C-8AFB-4025472EC7DB} osdevice ramdisk=[boot]\windows.pe\win7_x64.wim,{ramdiskoptions} bcdedit /store BCD_PXE /set {0341BB74-EF1A-463C-8AFB-4025472EC7DB} device ramdisk=[boot]\windows.pe\win7_x64.wim,{ramdiskoptions} bcdedit /store BCD_PXE /create {bootmgr} bcdedit /store BCD_PXE /set {bootmgr} timeout 10 bcdedit /store BCD_PXE /displayorder {88C83FCF-809E-4B72-8921-D91E37DCD052} {7A213FBD-69BE-4B3F-B08C-B9A94CD929AC} {A5A5F300-04D4-4D98-9FD3-57E2E00E58D0} {0341BB74-EF1A-463C-8AFB-4025472EC7DB} bcdedit /store BCD_PXE /default {0341BB74-EF1A-463C-8AFB-4025472EC7DB}
Execute the batch file should yield a new file: BCD_PXE. We need this file in later stage
Files required by Windows PXE Boot Kernel
Windows PXE kernel requires the following files to boot WinPE properly:
# ls -l windows.pe total 829716 -rwxr--r-- 1 root root 24576 Nov 3 16:55 BCD -r-xr--r-- 1 root root 523328 Jul 14 2009 bootmgr.exe -r-xr--r-- 1 root root 3170304 Jun 10 2009 boot.sdi drwxr-xr-x 2 root root 4096 Nov 3 17:12 fonts lrwxrwxrwx 1 root root 11 Nov 4 16:33 pxeboot.0 -> pxeboot.n12 -r-xr--r-- 1 root root 25772 Jun 11 2009 pxeboot.n12 -rwxr--r-- 1 root root 201179410 Nov 3 13:46 vista_x64.wim -rwxr--r-- 1 root root 182745379 Jan 23 2008 vista_x86.wim -r-xr--r-- 1 root root 168390841 Jul 14 2009 win7_re_x64.wim -r-xr--r-- 1 root root 145287084 Nov 20 2010 win7_re_x86.wim -rwxr--r-- 1 root root 148246498 Nov 3 18:04 win7_x64.wim
File: BCD
BCD file should configure via BCDEdit tool. The above batch script generate a BCD file with file name BCD_PXE. Rename it to BCD and keep in TFTP folder
File: bootmgr.exe, pxeboot.n12
Obtain from mounted WinPE image: <mount-dir>\Windows\Boot\PXE
File: boot.sdi
Obtain from mounted WinPE image: <mount-dir>\Windows\Boot\DVD\PCAT
Folder: fonts
Obtain from mounted WinPE image: <mount-dir>\Windows\Boot\Fonts
File: *.wim
WinPE images. Prepared by WAIK tools.
Configure PXE Service
Windows PXE boot kernel file
The default Windows PXE boot kernel file has named as “pxeboot.n12”. PXELinux requires Windows PXE boot kernel with suffix of .0 instead of .n12, use
# ln -s pxeboot.n12 pxeboot.0
PXE menus
Add a menu entry in pxelinux configuration that boot Windows PXE boot Kernel:
$ cat /var/lib/tftpboot/pxelinux.cfg/default ... LABEL WINDOWS_PE menu label ^Windows Preinstallation Exnvironment kernel windows.pe/pxeboot.0 ...
TFTP server file name remapping: /var/lib/tftpboot/rules
Windows PXE boot kernel requires files in specific location, use TFTP server file name remapping option to remap the file name to actual location.
Locate TFTP rules file:
# cat /etc/xinetd.d/tftp service tftp { disable = no socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -v -m /var/lib/tftpboot/rules -s /var/lib/tftpboot per_source = 11 cps = 100 2 flags = IPv4 }
Enable remapping as follow:
$ cat /var/lib/tftpboot/rules rg \\ / # convert backslashes to slashes (useful for windows file names) r ^bootmgr\.exe /windows.pe/bootmgr.exe r ^/Boot /windows.pe
Try boot a bare bone machine with network PXE enabled and see if the Windows PXE kernel and WinPE files boot properly
1 comment:
Hi,
Your WinPE PXE tutorial is really neat. Can I invite you join us at http://reboot.pro ?
We are a community of people interested in finding new boot disk techniques based on Windows PE.
Take care!
-- Nuno
Post a Comment