HOW TO MAKE YOUR LINUX SYSTEM COMPATIBLE WITH DOS AND WINDOWS PROGRAMS USING ONLY FREE/OPEN-SOURCE SOFTWARE!


Copyright (C) 2004 Daniel Brodzik

This document is free software; you may distribute and/or modify it under the terms of the GNU Free Documentation License; either version 1.2 of the license or, at your option, any later version, with no Front Cover Texts, no Back Cover Texts, and no Invariant Sections.


INTRODUCTION

One thing that keeps most computer users tied to Windows is the sad fact that most software depends on DOS or Windows. While you can install FreeDOS on a separate partition to achieve DOS compatibility, there are some inconveniences that are introduced:



I think you get the idea now. Similar disadvantages appear when you have Windows installed, but add the fact that, unlike the GPLed FreeDOS, Windows is proprietary, so you have to worry about licensing as well as some of the above.


There is a great way around all this: emulators! There are two great open-source emulators for Linux that solve these problems. For DOS compatibility, you use DOSemu. For Windows compatibility, you can use Wine. Neither emulator has a dependency on any non-free/open-source software.


DOSemu is a program under the GNU General Public License that runs DOS in a special virtual machine designed for DOS compatibility without the overhead of running something like Plex86, Bochs, or VMWare that emulates an entire computer. Instead, it uses special features of the Linux kernel and the x86 processor architecture to run DOS under Linux. DOSemu emulates hardware that most DOS programs are compatible with. For example, it uses your Linux sound drivers to emulate the Sound Blaster 16. Under the X Window System, it emulates a VESA 2.0-compliant graphics card. However, on the Linux console (i.e., in text mode), you can give it direct control of your graphics card, coupled with the Sound Blaster 16 emulation and a USB joystick, to achieve the ultimate DOS environment (in terms of very good speed and perfect or near-perfect hardware compatibility) that will make it seem like your computer's hardware is very DOS compatible. DOSemu makes modern hardware (such as new sound cards and USB devices) DOS-friendly. This environment also gives DOS access to your Linux file system to eliminate the need to make a separate DOS partition. And they do all this in a fairly small download! (2.1 MB for the emulator and 1.1 MB for the FreeDOS binaries at this writing.) This is lots of fun!


Wine is a program and a set of libraries under the GNU Lesser General Public License that implement the Windows API under Linux. It has two purposes. The first is to allow easy porting of Windows applications to Linux. The second, and most common use, is to allow running of unmodified Windows executables under Linux. Wine stands for WINdows Emulator. It also stands for Wine Is Not an Emulator. Wine runs programs at a speed that is very close to the speed they run at under Windows. It also runs a few DOS programs, but DOS compatibility is not as much a priority as Windows compatibility is. Wine creates a virtual drive C and other drives to access your Linux file system. Unlike DOSemu, Wine is not a virtual machine. Instead, when working properly, Windows programs run in their own windows like any Linux program. They act like normal Linux programs. If you have Windows 9x on your system, and its partition is mounted under Linux, you can use its drive C as Wine's drive C and use its DLL's (except for the ones that have to be implemented by Wine, such as the kernel and GDI). Although I don't use Windows programs as much as I use DOS programs nowadays, I still keep Wine up to date. Currently, Wine is capable of running many complex programs like The Sims, Micro$oft Office, and my favorite Windows program, Winamp 5. (Unfortunately, Winamp's modern skins just freeze Wine, but all classic skins work.)


Here's what you will need to set these emulators up:



Please note that, during all of this, you should be logged in as a normal (non-root) user! We will become root using the 'su' command when necessary, but log in as a normal user!


Step 1: Setting up DOSemu

  1. Download all the required files and put them all in one directory.

  2. If you want GPM and/or SVGAlib support, install the development versions of those libraries.

  3. Get to a terminal window and 'cd' to the required directory.

  4. Type 'tar -zxvf dosemu-version.tgz', substituting the DOSemu version for version.

  5. Type 'cd dosemu-version', replacing version with the DOSemu version.

  6. Now, to get the FreeDOS files, type 'cp ../dosemu-freedos-version-bin.tgz ./dosemu-freedos-bin.tgz', replacing version with the FreeDOS version (not the DOSemu version). Don't forget about the Tab key! (The Tab key auto-completes file names on the command line.)

  7. Type './configure' if you don't want SVGAlib support or './configure --with-svgalib' if you do want SVGAlib support.

  8. If you get any errors about missing libraries, install the development versions of the required libraries. This should also install the regular versions of those libraries as well. If a library didn't come with your distribution, download and compile the source code for it. The source code for the library should install the development files as part of its installation process. If you need to try again, re-run configure for DOSemu.

  9. If you had no problems with running configure, type 'make'.

  10. When 'make' finishes, type 'su -c make install' and, when prompted, type your root password. Read my note after the requirements if you're not prompted for a root password!

  11. Type dosemu to see if everything was set up correctly. Follow the prompts to set up your emulated drive C.

  12. If you see a DOS prompt, you're done. If you want graphics in a window under X (which is the safest way to get graphics in DOSemu), type 'xdosemu' under X. If you want graphics on the console (which is about as fast as running DOS natively), see the next section. ('Console' under Linux usually refers to text mode, without the X Window System.)

  13. To exit, type 'exitemu'.

  14. Install programs to DOSemu. Your drive C is in ~/dosemu/freedos by default.


Step 2: Setting up DOSemu for graphics on the console (OPTIONAL)

