Have legacy software that can't run in Wine or on newer versions of Windows? If you have a Windows 98 installation disc, you can install the operating system to a QEMU virtual machine. The CD should be for generic systems. If you got your copy from an OEM (like HP or Dell), they may not have included drivers that QEMU may need.
Virtual machine setup
If the CD included a boot floppy, you may need to use it; some CDs were not be designed to boot directly and only contain the materials needed to install the operating system. If you only have an unbootable CD, FreeDOS can be installed first in its place, and it can run the setup. You will want to rip your Windows 98 CD to an ISO image. Assuming it's been named
win98.iso and placed in the same folder, it can then be ejected and stored back in its case.
You will need to create the image for the hard drive. This is where you'll install Windows to, and we'll be using QEMU's native
qcow2 format. Common sizes are 512 MB (
512M) and 1 GB (
1G), but anything over 2 GB may prompt the setup to ask about large file system support, which you'll want to allow in that case.
qemu-img create -f qcow2 w98.cow 512M
Something interesting to note is that if your host system has enough memory to store the entire image in RAM, the installation and usage can be greatly sped up. On Windows, this can be done with ImDisk Virtual Disk Driver when mounting a raw image file and copying the image to the mounted drive.
qemu-system-x86_64 -cdrom win98.iso -boot order=d -drive file=w98.cow -m 512 -device sb16 -display sdl
-cdromallows us to use the ISO image. It's also possible to use
virshto forward a physical drive to a file, but reading the data from the hard drive is usually faster.
-bootallows us to specify the
orderto d, which is the CD.
-driveallows us to use the image we just created.
-enable-kvmturns on hardware acceleration in x86 using the kernel VM. KVM causes problems on Windows hosts when shutting down the guest and can even prevent it from starting in some cases. If this occurs, you can safely remove it from the command.
-mallocates the guest's RAM. In this case we use 512, but going above it can be dangerous for Windows 9x.
-deviceallows us to add a device driver, in this case, the Creative SoundBlaster 16 sound card (
sb16) to get audio. Standard Windows 98 discs ship with drivers for it, and if you haven't used this flag while installing, it would need to scan for it.
-displayallows us to use an alternative display engine rather than GTK+. In this case, we use Simple DirectMedia Layer because it doesn't conflict as much with fullscreen support. You can press Ctrl+Alt+F to enter and exit fullscreen mode and Ctrl+Alt to have QEMU grab or ungrab the keyboard input and invoke the monitor as usual.
By the end of the installation, you will boot without the CD, meaning the
-boot flags can safely be removed.
SE may fail to shutdown properly before installing Q239887 update (004756us8.exe), degrading the filesystem.
VBE 2.0 compliant-driver
Some programs require a higher color depth than the 16 colors provided by Windows 98 by default.
The default graphics card emulated by QEMU supports 32-bit color depth and resolutions through VBE 2.0, but Windows 98 does not provide drivers that support this.
A non-commercially licensed freeware driver can be used.
See this snapshot of a 2006 archive for DirectX downloads.