Creating a RAM Loading Windows PE (XP and 2003 Based)
It has been possible to boot Windows XP/2003 based PE builds from RAM for some time, by use of ramdisk.sys and setupldr.bin files from Windows Server Service Pack 1 source. This method has some limitations including a maximum image size of approximately 500 MB, and the possible licensing legalities of using these files. Firadisk provides a freely available method for RAM booting PE disks and overcomes the 500 MB disk image limit.
To manually add firadisk to a windows PE build and boot from a hard disk or superfloppy type disk image -
- Disable File Based Write Filter (FBWF) plugins. FBFW is not required as the systemdrive will be writable (any free space on the disk image can be written to once PE has booted)
- The following was tested with another RAM drive plugin enabled - no issues were noted. Remember that RAM disk plugins will probably add temp, tmp and ramdrv environment variables to the registry - these will be overwritten in step 5
- Build PE and copy the output files to directory C:\pe\
- Add the following to C:\pe\i386\txtsetup.sif
- Mount the registry hive C:\pe\i386\system32\setupreg.hiv as HKLM\firadisk using the following command -
reg load HKLM\firadisk C:\pe\i386\system32\setupreg.hiv
- Add the following registry settings to the mounted registry hive (Note - the last three entries in the HKLM\firadisk\ControlSet001\Control\Session Manager\Environment key will set temp, tmp and ramdrv environment variables as drive X: - all files normally written to a ramdrive will therefore use the systemdrive instead) -
- Unmount the registry hive C:\pe\i386\system32\setupreg.hiv using the following command -
reg unload HKLM\firadisk
- Copy firadisk.inf to C:\pe\i386\inf\ directory
- Copy firadisk.sys to C:\pe\i386\system32\drivers\ directory
- Follow the instruction here to create disk image C:\my_disk.ima - the image must be large enough to hold the PE files with additional space to use as a RAM drive
- Mount the disk image C:\my_disk.ima as drive R: using ImDisk -
- For superfloppy type disks use command -
imdisk.exe -a -f C:\my_disk.ima -m R: [enter]
- For hard disk type disks use command -
imdisk.exe -a -f C:\my_disk.ima -m R: -b 32256 [enter]
- Copy all files and folders from C:\pe\ to R:
- Edit R:\i386\setupldr.bin to replace the minint path (this is the default path when booting PE from a hard disk (image)) with i386. Use the command-line tool gsar.exe - add the following text to notepad and save with a .cmd file extention in the same directory as gsar, then run the .cmd file (you might need to change the R:\i386\setupldr.bin file attributes to ensure that the file is not read only). The batch file has been taken from a post by 911cd forum member cdob (see here).
- Move R:\i386\ntdetect.com to the root of the R: drive
- Move R:\i386\setupldr.bin to the root of the R: drive and rename as ntldr
- Unmount the disk image using the following command -
imdisk -d -m R:
- Add an entry to menu.lst -
Warning - some plugins may use a hardcoded path for drive B: (the default setting for a RAM drive on BartPE and possibly other PE builds). If a RAM drive is not used these applications will not function correctly.
The following was tested using a minimal BartPE build with nu2shell and nu2menu plugins enabled. I have tested it with the included RAM disk plugin, however you should be aware that this may overwrite the temp, tmp and ramdrv environment variables set in the firadisk plugin.
Create a folder in the pebuilder plugins directory (e.g. C:\pebuilder\plugins\firadisk\) and create empty text file firadisk.inf in it. Create subfolder files (e.g. C:\pebuilder\plugins\firadisk\files\) and copy the firadisk drivers (firadisk.inf and firadisk.sys) to it.
Copy and paste the following text to C:\pebuilder\plugins\firadisk\firadisk.inf
Run pebuilder to create the PE build and then follow steps 3 and 10 - 12.
A winbuilder script by oriensol is available here
Thanks to joakim for identifying the registry and txtsetup.sif entries (see here)