Wednesday, March 5, 2014

How to Almost Install Windows 98 natively on a real computer (not a VM)

NOTE: I never got this working all the way. It's almost there, but there's a black screen during booting. It may have something to do with driver malfunctions or incompatibilities. If anyone of you reading this was successful, please comment, and +mention me (since for some reason I don't get comment notifications from Blogger, grrr)!

My cousin and her husband have an old Dell Inspiron they've retired and wanted to use it for some retro gaming, and (free) virtual machines are still no good for that (usually).

This was actually pretty hard to do, since floppies are no more, and the Windows 98 SE CD-ROM isn't bootable. You have to solve the incredible bootstrapping problem before this whole thing comes together on a real machine, as easy as a virtual machine installation is these days.

With only a couple flash drives, a Windows 98 CD-ROM, and a laptop with its hard drive wiped, here's how I got Windows 98 working on it. (Although, I have no idea how to do this once CD-ROM drives go away entirely, since the use of a USB flash drive instead of a floppy disk proved problematic, as you'll see later.)

I'm doing this from my Macbook Pro. For this operation, you'll need:
  • Mac or Linux computer from which to start working
  • Familiarity with dd
  • Windows 98 CD-ROM (or disc image as an ISO file, written to a CD)
  • Windows 98 Boot Disk Image (a 1.5 MB file)
  • Unetbootin
  • gparted
  • 2 USB flash drives (1-4 GB is fine)

Solving the Incredible Bootstrapping Problem

First, we have to figure out how to run the Windows 98 installation on a totally empty hard drive.

Let's write that Win98 boot disk floppy image to one of the flash drives so that we can boot to it. Unfortunately I couldn't figure this out with dd, so I resorted to Unetbootin. Use it to write the floppy disk image to the flash drive. That part is pretty easy. (Sometimes it doesn't work the first time. If you have problems, try formatting the flash drive with Disk Utility as FAT32 then re-try the Unetbootin stuff.)

I'll call this flash drive the one with "DOS" on it.

Next, we need to write gparted to the other flash drive. You can do this easily, using dd:

$ sudo dd if=/path/to/gparted-live-0.16.1-1-i486.iso of=/dev/rdisk3 bs=1m; sync

Be very careful that you get the if and of options straight, and that your device number is correct (use df -h to find the right device number). As you know, you'll also need to unmount, but not eject, the drive, before using dd.

With that done, verify that the laptop's BIOS is configured to boot from a USB device before the internal HDD.

Plug the flash drive with DOS into the laptop and boot the laptop. Make sure you get a small menu asking about CD-ROM support. You can shut down the computer and remove the flash drive. (Just wanted to make sure it works.)

Plug the flash drive with gparted into the laptop and start it up. Load gparted using all the defaults (just press Enter when prompted). While it's loading, plug in the other flash drive (the one with DOS on it). When ready, open the terminal and type these commands to copy the DOS flash drive onto the internal HDD (as always, verify that the device names are correct for your case):

$ sudo su
# dd if=/dev/sdb of=/dev/sda bs=1M; sync

The of option is usually /dev/sda (because the first one is usually the internal hard disk drive).

(I experimented with resizing the partition here to fill the entire hard drive, but even though I left it at the same starting sector, it destroyed the boot property. I even tried resizing it using fdisk and format in the later step below, but that wasn't successful. I guess for now, we're just limited to the size of the flash drive that dd copies over.)

Now that the internal hard drive looks exactly like the bootable DOS flash drive (including the bootable flag), we're ready to restart the computer again. (I also added the lba flag using gparted, but I don't think it's required.)

The reason we have to do all this is because we can't bootstrap the machine directly from the flash drive into the Windows installation. Windows will only install to drive C:, but for some reason, the flash drive is seen as a non-removable drive and is considered the C: drive and the internal HDD gets bumped to D:. Then install starts and you get an error like:
Error SU0013 Setup could not create files on your startup drive and cannot set up Windows. If you have HPFS or Windows NT file system, you must create an MS-DOS boot partition. If you have LANtastic server or SuperStor compression, disable it before running Setup. See SETUP.TXT on Setup Disk 1 or the Windows CD-ROM.
It might have been SU0018 (similar) though; I don't remember exactly. I know I saw 13 somewhere, but it may have been later and on a different attempt.

Anyway, remove the flash drives and insert the Windows CD-ROM. Boot the computer, and it should (cross your fingers) load a rudimentary DOS from the internal disk, just like as if it were from your flash drive.

Installing Windows

Run:

A:\>format c:

When it's finished, give it a label like "WINDOWS". Now don't shut down the computer because we just wiped the hard drive again, and we'd have to start over.

Now run:

A:\>setup

(With some Win98 discs, you can run oemsetup instead, and I don't really know the difference.) This will launch the Windows 98 setup. First it'll do SCANDSK and probably find some errors in the hard drive. Go ahead and let it fix any of the errors it finds so that Windows setup can continue.

Let setup get to the point where it has to restart the computer. Here, I removed the Win98 disc from the CD drive because it tried to boot from it (that was a BIOS mistake on my part -- you can avoid that by booting from the HDD before the CD-ROM, but still after the USB drives), and I don't know if that caused some grief from later or what.


(TODO): Below are some notes from my foray into booting up Windows... maybe this info will help some random peruser of these things, but I haven't had a chance to organize these memos yet. Sorry!



How did I solve this? Error SU0013 Setup could not create files on your startup drive and cannot set up Windows. If you have HPFS or Windows NT file system, you must create an MS-DOS boot partition. If you have LANtastic server or SuperStor compression, disable it before running Setup. See SETUP.TXT on Setup Disk 1 or the Windows CD-ROM.


Add the following line in the [386Enh] section of the file  (WINDOWS\SYSTEM.INI)
      MaxPhysPage=30000

msmouse.vxd == hit Esc / No