145 - Install Windows directly from an ISO file using iPXE wimboot (MBR\UEFI + grub2\grub4dos)
This method allows you to directly boot from a number of different unmodified Windows Install 7/8/10 ISOs on a bootable USB drive AND then run Setup to install Windows to a system.
No files need to be extracted from the ISO - just copy the ISO file and boot!
Legacy, UEFI or PXE boot is supported.
The ISO is automatically mounted as a virtual drive so Setup can find and use the Install.wim\esd file.
2GB or more RAM is required to be in the system (it may fail to work if not enough RAM is available).
The Windows Install ISO file does not need to be modified in any way.
I will describe here only the outline process so that you can see how it is done. Easy2Boot uses a similar (but not identical) process when MBR-booting.
Example grub2 menus are also provided (grub4dos only MBR boots, grub2 will MBR and UEFI32 and UEFI64 boot).
Process in outline:
Add Windows Install ISO to a grub4dos or grub2 bootable USB drive
Add a menu for grub4dos\grub2
The menu uses wimboot to boot to files inside the ISO
Add in a null.cfg file which contains the full path of the ISO (except for the drive letter)
The menu also injects a startnet.bat file and winpeshl.ini file
For MBR booting we swap BIOS device hd0 with hd1 so that Windows does not think the boot drive is the USB drive (it may refuse to install Windows to a Removable USB drive or Setup may install the Windows boot code to a USB hard disk if we don't do this).
When the grub2\grub4dos menu is picked, here is what happens...
The ISO is mounted (by grub4dos as a CD device using map or by grub2 as a loop device)
wimboot will load the boot.wim, boot.SDI and BCD from the mounted ISO into RAM
wimboot injects into the boot.wim\X: RAM drive a null.cfg file which contains the file path of the ISO
wimboot injects into the boot.wim\X: RAM drive a winpeshl.ini and startup.bat file
The boot.wim file is booted to by wimboot via bootmgr+BCD and startup.bat runs
startup.bat finds the USB drive and installs ImDisk (which is also located in a folder on the USB drive somewhere)
startup.bat finds the null.cfg file in X:\Windows\System32 and from this we can determine the name of the ISO that we need to load
startup.bat uses ImDisk to load the ISO as drive Y: from the USB drive
startup.bat runs X:\Setup.exe which will now be able to find the \sources\install.wim file on the Y: virtual DVD drive mounted by ImDisk
If required, we can also inject an XML file into the X:\Windows\System32 folder and specify this as the unattend file when we run setup.exe. This will cause Setup to be automated.
For MBR-bootong, it is necessary to swap the BIOS drives 0 (USB drive) and 1 around so that Windows will think the 'boot' drive is the internal hard disk and not the USB drive - otherwise Windows will refuse to install the boot code (and the Windows OS) to the first internal hard disk.
You can use VBox+VMUB to test (see Tutorial 4) but the grub2 drivemap command can cause WinPE to hang and not boot in a VM.
Example grub2 MBR menu:
Note: filenames defined after newc: must not be bigger than 31 characters or wimboot will fail.
Also grub is case sensitive so beware! - e.g. /Boot/boot.sdi instead of /boot/boot.sdi.
wimboot will try to locate a suitable bootmgr or bootxxx.efi boot file, so you don't usually need to specify one.
You can also add in bootmgr.exe or bootmgr or bootx64.efi/bootmgfw.efi files if the wim file does not contain a suitable file (copy the files to the \wimboot folder)
iPXEwimboot is used for MBR booting but a special grub2 (unsigned, non-secure) version of grub2 with wimboot.mod is required for UEFI-booting.
Example MBR grub4dos menu:
IMPORTANT: order of the files in the initrd line seems to be important, the bcd and .wim file should be the last files loaded for the MBR version of wimboot.
On our USB drive we have a \wimboot folder:
null.cfg (contains the line installiso=xxxxxxxxx where xxxxxxxxx is the path and filename of the ISO using forward slashes)
\(the windows install iso)
Adding a 'Windows Install from ISO' menu to the E2B grub2 menu system
Set up your E2B drive with a second partition and the E2B grub2 menu files FIRST, then switch to the .imgPTN23 file so that the first partition contains the standard grub2 boot menu system files and the second partition contains your grub2 menu folders (e.g. \_ISO\MAINMENU, etc.) and then...
The following windows_install.grub2 menu text file can be added to the \_ISO\MAINMENU folder on the 2nd partition.
Download the grub2_wimboot files - extract it onto the root of the 2nd partition so you have a new \wimboot folder
Download the windows_install.grub2 file and copy it to \_ISO\MAINMENU\grub2 folder on the 2nd E2B partition. Rename it as custom_menu.grub2 if using grub2 Beta 10 or later.
Create a new \_ISO\MAINMENU\WINDOWS folder (must be in capital letters) on the 2nd partition and place all your Windows Install ISOs in that folder.
This is for MBR booting
2nd partition (additions)
\_ISO\MAINMENU\WINDOWS\ (your windows isos here)
Note: E2B grub2 v10W.imgPTN already includes wimboot and a new Windows Install W menu (you just copy your ISOs to the 2nd partition!) - see next section below...
Add grub2 UEFI + wimboot (using a1ive grub2)
I suggest you use the latest E2B grub2 v10W .imgPTN file - see bottom of this page for instructions.
The following instructions are for the v10A E2B grub2 menu system and is more difficult to set up...
A1ive has added a wimboot grub2 module into his special version of grub2 (unsigned).
1. Download the grub2 UEFI zip file
2. Extract the files to the \EFI\BOOT folder on the first FAT32 partition (after switching in the E2B grub2 .imgPTN file)
3. Use the windows_install.grub2 menu file (copy to \_ISO\MAINMENU\grub2 folder)
4. Place all your Windows Install ISO files in the \_ISO\MAINMENU\WINDOWS folder - must end in .ISO or .iso.
5. Add this line into one of the customX_menu.grub2 files at the very bottom to add in the windows menu
The E2B grub2 menu system will automatically add-in any customX_menu.grub2 files but the source line is required so that it adds in the windows_install.grub2 menu (or rename it as custom3_menu.grub2 instead if you wish),
The Windows ISOs will be automatically added into the main grub2 menu when you boot. If you have placed Windows Install ISOs in the \_ISO\MAINMENU\WINDOWS folder, they should be listed in the grub2 menu when you boot.
The ISO filename can contain spaces. It must end in .ISO or .iso (case sensitive - so not .ISo for instance).
Standard Microsoft dual-architecture Install ISOs are supported, x64 will be used if the CPU is a 64-bit processor.
For MBR-booting, the menu may run bootmgr and then hang on a Virtual Machine due to the drivemap command - so test on a REAL SYSTEM if you have boot problems on a VM.
If wimboot uses an incorrect bootmgr/bootgmfw.efi file you may get a 0xc000000f unknown error BSOD - it is often better to not specify this file and let wimboot find it.
Note that the full path of the ISO is placed in null.cfg which is later picked up by startup.bat.
Example startup.bat file:
You must use a standard Microsoft WinPE BCD which is usually already present in a standard Microsoft Windows Install ISO.
Special WinPE ISOs tend to contain non-standard BCDs which will give a BSOD.
If in doubt, make a new BCD file using BootIce and copy it to the \wimboot folder so you can use it with wimboot.
The files will be placed by wimboot into their standard locations inside the RAMDisk that it makes so you must use standard names and paths in the BCD.
For UEFI - BCD must be set to boot from \sources\boot.wim and use \boot\boot.sdi and boot file=\Windows\system32\boot\winload.efi
For MBR - BCD must be set to boot from \sources\boot.wim and use \boot\boot.sdi and boot file=\Windows\system32\boot\winload.exe
If you get an error check that the winload file exists in the correct path inside the boot.wim by using 7Zip to open the ISO and \sources\boot.wim file.
Note: A solid black checkbox indicates 'not defined in BCD'.
wimboot command line
wimboot will parse the following extra commands on the same line (e.g. linux16 /wimboot pause):
rawbcd Use raw (unpatched) BCD files
rawwim Use raw (unpatched) WIM files
gui Allow graphical output from bootmgr/bootmgfw
pause Pause before booting OS
pause=quiet Pause without displaying any prompt
index=n WIM boot index
initrdfile Ignored to allow to be used with syslinux
after processing the command line, the files in the initrd ramdrive will be loaded.
File Injection into \Windows\System32
Files named 'BCD', or ending in '.wim' or '.sdi' are ignored and are not injected into the X:\Windows\System32 folder.
All other files added using wimboot will be added to the X:\windows\system32 folder with the new name that you specify.
Make your own grub2 boot files
The bootx64.efi and bootia32.efi files are stub files which load grubx64.efi and grubia32.efi.
To build you own grub2 files, download a build from here.
build_grub.bat <<< run this
| | \---ntboot
| | \---NTBOOT.MOD
Double-click on build_grub.bat to make new core.img, grubx64.efi and grubia32.efi boot files.
The builtin.lst files under the arch folder contain a list of modules which will be added into grub2.
The EFI files will be unsigned and so will not Secure Boot.
Example WinPE E2B .grub2 menus
Download custom2_menu.grub2 for WinPE files.
Create a .grub2 menu - e.g. \_ISO\MAINMENU\grub2\custom2_menu.grub2 in the 2nd E2B partition.
grub2 UEFI + wimboot (iPXE)
You can use the iPXE environment instead of a grub2 environment
\boot.ipxe - config file run by iPXE
\ipxe64.efi - contains iPXE boot code (x64)
\ipxe32.efi - contains iPXE boot code (32-bit)
\wimboot - the wimboot code
\win\boot64.wim - \win folder contains your bootable wim file (any name)
\win\BCD2 - and name for BCD
\win\boot.sdi - generic boot.sdi
1. Go to the ROMMatic site and create a 64-bit and 32-bit .EFI file using - Advanced - EFI PXE bootstrap xx-bit (.efi)
and paste in the following script in the Embedded script box at the bottom:
then click on Proceed and wait (if you get a timeout - try again)
2. Now you should have a ipxe64.efi file and a ipxe32.efi file which you can load from grub2:
3. Create the iPXE config file \boot.ipxe
The same boot.sdi file can be used by all Windows 7/8/10 etc. AFAIK.
4. Use BootIce to ensure that the BCD2 file has standard file paths for the boot.wim and boot.sdi
If these paths are not 'standard', then you will get a BSOD 0xc000000f error!
See iPXE wimboot description for more details.
The big problem with this method is that the boot.ipxe configuration file cannot be passed the path of the boot.wim file by grub. Once grub chainloads the .efi boot file, all connections with grub are lost.
This means that you can only boot to one boot.wim OR you must prompt the user to enter path of the boot.wim file by adding scripting into the boot.ipxe file,
echo Please enter the full path of the boot.wim file...
and then use
initrd --name boot.wim file:$wimboot boot.wim
in the boot.iPXE menuentry...