Would you like to get fast graphics under DOSemu? Then read this section. NOTE: I must inform you that in order to allow a Linux program to directly access the hardware, such as the video card, it must be given root permissions, which is a potential security hazard. In addition, if DOSemu crashes on the console with direct video control enabled, you may lose text mode on the console and may have to blindly restore text mode or reboot. Do not do this with the Linux frame buffer enabled! If you still want to proceed, then do so, but be careful. I hereby disclaim any responsibility for your actions. In the process of figuring out the right settings, I have crashed my laptop about 30 times (and that's not an exaggeration).

  1. Become root, using 'su'.

  2. Type 'less /proc/pci'. Press / and type 'VGA' (in uppercase). In the entry for your video card, you may see a line like:

    I/O at 0xc000 [0xc0ff].

    If you don't see this in the entry for your video card, or if your video card is non-PCI and non-AGP, don't worry. Otherwise, write this line down. For example, if this line looks like the example above (which is from my laptop), write it down as '0xc000-0xc0ff'. (Note that the '0' in '0xc0ff' is a zero and not the letter O.) After you have written this down, press Q to quit.

  3. Type 'cd /etc/dosemu'

  4. Edit your 'dosemu.conf' file using a text editor such as 'ne', 'nano', 'joe', 'ee', 'jered', 'emacs', 'vi', or other console-based text editor.

  5. Look for the section labeled "## Console video".

  6. Uncomment and change the setting of both '$_console' and '$_graphics' to (1).

  7. Uncomment and change the setting of both '$_vmemsize' to the amount of video RAM you have on your system in KiB. (1 Kibibyte (KiB) = 1024 bytes. Supposedly, 1 KB now equals 1000 bytes.) To get this value, multiply your video memory in megabytes by 1024.

  8. If you have a PCI or AGP video card (which should be the case if your computer was made after 1994), uncomment and change the setting of '$_console_pci' to (1).

  9. If you had to write down the range in step 2, you will need to uncomment and edit '$_console_ports' to specify the range of port addresses you wrote down. For example, if the port addresses were 0xc000-0xc0ff, type in 'range 0xc000,0xc0ff'. This is necessary on many newer video chipsets to enable SuperVGA modes that use non-VGA registers. The BIOS normally takes care of this, but if the BIOS isn't allowed access to the registers in DOSemu, it won't work.

  10. You should be done. You shouldn't need to change the video chipset from the default of 'plainvga' because DOSemu should be able to use SuperVGA modes on your video card even if this setting is set to 'plainvga' as long as DOSemu is allowed access to enough of the video card to control it.

  11. Save and exit your editor.

  12. Type 'cd /usr/local/bin'.

  13. Type 'chmod +s dosemu.bin' to make it run with root permissions. Be careful doing this!

  14. Type 'exit'.

  15. Go to a text console (Ctrl-Alt-F1) and log in as a normal user if you weren't using the text console already.

  16. To test this, type 'dosemu'. If the screen flashes when it's starting, and the usual startup text displays, you succeeded. If you have a graphics program installed, try running it. If it worked, then everything is set up properly. If not, then try changing the settings again...


Step 3: Setting up Wine

This is quite easy to set up. It mostly involves waiting. Again, do this as a normal user! A word of caution: If you have an old version of Wine installed, make sure you uninstall it before proceeding! (For a source code version, go to the old source tree and type 'su -c make uninstall'. For a packaged version, refer to your package manager's documentation.)

  1. Install the latest version of FreeType 2. Untar the tarball and follow the directions inside (it's very easy). Make sure you use './configure --prefix=/usr' to upgrade the version that came with your operating system! (This avoids having two versions of the library installed in parallel).

  2. Untar the Wine source code. On the command line from the directory with the Wine source code, type 'tar -zxvf Wine-version.tar.gz', replacing version with the release date in YYYYMMDD format (the Japanese date format, which is the best for sorting). Note that Linux is case sensitive, and you need a capital W at the beginning of the tarball name!

  3. Type 'cd wine-version' to get to the Wine source directory. Note that this should be all lowercase, unlike the previous step!

  4. Type './configure'.

  5. Type 'make'. This will take at least an hour, so you may want to do this overnight.

  6. When that finishes, type 'su -c make install'. Enter your root password when prompted to do so.

  7. When that finishes, try running a simple Windows program with 'wine program.exe'. This will make a directory in your home directory for Wine called '.wine'.

  8. Exit the Windows program.

  9. Get to a regular Linux command line.

  10. You may want to copy the sample Wine configuration file to configure Wine manually (for example, to get native ALSA audio support). To do that, copy the file in 'path/to/Wine/source/documentation/samples/config' to '~/.wine'. Edit it if you want. If, after editing the file, Wine stops working properly, delete or rename the configuration file and try again.

  11. To configure the drives, type 'cd ~/.wine/dosdevices' and make symbolic links to the directory you wish to use for the drive's contents. For example, if you wish to use your /tmp directory for drive E: (which is recommended since E:\ is Wine's temporary file storage location), type 'ln -s /tmp e:'. If you wish to use raw device access, for drive A: (a floppy drive), for example, point 'a:' (with one colon) to '/floppy' (or whatever your first floppy drive's mount point is) and 'a::' (with two colons) to the device name, usually '/dev/fd0'. The advantage to raw access is to allow you to use a disk under Wine without having to worry about it being mounted or not. Make sure you have access permissions to the device files you need!

  12. You should now be done. Good luck!

1