- Install the Recovery Console or, alternatively, use the batch file found here to create the RC directory structure
D:\i386>winnt32 /cmdcons
- Get DD for Windows by Chrysocome and John Newbigin
- Get QEmu
- Get ImDisk or VDK
- Get GRUB4DOS
- Get WinVBlock
- Get TinyHexer
- Create a large enough HDD image (I found 24,675,840 bytes adequate; that's 48195 512-byte sectors)
C:\Program Files\QEmu>dd if=/dev/zero of=CMDCONS.HDD count=48195 --progress
- Use QEmu to partition and format the image
C:\Program Files\QEmu>qemu -fda w98_cmd.vfd -hda CMDCONS.HDD -boot a
where w98_cmd.vfd is a Windows 98 DOS floppy with fdisk and format on it. - FDISK the HDD
- Control-Alt-2 to switch to QEmu's monitor
- system_reset to reboot the VM
- Control-Alt-1 to switch to the VM's console
- FORMAT C: to format with FAT
- SYS C: to allow the HDD to boot DOS
- Control-Alt-2 to switch to QEmu's monitor
- quit to quit QEmu
- Use ImDisk to attach the FAT filesystem in the HDD image (63 * 512 = 32256)
C:\Program Files\QEmu>imdisk -a -t file -f CMDCONS.HDD -b 32256 -m m:
- OR you could use VDK to attach the HDD image
C:\Program Files\QEmu>vdk open 0 CMDCONS.HDD /rw
- Copy CMLDR into the filesystem as NTLDR
C:\Program Files\QEmu>attrib -s -h -r c:\cmldr C:\Program Files\QEmu>copy c:\cmldr f:\NTLDR
- Copy NTDETECT.COM into the filesystem
C:\Program Files\QEmu>attrib -s -h -r c:\ntdetect.com C:\Program Files\QEmu>copy c:\ntdetect.com f:\
- Copy GRUB4DOS into the filesystem
C:\Program Files\QEmu>copy grub.exe f:\
- Copy the rest of the Recovery Console into the filesystem
C:\Program Files\QEmu>xcopy /e /h c:\cmdcons f:\cmdcons\
- Copy the WinVBlock driver into the Recovery Console
C:\Program Files\QEmu>copy c:\windows\system32\drivers\ndis.sys f:\cmdcons C:\Program Files\QEmu>copy wvblk32.sys f:\cmdcons
- Hack its startup into TXTSETUP.SIF
[SetupData] ... OsLoadOptions = "/fastdetect /noguiboot /nodebug /WINVBLOCK=BUS=1" ... [SCSI.Load] ... wvblk32 = wvblk32.sys,4 ... [SCSI] ... wvblk32 = "WinVBlock" ... [BootBusExtenders.Load] ndis = ndis.sys ... [BootBusExtenders] ndis = "NDIS" ...
- Detach the disk image with ImDisk
C:\Program Files\QEmu>imdisk -d -m m:
- OR you could detach with VDK
C:\Program Files\QEmu>vdk close 0
- Open the HDD image with TinyHexer. File -> Disk -> Open disk image or large file as drive... -> CMDCONS.HDD
- Goto the filesystem's boot sector. File -> Disk -> Goto sector/position... -> 63
- Hack cmdcons\0 ('\0' means an ASCII NUL byte) into the boot-sector; 8 bytes starting at 0x3 (4th byte)
- Write the changes and quit TinyHexer
- Invoke QEmu
C:\Program Files\QEmu>qemu -hda CMDCONS.HDD -boot c
- Windows 98 DOS should boot in the VM. Run GRUB4DOS
C:\>grub
- Choose or wait for the CLI, then chain NTLDR
grub> chainloader (hd0,0)/ntldr grub> boot
- The Recovery Console should start. Using its CLI, you can now fix the FAT boot-sector to be NT-style and reboot the VM
C:\>fixboot blah blah really? y blah blah done C:\>exit
- The image is now complete. Enjoy.
How to enjoy instantly with QEmu:
C:\Program Files\QEmu>qemu -kernel memdisk -initrd CMDCONS.HDD -hda garbage.hdd
How to enjoy with PXELINUX 3.71 (or newer) and MEMDISK 3.84 (or newer; best to use the one included in WinVBlock):
Directory layout:
/tftpboot/ /tftpboot/pxelinux.cfg/ /tftpboot/pxelinux.cfg/default /tftpboot/memdisk /tftpboot/CMDCONS.HDD
/tftpboot/pxelinux.cfg/default goes:
DEFAULT cmdcons LABEL cmdcons KERNEL memdisk INITRD CMDCONS.HDD
- Shao Miller