By using the QEMU emulator, you can run FreeDOS inside a window on a host operating system. QEMU will emulate a typical x86 PC so that FreeDOS can run. FreeDOS is mostly compatible with MS-DOS, so you will be able to use FreeDOS and QEMU to run some old MS-DOS programs. You could even put FreeDOS and QEMU on your Apple Macintosh.

This howto will guide you through the process of installing FreeDOS within QEMU.

Preconditions[edit | edit source]

  • Your computer can run QEMU.
    • There are ports of QEMU to both Microsoft Windows and Mac OS X.
    • You can also run QEMU on Unix (including BSD and Linux) but only if QEMU supports your processor architecture. QEMU can run on x86, x86_64 (also known as AMD64), and PowerPC machines, and possibly others; check the status page.
  • You have installed QEMU.
  • You know how to use the command line (or if you have it, a QEMU graphical user interface) on your computer.

Download FreeDOS[edit | edit source]

First obtain a copy of FreeDOS.

  1. Visit http://www.freedos.org/freedos/files/
  2. Follow the instructions and download fdbootcd.iso
    • Make sure to obtain the newest version (as of this writing, Beta9 Service Release 2).
  1. Put fdbootcd.iso in an empty folder with plenty of disk space. You do not need to burn it to CD!

Create disk images[edit | edit source]

Now we need to create drive A and drive C for FreeDOS. From the command line, cd into the directory with your fdbootcd.iso, and use the following commands:

after cd to the directory with fdbootcd.iso
$ qemu-img create a.fd 1440K
Formating 'a.fd', fmt=raw, size=1440 kB
$ qemu-img create c.hd 100M
Formating 'c.hd', fmt=raw, size=1048576 kB

(One hundred megabytes, 100M, should be plenty for drive C, but you can use more or less if you want.)

Boot from CD, run FDISK[edit | edit source]

Now use QEMU to boot the CD for installing FreeDOS onto drive C. (We ignore our drive A for now.)

$ qemu -hda c.hd -cdrom fdbootcd.iso -boot d

FreeDOS CD bootstrap

Just press ENTER or choose option 1 to start booting the CD.

FreeDOS boot menu

Just press ENTER or choose option 1 (again) to pick the "Load XMSdriver" option and continue booting.

Option to run FDISK

Now our new "c.hd" has no data on it, so FreeDOS correctly suspects that you need to format the disk. Choose option 1 to start FDISK. (You must use FDISK to create a partition for drive C before you can create a filesystem.)

Do you want to use large disk (FAT32) support (Y/N).[Y]?

The default option of "Y" is okay here.

The FDISK menu

Choose option 1 to create a partition.

Choice of partition

Choose option 1 for the "Primary DOS Partition". (FDISK supports up to four primary partitions. If you want more, then you would create three primary partitions and one extended partition, then add logical drives to the extended partition.)

Choice to make one large partition

The easiest thing to do now is to say "Y" to make one large partition. (The partition that you install FreeDOS onto must be active so that it boots.)

You have a partition

Now that your disk has a partition for drive C, press Escape twice to exit FDISK. The system will reboot.

Boot from CD, run SETUP[edit | edit source]

As before, choose option 1 (twice) to boot FreeDOS Setup and Load XMSDriver.

Format drive C?

Now that drive C has a partition, you must still format the disk, which creates a FAT filesystem on it. Answer YES.

At this point, FreeDOS formats drive C. (One can put files in C:\ now.) The installer now begins. If you choose option 0 or wait 5 seconds, the installer will proceed to install FreeDOS from the CD.

Installer menu

From the menu, choose option 1 to "Configure FreeDOS installation settings".

Second installer menu

Then choose option 1, "Start installation of FreeDOS beta9". (Optionally, you could adjust the other settings.)

"DETAILED INSTALLATION INSTRUCTIONS"

Eventually you will reach the "DETAILED INSTALLATION INSTRUCTIONS". They are outdated. You can ignore them. Just press Escape.

Where to install FreeDOS?

For the install location, enter C:\FDOS so that the screen looks like this:

Installing to C:\FDOS

Now allow the FreeDOS installer to proceed. If it stops at an error like the following:

Error interrupting the install

Just say "Yes" to continue installing. This error involving MODE.COM does not prevent your FreeDOS install from working.

Allow the installation and the post-installation steps to finish.

Boot the hard disk[edit | edit source]

After the installation, the installer will reboot your computer. However, in this QEMU configuration, any attempt to boot the hard disk will stop at the following screen:

Error booting hard disk

This is a unique problem caused by running FreeDOS in an emulator instead of a hard disk. The FreeDOS kernel sees that there are no disks before C and moves drive C to drive A. (The FreeDOS installer uses drive A for something else, which is why you had to install onto drive C.) Then it stupidly fails to find the system on drive C; the Command Interpreter is at A:\COMMAND.COM now.

The best way to fix this is to close QEMU. Now start QEMU again, but this time put the disk image a.fd into drive A while leaving out the CD:

$ qemu -fda a.fd -hda c.hd

Unfortunately, now if you boot the system, AUTOEXEC.BAT might crash the QEMU emulator on a MODE command.

Fixing AUTOEXEC.BAT[edit | edit source]

You can bypass AUTOEXEC.BAT by choosing "3 - Load FreeDOS without drivers" from the boot menu. If necessary, close QEMU and restart it again (with qemu -fda a.fd -hda c.hd), then choose option 3 when booting. You will reach the FreeDOS shell:

C:\>

Since it loaded no drivers, you might as well load the mouse driver. QEMU emulates a PS/2 mouse. To load the driver:

C:\>mouse

CuteMouse v1.9.1 alpha 1 [FreeDOS]
Installed at PS/2 port

Now edit the C:\AUTOEXEC.BAT file. (DOS is case insensitive and the current directory is already C:\ so autoexec.bat is the same file.)

C:\>edit autoexec.bat

This opens the editor. (You might notice that the clock in the lower-right is running in UTC time.)

Editing AUTOEXEC.BAT

Scroll down to "MODE CON..." line and comment it by prepending "REM ", like this:

AUTOEXEC.BAT with MODE commented

Now save the file and exit the editor. (You should be able to use the mouse with the File menu; you may need to first click the window for QEMU to grab the mouse and move the DOS mouse cursor.)

C:\>

Back at the prompt, you can safely close your QEMU window. (This is the equivalent of flipping the power switch on a real DOS computer. DOS does not require you to sync the disks, unmount the filesystems, or use a command to halt the system.) Use qemu -fda a.fd -hda c.hd again to restart the system.

If option 1 "with maximum RAM free, using EMM386" does not work, you should now be able to boot FreeDOS with option 2 "including HIMEM XMS-memory driver". Using option 1 or 2 will automatically load all of the normal drivers, including the mouse driver.

Booting your system for normal use[edit | edit source]

To boot your installed FreeDOS system for normal use:

cd to the directory with a.fd and c.hd
$ qemu -fda a.fd -hda c.hd
choose option 2, "including HIMEM XMS-memory driver"

Links[edit | edit source]

From time to time, you might want to copy files between FreeDOS and the host system. To do this, you might want to mount a raw disk image:

From HowTo Wiki, a Wikia wiki.

Community content is available under CC-BY-SA unless otherwise noted.