diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index 55c3993d0..ea3005a05 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -658,7 +658,7 @@ sub mkinstall print FILE $winpepathcfg; close (FILE); - if (open (PDPID, "; kill 10, $pdpid; } diff --git a/xCAT-server/share/xcat/netboot/windows/genimage.cmd b/xCAT-server/share/xcat/netboot/windows/genimage.cmd index 000379156..e075029f5 100644 --- a/xCAT-server/share/xcat/netboot/windows/genimage.cmd +++ b/xCAT-server/share/xcat/netboot/windows/genimage.cmd @@ -1,8 +1,14 @@ @echo off -::This script requires that the following be installed onto the Windows -::workstation used to build the netboot architecture -::'https://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=94bb6e34-d890-4932-81a5-5b50c657de08' -if [%1] EQU [] goto :errorbadargs +::This script is used to create customized Winpe and BCD for deployment of Windows 8 and Windows Server 2012 + +::This script requires that the ADK must be installed onto the Windows +::workstation used to build the winpe and BCD +::'http://www.microsoft.com/en-us/download/details.aspx?id=30652' + +::This script can accept three parameters: +::genimage.cmd arch [winpe name] [bcdonly] + +::get the arch from first param set ARCH=%1% if [%ARCH%] EQU [x86] set SUFFIX=32 if [%ARCH%] EQU [amd64] set SUFFIX=64 @@ -10,10 +16,26 @@ if [%SUFFIX%] EQU [] goto :errorbadargs ::Configuration section ::the drive to use for holding the image set defdrive=%SystemDrive% + +::get the name of winpe +set WINPENAME= +set BCDONLY= +set BOOTPATH=Boot + +if [%1] EQU [] goto :errorbadargs +if [%2] EQU [] ( echo Generate winpe to default path %defdrive%\WinPE_%SUFFIX%\media ) else set WINPENAME=%2% +if [%2] NEQ [] echo Generate winpe to path %defdrive%\WinPE_%SUFFIX%\media\winboot\%WINPENAME% +if [%3] EQU [bcdonly] set BCDONLY=1 +if [%WINPENAME%] NEQ [] set BOOTPATH=winboot\%WINPENAME%\Boot + ::location where Windows PE from ADK install is located set adkpedir=%defdrive%\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment set oscdimg=%defdrive%\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg +set WinPERoot=%adkpedir% +set OSCDImgRoot=%oscdimg% +set Path=C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\amd64\DISM;%Path% +::clean the c:\winPE_amd64 and copy it from ADK if exist %defdrive%\WinPE_%SUFFIX% rd %defdrive%\WinPE_%SUFFIX% /s /q set retpath=%cd% cd "%adkpedir%" @@ -23,13 +45,13 @@ cd /d %retpath% bcdedit /createstore %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /create {ramdiskoptions} /d "Ramdisk options" bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdidevice boot -bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi +bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdipath \%BOOTPATH%\boot.sdi for /f "Tokens=3" %%i in ('bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /create /d "xCAT WinNB_%SUFFIX%" /application osloader') do set GUID=%%i bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% systemroot \Windows bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% detecthal Yes bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% winpe Yes -bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% osdevice ramdisk=[boot]\Boot\WinPE_%SUFFIX%.wim,{ramdiskoptions} -bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% device ramdisk=[boot]\Boot\WinPE_%SUFFIX%.wim,{ramdiskoptions} +bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% osdevice ramdisk=[boot]\%BOOTPATH%\WinPE_%SUFFIX%.wim,{ramdiskoptions} +bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% device ramdisk=[boot]\%BOOTPATH%\WinPE_%SUFFIX%.wim,{ramdiskoptions} bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /create {bootmgr} /d "xCAT WinNB_%SUFFIX%" bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {bootmgr} timeout 1 bcdedit /store %defdrive%\WinPE_%SUFFiX%\media\Boot\BCD.%SUFFIX% /set {bootmgr} displayorder %GUID% @@ -37,6 +59,8 @@ bcdedit /store %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% if [%ARCH%] EQU [x86] copy %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% %defdrive%\WinPE_%SUFFIX%\media\Boot\B32 if [%ARCH%] EQU [amd64] copy %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% %defdrive%\WinPE_%SUFFIX%\media\Boot\BCD +::skip the creating of winpe +if [%BCDONLY%] EQU [1] goto :reorgpath dism /mount-image /imagefile:%defdrive%\WinPE_%SUFFIX%\media\Sources\boot.wim /index:1 /mountdir:%defdrive%\WinPE_%SUFFIX%\mount cd /d %retpath% @@ -64,9 +88,21 @@ if exist %defdrive%\drivers dism /image:%defdrive%\WinPE_%SUFFIX%\mount /add-dri dism /Unmount-Wim /commit /mountdir:%defdrive%\WinPE_%SUFFIX%\mount move %defdrive%\WinPE_%SUFFIX%\media\Sources\boot.wim %defdrive%\WinPE_%SUFFIX%\media\Boot\WinPE_%SUFFIX%.wim + +::move the c:\WinPE_64\media to c:\WinPE_64\media\winboot\ if is specified (second param) +:reorgpath +if [%WINPENAME%] NEQ [] rename %defdrive%\WinPE_%SUFFIX%\media origmedia +if [%WINPENAME%] NEQ [] md %defdrive%\WinPE_%SUFFIX%\media\winboot +if [%WINPENAME%] NEQ [] move %defdrive%\WinPE_%SUFFIX%\origmedia %defdrive%\WinPE_%SUFFIX%\media\winboot +if [%WINPENAME%] NEQ [] rename %defdrive%\WinPE_%SUFFIX%\media\winboot\origmedia %WINPENAME% + +echo Finished generating of winpe and BCD. echo "Upload %defdrive%\WinPE_%SUFFIX%\media\* into tftp root directory of xCAT (usually /tftpboot/), should ultimately have /tftpboot/Boot/bootmgfw.efi for example" goto :eof :errorbadargs echo Specify the architecture on the command line +echo Usage: genimage.cmd arch [winpe name] [bcdonly] +echo e.g. genimage.cmd amd64 mywinpe +echo e.g. genimage.cmd amd64 bcdonly goto :eof :eof