Sent by Mail from Chris.

Creating a Q image file in OSX from a Windows 9x OEM Restore CD

The point of this is because I spent a deal of time trying to get Win98 to boot by installing it from FreeDOS as though I was restoring an eMachine so I could make a bootable Win98 image. Hopefully this helps others in various ways, from creating a mountable OSX image that can be used to transfer files in and out of Q without any other special software, to learning how to hack a restore CD in a real machine situation.

Here's a quick breakdown:

Disk Utility

  • new image, 670 MB
  • unmount & eject image
  • format image for DOS

Terminal

  • Rename image: .dmg > .img

Q

  • boot from CD (image as HD)

DOS

  • fdisk HD, make a primary DOS partition, Set it to active
  • reboot
  • format /s c:
  • shutdown

Finder

  • mount image
  • open restore CD's Autoexec.bat
  • find unzip & mkdir lines

Terminal

  • execute these lines with appropriate directories for OSX
  • erase unwanted files from the image as you go

Finder

  • unmount & eject image

Q

  • boot from image

Windows

  • go through setup & plug'n'play process
  • reboot
  • reboot in safe mode if it crashes, remove duplicate devices in device manager
  • reboot

Finder

  • burn image to CD as backup starting point

Here's some details for newbies:

Use Apple's Disk Utility to create an image file that will be used to copy files in and out of Q. Create a new image of whatever size you like, as read/write. uncompressed (I don't think this matters, though because the next step is re-formatting it for DOS.) I chose 670 MB because when I trim down the System, I can fit a working image of Win98 on a CD!

You must always unmount & eject the image from Disk Utility or Finder before using it in Q. You can probably get around this, but it's just safer anyways.

Now format the image for DOS in Disk Utility, then unmount & eject it again, if it mounts automatically.

For the Terminal, 'cd' to where the file is and type 'mv image.dmg image.img', image being the name you gave the image. This just changes the extension so Q will recognize it.

Load up Q and make a new guest PC or use your own and change it to boot from the restore CD and to use your new image file as the HD. (For simplicity's sake, only use one HD for now) When you run your guest PC, if your restore CD is like mine, it will ask if you want to Restore or boot to DOS. Just boot to DOS as we are only using the CD here to format your image file for use in Q.

Once DOS is booted type 'fdisk' and navigate to Create Primary DOS partition. Once you have created this, navigate to set it as the active partition. Hopefully you can figure out FDISK, as I don't have it in front of me.

You must reboot (just hit the reset button in Q).

Same thing, load DOS from the restore CD, now type 'format /s c:'. This should load the necessary files to boot from your image file using the same system that your restore CD's copy of Windows will use.

Shutdown the guest PC so you can load Windows to your image file from OSX. (You might want to try to boot from the image file now, just to make sure it doesn't give you any errors and takes you to the c:\ prompt.)

From the Finder, double click your image file to mount it. You should see a couple of files in there. (command.com, etc.). Leave these alone. Now here's the sneaky part. Open the restore CD and find it's Autoexec.bat file. You must understand the basics of DOS system commands and batch files here. Read through it and figure out what it does to load the new copy of Windows. Mine does a system check to see if it is the eMachine it was made for. I will definitely skip these lines! Then it creates the windows, progra~1, windows\options, and windows\system directories. Then it unzips about 5 different .cab files into these directories. Then it copies two files straight from the CD unzipped. I guess it uses security through obscurity.

Now you must have a basic understanding of navigation and program execution from OSX's Terminal to translate the CD's batch commands into unix commands. So it gets more particular to your restore CD here. Execute these lines with appropriate directories for OSX to unzip the .cab files into your image file. For me, I typed line by line 'unzip -od /volumes/image/windows /volumes/restoreCD/windows.cab' for each .cab file similar to the autoexec.bat file.

Erase unwanted files from the image as you go. Mine copied winstart.bat & lfnbk.exe to the windows directory. I beleive these files are crucial to format files & folders from the DOS 12 character file name limitation to the Windows 128 (or whatever) when you first start your new copy of Windows.

Finder

  • unmount & eject image

Q

  • boot from image

Windows

  • go through setup & plug'n'play process
  • reboot
  • reboot in safe mode if it crashes, remove duplicate devices in device manager. Mine loaded eMachine drivers automatically which conflicted with Q devices. Go to Control Panels, System, Device Manager, and take out duplicate Hard Drive Controllers, monitors, etc.
  • reboot

Finder

  • burn image to CD as backup starting point.