How To Install Freedos Into Linux DOSEMU

If you’re a MSDOS fan, or have some old favorite programs that you’d like to be able to run again, or have an old desktop or laptop that struggles with modern operating systems, then there is a solution.

While MSDOS isn’t supported anymore, there is an open source project with a few miles behind it that’s continuing to work on a plan to keep alive (and improve) a MSDOS compatible operating system. It’s called the Freedos project.

At this point in development, Freedos has achieved very good MSDOS compatibility, and has added some nice enhancements. Large disks can be used, and there are additional shells to use instead of the old command.com.

A large number of utilities and programs have been donated to the project by some very capable and clever programmers, and some old commercial programs have been made available by the original manufacturers.

Freedos for the Programmer
If you enjoy programming in DOS, you’ll find quite a treat in Freedos. It now includes several languages since the 1.0 distribution, and several more are available on the Freedos website. It’s far more complete than in the old days when MSDOS came only with a version of BASIC.

For ease of use, the bwbasic Bywater BASIC interpreter is in the Freedos distro. It implements a large superset of the ANSI Standard BASIC commands.

In the distro is a fast assembler called fasm. There’s also nasm, the net-wide portable assembler. The WASM Intel x86 compatible assembler is also included in the Freedos download.

A number of C compilers are available, starting with Pacific-c. This compiler is not open-source, but is now available for free use. Also included is the Watcom C and Fortran compiling system.

How about editors?

You may recall that the old MSDOS had but a couple of text editors in the distribution, including the primitive edlin and edit. You’ll be happy to know that Freedos has those and a number of other editors, some borrowed from the open-source Linux world.

For example, both the emacs and vim editors are included in the standard distribution. Additional editors are available for download at the Freedos website.

In fact, a number of other utilities borrowed from the Linux world are included in the Freedos distribution. Cal, for example, is a handy utility that puts the current, or any year and or month’s calendar at your finger tips. And handy tools like head, tail, and grep for sifting through text files are included.

But can Freedos do networking?
The short answer is: yes.

A large number of packet drivers that work with many popular network cards is included. Also included is lynx, a handy text-based network and html browser, and arachne, a complete graphics capable browser. Both of these utilities also include ftp capability as well.

So as you can see even from this brief introduction, Freedos is MSDOS on steroids. So if you have an application for MSDOS, I recommend that you consider it.

Ok, so how to I get it and install it?
You can get Freedos at Freedos.org.

From there you download an iso file that you can use to burn an installation CDROM. Installing from the CDROM to disk is fairly easy if you’ve an available partition.

I’ve also installed Freedos in a couple of Virtual Machines (VMs), including qemu and vmware. It installed easily in both of those platforms, giving me handy access to Freedos from my Debian Linux Operating System any time I want. And of course, compared to most modern systems, Freedos boots up very quickly.

I’ve also managed to install Freedos into DOSEMU, making it even faster to call up on demand.

The DOSEMU challenge.
If you’re not familiar with DOSEMU, it’s basically a virtual machine specifically designed to run MSDOS on a Linux system. Similar to the way one can call up a DOS window in Windows, using DOSEMU one can call up a DOS window in Linux.

The difference is that with a given version of Windows, only the version of DOS that comes with the Windows distribution will run in the window. With DOSEMU, virtually any DOS can be ran within a DOSEMU window.

Over the years, I’ve successfully ran MSDOS 6, DRDOS, and Freedos in a DOSEMU window. The MSDOS and DRDOS distributions had to be installed in DOSEMU, the Freedos came with the Linux distribution I was using.

Recently I wanted to upgrade the old and stripped down version of Freedos that was part of my Debian ETCH distro to the newer and fuller Freedos 1.0 distribution.

I was successful, and now with a quickly available window I can bring up a very complete and robust version of DOS.

But!

Installing the new Freedos in DOSEMU was not easy.

After failing miserably for hours, I hunted the web for instructions on how to accomplish this surprisingly difficult task.

I didn’t have a great deal of luck.

Having finally accomplishing the task, I decided to make the steps available to those others who might be interested.

Freedos In DOSEMU: The Details
I’ll list the steps in installing Freedos first, then comment on them later:

1) Go to freedos.org and download two files. The Freedos iso and a floppy boot image called fdboot.img, which you can get here.

2) Burn a cdrom with the Freedos iso.

3) Make a directory in your Linux system to hold the to-be-install Freedos.

4) Mount the cdrom containing the Freedos install cdrom.

5) Edit these variables in the dosemu.conf file. In Debian this file is in the /etc/debian directory.

$_hdimage = “freedos_install_directory /cdrom”
$_vbootfloppy = “fdboot.img”
(Note: Use full path names for the install directory and the fdboot.img)
6) Run either the dosemu or the xdosemu command. The fdboot.img will boot, try to find the cdrom, and fail. By listing the cdrom in the hdimage line of the dosemu.conf file, the cdrom will, none-the-less, be available as drive d:.

