Windows boot process and grub4dos wimboot
Windows Boot Process - BCD, Boot Process,
wimboot - boot directly to .wim file
Using wimboot from grub4dos
title Install Windows10Home32_64Aniversary - wimboot
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
kernel (hd1,0)/multiboot/wimboot
initrd @bootmgr=(hd1,0)/multiboot/Windows10Home32_64Aniversary/bootmgr @bcd=(hd1,0)/multiboot/Windows10Home32_64Aniversary/boot/bcd @boot.sdi=(hd1,0)/multiboot/Windows10Home32_64Aniversary/boot/boot.sdi @boot.wim=(hd1,0)/multiboot/Windows10Home32_64Aniversary/sources/boot.wim
(bootmgr file may not actually be required?).
How to have multiple Windows Install images
1. Use wimboot to boot from the boot.wim file
2. Ensure a \AutoUnattend.xml file inside Image #2 of boot.wim
<?xml version="1.0" encoding="utf-8" ?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>cmd /q /c "FOR %i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\multiboot\Windows10Home32_64Aniversary\remount.cmd cmd /k %i:\multiboot\Windows10Home32_64Aniversary\remount.cmd"</Path>
<Description>Launch Remount</Description>
</RunSynchronousCommand>
</RunSynchronous>
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
<Key></Key>
<WillShowUI>Always</WillShowUI>
</ProductKey>
</UserData>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>cmd /q /c "FOR %i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\multiboot\Windows10Home32_64Aniversary\remount.cmd cmd /k %i:\multiboot\Windows10Home32_64Aniversary\remount.cmd"</Path>
<Description>Launch Remount</Description>
</RunSynchronousCommand>
</RunSynchronous>
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
<Key></Key>
<WillShowUI>Always</WillShowUI>
</ProductKey>
</UserData>
</component>
</settings>
</unattend>
3. remount.cmd will map a Z: drive so that \Sources\Install.wim will be found
@echo off
cls
Set Distroname=Windows10Home32_64Aniversary
echo %Distroname%
subst Z: "%~d0\multiboot\%Distroname%"
echo mounted "%~d0\multiboot\%Distroname%" as Z:
exit
Directory structure
\multiboot\wimboot
multiboot\Windows10Home32_64Aniversary\remount.cmd
multiboot\Windows10Home32_64Aniversary\bootmgr
multiboot\Windows10Home32_64Aniversary\setup.exe
multiboot\Windows10Home32_64Aniversary\boot folder
multiboot\Windows10Home32_64Aniversary\sources folder
Injecting files
The latest version (2017+) of wimboot has the ability to inject files into the X:\Windows\System32 folder using the syntax:
initrd @xxx.bat=/special.bat
A new file X:\Windows\System32\xxx.bat will be created (or replaced if it already exists) and it's contents will be the same as that in /special.bat
This means it is possible to inject a winpeshl.ini file into the final X: volume.
The winpeshl.ini file is the first file to be executed by WinPE, so any applications you place in it will 'take over' the WinPE boot process.
For instance, if you run a .bat or .cmd file from winpeshl.ini, you could then use it to:
Find a Windows .ISO file on a USB drive in the system
Mount the ISO as drive Y: using ImDisk
Find an AutoUnattend.xml file on the USB drive
Launch X:\Setup.exe and specify the XML file for unattended installs
winpeshl.ini
[LaunchApps]
startupe2b.bat
startupe2b.bat
(code here to find DVDDRIVE (e.g. Y:), mount ISO, find USB Drive (%E2BDRIVE%) and then run Setup.exe)
%DVDDRIVE%
cd \
REM Setup.exe may be in \Sources, \x86\Sources or \x64\Sources folders...
set pp=\x86
if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" set pp=\x64
if not exist %DVDDRIVE%%pp%\setup.exe set pp=
#Run setup with XML file in root of USB drive
%DVDDRIVE%%pp%\setup.exe /Unattend:%E2BDRIVE%\AutoUnattend.xml
Direct boot from Windows Install ISOs
Here is a grub4dos menu to directly boot a Windows Install ISO from a bootable USB drive
title Install Windows10x64UK_Oct_2018 using wimboot method \n
map /Windows10x64UK_Oct_2018.iso (0xff)
map --hook root (0xff)
# the root path now points to the files inside the ISO file
# hd0,0 is the USB drive that we booted from
# (add index=1 after wimboot to boot from wim image #1)
kernel (hd0,0)/wimboot
initrd @startup.bat=(hd0,0)/startup.bat @winpeshl.ini=(hd0,0)/winpeshl.ini @bcd=/boot/bcd @boot.sdi=/boot/boot.sdi @boot.wim=/sources/boot.wim
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
#drive 0 must not be a removable drive or else Windows Setup will think it is the 'system' boot disk and refuse to install the boot files to it.
boot
wimboot will load \Windows\Boot\EFI\bootmgr.exe from the boot.wim image.