Fixes for genimage.cmd

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14965 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2013-01-23 15:25:01 +00:00
parent 9a76937088
commit 6849011953

View File

@ -11,56 +11,60 @@ if [%SUFFIX%] EQU [] goto :errorbadargs
::the drive to use for holding the image
set defdrive=%SystemDrive%
::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 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
if exist %SystemDrive%\WinPE_%SUFFIX% rd %SystemDrive%\WinPE_%SUFFIX% /s /q
cd "%adkpedir%"
if exist %defdrive%\WinPE_%SUFFIX% rd %defdrive%\WinPE_%SUFFIX% /s /q
set retpath=%cd%
call copype.cmd %ARCH% %SystemDrive%\WinPE_%SUFFIX%
cd "%adkpedir%"
call copype.cmd %ARCH% %defdrive%\WinPE_%SUFFIX%
cd /d %retpath%
bcdedit /createstore %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX%
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /create {ramdiskoptions} /d "Ramdisk options"
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdidevice boot
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi
for /f "Tokens=3" %%i in ('bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /create /d "xCAT WinNB_%SUFFIX%" /application osloader') do set GUID=%%i
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% systemroot \Windows
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% detecthal Yes
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% winpe Yes
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% osdevice ramdisk=[boot]\Boot\WinPE_%SUFFIX%.wim,{ramdiskoptions}
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set %GUID% device ramdisk=[boot]\Boot\WinPE_%SUFFIX%.wim,{ramdiskoptions}
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /create {bootmgr} /d "xCAT WinNB_%SUFFIX%"
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% /set {bootmgr} timeout 1
bcdedit /store %SystemDrive%\WinPE_%SUFFiX%\media\Boot\BCD.%SUFFIX% /set {bootmgr} displayorder %GUID%
bcdedit /store %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX%
if [%ARCH%] EQU [x86] copy %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% %SystemDrive%\WinPE_%SUFFIX%\media\Boot\B32
if [%ARCH%] EQU [amd64] copy %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD.%SUFFIX% %SystemDrive%\WinPE_%SUFFIX%\media\Boot\BCD
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
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% /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%
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
dism /mount-image /imagefile:%SystemDrive%\WinPE_%SUFFIX%\media\Sources\boot.wim /index:1 /mountdir:%SystemDrive%\WinPE_%SUFFIX%\mount
dism /mount-image /imagefile:%defdrive%\WinPE_%SUFFIX%\media\Sources\boot.wim /index:1 /mountdir:%defdrive%\WinPE_%SUFFIX%\mount
cd /d %retpath%
copy startnet.cmd %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\system32
copy getnextserver.exe %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\system32
rem copy "%SystemDrive%\Program Files\Windows AIK\Tools\%ARCH%\imagex.exe" %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\system32
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-WMI.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-Scripting.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-RNDIS.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-NetFX4.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-PowerShell3.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-DismCmdlets.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\WinPE_OCs\WinPE-StorageWMI.cab"
dism /Image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-WDS-Tools.cab"
copy %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\Boot\PXE\pxeboot.n12 %SystemDrive%\WinPE_%SUFFIX%\media\Boot\pxeboot.0
copy %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\Boot\PXE\wdsmgfw.efi %SystemDrive%\WinPE_%SUFFIX%\media\Boot\wdsmgfw.efi
copy %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\Boot\EFI\bootmgfw.efi %SystemDrive%\WinPE_%SUFFIX%\media\Boot\bootmgfw.efi
copy %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\Boot\EFI\bootmgr.efi %SystemDrive%\WinPE_%SUFFIX%\media\Boot\bootmgr.efi
copy %SystemDrive%\WinPE_%SUFFIX%\mount\Windows\Boot\PXE\bootmgr.exe %SystemDrive%\WinPE_%SUFFIX%\media\
rem for /r %SystemDrive%\drivers %%d in (*.inf) do dism /image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-driver /driver:%%d
if exist %SystemDrive%\drivers dism /image:%SystemDrive%\WinPE_%SUFFIX%\mount /add-driver /driver:%SystemDrive%\drivers /recurse
dism /Unmount-Wim /commit /mountdir:%SystemDrive%\WinPE_%SUFFIX%\mount
move %SystemDrive%\WinPE_%SUFFIX%\media\Sources\boot.wim %SystemDrive%\WinPE_%SUFFIX%\media\Boot\WinPE_%SUFFIX%.wim
copy startnet.cmd %defdrive%\WinPE_%SUFFIX%\mount\Windows\system32
copy getnextserver.exe %defdrive%\WinPE_%SUFFIX%\mount\Windows\system32
rem copy "%defdrive%\Program Files\Windows AIK\Tools\%ARCH%\imagex.exe" %defdrive%\WinPE_%SUFFIX%\mount\Windows\system32
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-WMI.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-Scripting.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-RNDIS.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-NetFX4.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-PowerShell3.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-DismCmdlets.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-StorageWMI.cab"
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-WDS-Tools.cab"
copy %defdrive%\WinPE_%SUFFIX%\mount\Windows\Boot\PXE\pxeboot.n12 %defdrive%\WinPE_%SUFFIX%\media\Boot\pxeboot.0
copy %defdrive%\WinPE_%SUFFIX%\mount\Windows\Boot\PXE\wdsmgfw.efi %defdrive%\WinPE_%SUFFIX%\media\Boot\wdsmgfw.efi
copy %defdrive%\WinPE_%SUFFIX%\mount\Windows\Boot\EFI\bootmgfw.efi %defdrive%\WinPE_%SUFFIX%\media\Boot\bootmgfw.efi
copy %defdrive%\WinPE_%SUFFIX%\mount\Windows\Boot\EFI\bootmgr.efi %defdrive%\WinPE_%SUFFIX%\media\Boot\bootmgr.efi
copy %defdrive%\WinPE_%SUFFIX%\mount\Windows\Boot\PXE\bootmgr.exe %defdrive%\WinPE_%SUFFIX%\media\
mkdir %defdrive%\WinPE_%SUFFIX%\media\dvd
copy %oscdimg%\etfsboot.com %defdrive%\WinPE_%SUFFIX%\media\dvd
copy %oscdimg%\efisys_noprompt.bin %defdrive%\WinPE_%SUFFIX%\media\dvd
rem for /r %defdrive%\drivers %%d in (*.inf) do dism /image:%defdrive%\WinPE_%SUFFIX%\mount /add-driver /driver:%%d
if exist %defdrive%\drivers dism /image:%defdrive%\WinPE_%SUFFIX%\mount /add-driver /driver:%defdrive%\drivers /recurse
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
echo "Upload %SystemDrive%\WinPE_%SUFFIX%\media\* into tftp root directory of xCAT (usually /tftpboot/), should ultimately have /tftpboot/Boot/bootmgfw.efi for example"
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