115 - Convert a WinPE 'Flat-File' ISO to a ramdisk (boot.wim) ISO

Most WinPE bootable ISOs boot by loading the OS files into a ramdrive (e.g. X:). Most of the OS files are in the boot.wim file and the contents of this file are loaded into the ramdrive. This type of ISO can be easily booted directly from the ISO file, using a bootloader/manager such as grub4dos or syslinux or grub.

However. some bootable ISO files (e.g. older versions of ESET SysRescue CD) are also based on WinPE v2 or v3 or v4 (Vista/7/8) but these have a 'flat file' WinPE structure. This means that when PE boots, the files are directly located on the USB drive, CD or DVD. This has the advantage that it can be used on systems with less than 512MB of memory (RAM).

Unfortunately, it also means that we cannot directly boot from this type of ISO file (e,g, an .iso file on a grub4dos USB drive or Easy2Boot USB drive) - when the OS boots, it expects to see the files on the USB drive instead of inside an ISO file and so we get a nice BSOD!

What we need to do, to make it work on a multiboot USB drive, is convert the ISO from a 'flat file' structure to a 'ramdisk' structure.

Example 'flat file' ISO:

\BOOT

\PROGRAM FILES

\PROGRAM DATA

\USERS

\WINDOWS

BOOTMGR

Example 'ramdisk' ISO

\boot

\efi

\sources - contains boot.wim

bootmgr

You can re-build the ISO as a WinPE boot.wim file by following the instructions below.

Requirements

1. A WinPE ISO or DVD or CD that boots using a ramdisk (boot.wim) - a good source is the Windows 7 Install DVD ISO which can be downloaded. We need

\boot\bcd

\boot\boot.sdi

If you haven't got one of these ISOs - see Tutorial 83 - Download the WinPE.WIMs and WAIK Help files

2. oscdimg.exe - a Microsoft utility to make ISO files - see Tutorial 83

3. imagex.exe - a Microsoft utility to make .wim files - see Tutorial 83

4. etfsboot.com - a file used to make a bootable WinPE ISO - can be found on many WinPE ISOs (usually in the \boot folder), included in the Win7 Install ISO

5. Lastly we need the ISO file that you want to convert to a ramdisk version - I will assume this is called SysRescue for the purposes of the Procedure below:

Procedure

1. Find a bootable WinPE ISO or project that has a \sources\boot.wim file (I recommend the Win 7 Install ISO if you have it).

We need to copy the whole \boot folder from this. We need the BCD file (for WinPE ram booting) and boot.sdi file (and maybe the font files).

I will assume that you have the Windows Vista/7/8 Install ISO and have used 7Zip to extract the files.

We need these 3 files:

\boot\bcd

\boot\boot.sdi

etfsboot.com (usually in the \boot folder)

2. Extract the SysRescue ISO files to an empty folder (say C:\temp\SR) on your hard disk using 7Zip

3. Delete the C:\temp\SR\BOOT folder and the [BOOT] folder if present.

4. Make a boot.wim file using the imageX command as follows:

imagex /boot /capture C:\temp\SR C:\temp\boot.wim "My new wim file"

P.S. When using ImageX - make sure you specify /boot - this is most important!

5. Make a new folder (C:\temp\SRISO) and copy the new boot.wim file to C:\temp\SRISO\SOURCES\boot.wim

4. Copy the WinPE \BOOT folder found in Step 1 to the C:\temp\SRISO\ folder (C:\temp\SRISO\BOOT\BCD and C:\temp\SRISO\BOOT\boot.sdi should now be present)

Normally, only a few files are needed. Copy them all to start with, then once you have the new ISO built and working, try deleting the font folder and other files. We always will need BCD and boot.sdi though!

5. Make sure you have the bootmgr file in the C:\temp\SRISO\ folder - the folder should look like this:

\bootmgr

\boot\bcd (from the Win7 Install ISO)

\boot\boot.sdi

\boot\font folder (may be optional?)

\sources\boot.wim (made from the original SysRescue ISO)

Tip: If the \boot\bootfix.bin file is present then delete it or you will be prompted to 'Press Enter to boot from the CD/DVD' every time it boots. Other files such as bootsect.exe or memtest.exe or etfsboot.com are not required in the boot folder.

At this point we could use oscdimg.exe to make a bootable ISO, however I like to check it all works first, but skip to Step 7 if you just want to make the ISO now without testing it.

6.1. Use RMPrepUSB to format a spare WinPE/BOOTMGR bootable FAT32 or NTFS USB flash drive.

6.2. Copy the contents of the C:\temp\SRISO folder to the root of the flash drive and check that it boots using the F11 button in RMPrepUSB to run QEMU (or boot from the USB flash drive on a real system).

Of course, the ISO will need at least 512MB+ of memory to boot in, whereas the old flat-file ISO would not have needed anywhere near as much.

If you think there are unnecessary files in the \boot folder, rename them and try booting again. If it still boots OK, then you can delete them.

7. Make a new ISO using oscdimg as follows:

oscdimg -n -m -o -bc:\temp\etfsboot.com C:\temp\SRISO C:\temp\mynewSysRescue.iso

to make the ISO file.

Note that etfsboot.com file can be anywhere in your system (wherever you have stored it).

Use RMPrepUSB - Boot from ISO (Ctrl+F11) and make sure it boots correctly.

The new ISO should boot now if using Easy2Boot. However, if the original ISO contained some non-Windows folders in the root of the ISO (e.g. \PROJECT or \UTILITIES) then you may need to extract these and copy them to the root of you USB boot drive. If you are using Easy2Boot, rename the .iso file to .isoPE01 and if booting from an E2B USB flash drive, the ISO will be automatically mounted as drive Y: once WinPE boots - the code should then be able to find the special folders without them needing to be copied to the USB drive first (you must test this on a real system, it won't work under a VM).

As an alternative you can make a WinPE boot ISO directly from the USB flash drive (etfsboot.com is not required).

  • Run RMPrepUSB (v2.1.714 or later) and install grub4dos to the USB Flash drive using the Install grub4dos button (Y=MBR)

  • Press F4 and create a menu.lst file containing just one line of text

  • chainloader /bootmgr

  • Test it by pressing F11 to boot using QEMU - then quit QEMU.

  • Type Ctrl+M to make the ISO from the USB drive

Tip: This process uses the mkisofs.exe utility in RMPrepUSB - if you add oscdimg.exe to the QEMU folder of RMPrepUSB, the Ctrl+M function will use oscdimg instead of mkfsiso. Try this is you are experiencing problems booting the WinPE ISO when using mkisofs.

Troubleshooting

1. Don't forget the /boot switch in the ImageX command line!

2. If you get a BCD BSOD, check that you have used the correct \boot\BCD file - it must be from a 'ramdrive' version of WinPE.

3. Check that \boot\boot.sdi file exists

4. If the original ISO had some non-windows folders in the root, you may need to copy these to the root of the USB drive before booting from .ISO will fully work (depends on the way it has been coded).

You can edit the BCD using EasyBCD, perhaps to remove the timeout or skip the boot menu. Use the File - Select BCD Store - select the \boot\bcd of your SRISO folder.