7) In the dosemu window:

d: (change to the d: drive)
cd \freedos\setup\batch
run the autorun.bat command
8) When the source/destination screen is presented, adjust destination to be c:\fdos.

9) Proceed with the installation, which will go to your newly created Freedos install directory.

Most of the steps I think are fairly self explanatory. The step 6 comment about the boot disk’s failure is about this: had the boot disk found the cdrom, it would have gotten stalled in a loop of trying to format the disk, which would keep failing in the dosemu emulator. Thus it’s best to boot from the floppy image and be able to get to a command.com prompt than to boot directly from the cdrom and get stuck in the loop.

At the boot floppy dos prompt you can go to the area on the cdrom where autorun.bat exists, and bypass the format issue. I don’t know how common the Freedos install procedure is, but on the 1.0 version I downloaded, these instructions worked for me.

Keen Designs T-Shirts and Mugs
Zazzle keendesigns

Clever Linux Tshirt
Zazzle keendesigns

Girl’s Math 101 T Shirt
Finishing up
Now that (hopefully) you’ve gotten Freedos installed, there’s a bit of setup to do.

First, go back to the dosemu.conf file and make the following changes:

Remove the /cdrom reference from the “_hdimage parameter.

Comment out the $_vbootfloppy parameter.

Now next time you run dosemu or xdosemu, you should be in your new Freedos distro.

You’d probably like to also have access to the dosemu emulator commands while in Freedos. You can do that by doing the following (in Linux) prior to your next running of dosemu:

cd to your new Freedos install directory
Make a subdirectory named dosemu
cd to the dosemu directory
cp /usr/lib/dosemu/commands/* .
You may find that the dosemu commands on your version of Linus aren’t at /usr/lib/dosemu/commands. If so, copy them from wherever they are to your new dosemu subdirectory.

You’ll want to comment out any mouse loading in the Freedos autoexec.bat file, since dosemu provides its own mouse driver.

You say you’d like Freedos networking in dosemu?
Believe it or not, you can in fact get the Freedos networking up and running in dosemu. It wasn’t easy for me, and I didn’t always get it to work. But I’ll show how I have had some success. Then you can explore the rather incredible capabilities of the arachne graphic web browser.

I would suggest that if you want a networkable version of Freedos within Linux, I’d recommend qemu dos instead.

But to proceed with networking in dosemu, you’ll need to do a bit of setup in 3 places: Linux, dosemu, and the Freedos autoexec.bat.

Networking setup on the Linux host
One of the easiest ways to get dosemu connected to a network is to use the tun/tap connection.

First, see if you have the /dev/net/tun installed. It probably already is. If not, depending upon your distribution, you need to find how to install it.

Be sure the /dev/net/tun is accessible by doing a sudo chmod 666 /dev/net/tun command.

You’ll also need to have the utility tunctl available. In Debian distributations, this is in package uml-utilities.

Then you need to set up a script to do the following commands. Just as an example, assume that your home lan network address is 10.2.2.10. Then setup the following script:

sudo tunctl -d tap0
sudo tunctl -u user_name
sudo ifconfig tap0 10.2.2.53
sudo bash -c ‘echo 1 > /proc/sys/net/ipv4/ip_forward’
sudo route add -host 10.2.2.52 dev tap0
sudo bash -c ‘echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp’
sudo arp -Ds 10.2.2.52 eth0 pub
Adjust the two addresses in the script to be compatible with your home network (remember I used 10.2.2.10 as an example). When setting up your dosemu network connection, use the address set up in the arp line.

A good additional reference for dosemu networking is Networking Using DOSEMU.

Networking setup in the dosemu.conf file
You’ll also need to configure a few setup parameters in your dosemu.conf file, as follows:

$_pktdriver = (on)
$_netdrv = “tap0”
$_vnet = “tap”
Networking setup in the Freedos autoexec.bat
Finally, you need to comment out the loading of any packet driver in the Freedos autoexec.bat file. A Freedos packet driver isn’t needed since dosemu provides one to the tap0 device.

That’s about it. Run the Linux script to setup and configure the tap0 device, then start up dosemu, and configure arachne to use the device address you assigned on the arp line of the Linux script. You’ll only need to run the tap0 setup file once after each Linux reboot.

Don’t give up if you don’t get it to work right off. Just review the instructions, and try setting up arachne again.

One interesting note. When running arachne in the dosemu engine, I found I had to hold down a shift key while a page was downloading or the download would halt. Even holding down a mouse button would work.

I think it’s an anomaly with dosemu, as a straight Freedos install and a Freedos install in qemu do not show this peculiarity.