How to install FreeDOS on QEMU

QEMU is a popular virtual machine system for Linux.

I run Linux on my desktop, and I prefer to boot FreeDOS in a virtual machine so I can work on FreeDOS while doing other things. I use the QEMU virtual machine because it is available everywhere and comes pre-installed with my Linux distribution. Here's how I install FreeDOS on QEMU.

Set up a virtual disk

To create a new virtual disk to install a fresh copy of FreeDOS, I might type this: (I'll make it 20MB for a "plain DOS" installation in this example, but change that to 500MB if you want to use a bigger virtual disk for a full install.)

$ qemu-img create -f qcow2 freedos.qcow2 20M

Install FreeDOS on the virtual disk

To install FreeDOS with the LiveCD, you need to "build" a virtual machine with some memory, and configured with at least the LiveCD and the virtual disk. Don't forget to use KVM or it will be really slow:

$ qemu-system-i386 -enable-kvm -m 32 -cdrom FD14LIVE.iso -hda freedos.qcow2 -boot order=d

This configures the virtual machine with 32MB memory, and uses the FreeDOS 1.4 LiveCD and the virtual hard disk. The -boot order=d tells QEMU to boot only from the CD drive (which is always referred to in the order= option as d .. the first hard disk is always referred to as c .. the first floppy is always referred to as a .. the network is always referred to as n). You can give -cdrom and -hda in either order.

Go through the usual FreeDOS installation process. When the install is finished, use the "Return to DOS" option and type shutdown at the DOS prompt inside FreeDOS to stop the virtual machine.

Running FreeDOS on QEMU

Now that you've installed FreeDOS, anytime you want to run FreeDOS, you start QEMU by booting from the virtual disk. You can optionally configure the machine to use the LiveCD or the BonusCD, so you can use FDIMPLES to install other packages. Here's the command line to use the LiveCD, but boot from the virtual disk:

$ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom

You can use other options too. For example, to use the Linux local time as your virtual machine time, add the -rtc option like this:

$ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom FD14LIVE.iso -boot order=c -rtc base=localtime FD14LIVE.iso -boot order=c

Here's the full QEMU command line that I use when I boot FreeDOS after I install it. This has a bunch of other options, such as to support sound and to use a second virtual disk as my D: drive.

$ qemu-system-i386 -enable-kvm -m 32 -rtc base=localtime -audiodev pa,id=snd -machine pcspk-audiodev=snd -device sb16,audiodev=snd -device adlib,audiodev=snd -hda freedos.qcow2 -hdb files.qcow2 -cdrom FD14LIVE.iso -boot menu=on