{"id":5612,"date":"2024-06-10T03:00:00","date_gmt":"2024-06-10T07:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=5612"},"modified":"2024-06-01T12:04:27","modified_gmt":"2024-06-01T16:04:27","slug":"running-freedos-on-linux","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=5612","title":{"rendered":"Running FreeDOS on Linux"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"5612\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">3    <\/span>\r\n<\/div><\/div>\n<p>FreeDOS is a great little operating system. FreeDOS is an open source implementation of DOS, the original operating system for the IBM Personal Computer. Like any DOS, FreeDOS is a fairly simple operating system with few moving parts, relying only on an Intel-compatible CPU and a BIOS (the <em>Basic Input\/Output System<\/em>).<\/p>\n\n\n\n<p>Unfortunately, the BIOS requirement also means that you cannot run FreeDOS on actual hardware built after about 2020. That\u2019s when the PC industry largely dropped support for \u201cLegacy\u201d mode in UEFI; \u201cLegacy\u201d mode provided BIOS services for operating systems like DOS.<\/p>\n\n\n\n<p>But you can run FreeDOS on your Linux system, using a <em>virtual machine<\/em> or a <em>PC emulator<\/em>. Here\u2019s how I boot FreeDOS on my Linux desktop machine using QEMU. QEMU should be available on every Linux distribution; I am running Fedora Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"downloading-freedos\">Downloading FreeDOS<\/h2>\n\n\n\n<p>The original DOS operating system in the 1980s and 1990s was only available as a set of floppy disks, but FreeDOS is also a modern DOS, including many open source applications and tools not found in the original DOS. To accommodate everything, FreeDOS is available as a CD-ROM distribution.<\/p>\n\n\n\n<p>The FreeDOS distribution is actually a \u201cLive CD\u201d distribution, meaning you can boot the CD and run FreeDOS directly. The LiveCD doesn\u2019t include everything, so most people usually install the full FreeDOS distribution instead.<\/p>\n\n\n\n<p>Let\u2019s start by downloading a copy of FreeDOS. Visit the <a href=\"https:\/\/www.freedos.org\/\">FreeDOS website<\/a> in your web browser and click on <a href=\"https:\/\/www.freedos.org\/download\/\">Download FreeDOS 1.3<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"258\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-www1.png\" alt=\"\" class=\"wp-image-5614\"\/><\/figure>\n\n\n\n<p>This will bring you to the \u201cdownload\u201d page that contains different ways to download FreeDOS, depending on your system. To boot and install FreeDOS in a virtual machine, you will need the \u201cLiveCD\u201d image. Click the big blue button to download it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"540\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-www2.png\" alt=\"\" class=\"wp-image-5615\"\/><\/figure>\n\n\n\n<p>The \u201cLiveCD\u201d is actually provided in a zip file that also contains a \u201cReadme\u201d file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ unzip -l FD13-LiveCD.zip \nArchive:  FD13-LiveCD.zip\n  Length      Date    Time    Name\n---------  ---------- -----   ----\n  1474560  02-20-2022 00:03   FD13BOOT.img\n419573760  02-20-2022 00:03   FD13LIVE.iso\n     6521  02-20-2022 00:03   readme.txt\n---------                     -------\n421054841                     3 files<\/code><\/pre>\n\n\n\n<p>You can extract the zip file to get everything, or you can just extract the CD image with this command line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ unzip FD13-LiveCD.zip FD13LIVE.iso\nArchive:  FD13-LiveCD.zip\n  inflating: FD13LIVE.iso<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"system-emulation-with-qemu\">System emulation with QEMU<\/h2>\n\n\n\n<p>QEMU (the \u201cQuick EMUlator\u201d) can emulate a variety of systems and architectures, including the Intel i386 line of CPUs used in the DOS era. Because QEMU emulates the hardware for the \u201cguest\u201d operating system, that means you can use QEMU to boot FreeDOS on Linux, and FreeDOS will \u201cthink\u201d it is running on real hardware.<\/p>\n\n\n\n<p>But QEMU is not a graphical program where you can click buttons and select menus to set up a virtual machine. Instead, you need to use the command line to define everything under QEMU. Fortunately, QEMU provides a lot of standard virtual devices by default, including many that were common for DOS machines, including Cirrus Logic CL-GD5446 VGA card, PS\/2 keyboard and mouse, IDE interfaces for hard drive and CD-ROM, floppy disk, network, and serial ports. You can also define a SoundBlaster 16 sound card, AdLib music card, and other common peripherals.<\/p>\n\n\n\n<p>Let\u2019s start with the basic command line first. Type this to start QEMU as an i386 machine with 32 MB of memory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-system-i386 -m 32 <\/code><\/pre>\n\n\n\n<p>This doesn\u2019t specify any drives, neither hard drives nor CD-ROM, so it won\u2019t actually boot &#8211; it unsuccessfully tries to boot from several media including the network &#8211; but you can see that it is doing <em>something<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/qemu-boot1.png\" alt=\"\" class=\"wp-image-5616\"\/><\/figure>\n\n\n\n<p>Use the <strong>Machine &gt; Quit<\/strong> menu action to close the QEMU window.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"booting-freedos-in-qemu\">Booting FreeDOS in QEMU<\/h2>\n\n\n\n<p>Let\u2019s add to the QEMU command line to define the LiveCD image as the CD-ROM drive:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-system-i386 -m 32 -cdrom FD13LIVE.iso <\/code><\/pre>\n\n\n\n<p>This boots the LiveCD in the virtual machine. You should be greeted by the FreeDOS 1.3 LiveCD boot menu, which lets you boot into a \u201cLive Environment Mode\u201d with a minimal version of FreeDOS, or boot from the system hard disk, or install to the hard disk:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/qemu-boot2.png\" alt=\"\" class=\"wp-image-5617\"\/><\/figure>\n\n\n\n<p>If you hit Enter on the first menu option, you\u2019ll boot FreeDOS into the Live Environment.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/qemu-boot3.png\" alt=\"\" class=\"wp-image-5618\"\/><\/figure>\n\n\n\n<p>Note that 32 MB is a lot of memory for DOS systems in the 1990s, but it\u2019s not quite enough to hold the minimal in-memory installation of FreeDOS, so you will see a warning message in yellow. The warning message just indicates that, with only 32 MB of memory, FreeDOS will run from the CD-ROM filesystem, instead of using a copy of FreeDOS that would have been extracted into memory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"improving-performance\">Improving performance<\/h2>\n\n\n\n<p>The Linux kernel supports an advanced feature called <em>KVM<\/em> or <em>Kernel-based Virtual Machine<\/em>, which allows \u201cguest\u201d operating systems to run at near-native speeds.<\/p>\n\n\n\n<p>Let\u2019s update the QEMU command line one more time to enable KVM support:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-system-i386 -enable-kvm -m 32 -cdrom FD13LIVE.iso <\/code><\/pre>\n\n\n\n<p>KVM requires that the \u201chost\u201d system type is the same as the \u201cguest\u201d system type, such as running an \u201cIntel\u201d virtual machine on Intel hardware. If the underlying hardware is a different architecture, like ARM for Raspberry Pi, you will not be able to use KVM. This may slow down the virtual machine noticeably &#8211; but look at this way: even when booting FreeDOS with QEMU on a Raspberry Pi, the virtual machine shouldn\u2019t run any slower than running on a DOS-era \u2019486 or Pentium machine. And for DOS, that\u2019s still fast.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-freedos\">Installing FreeDOS<\/h2>\n\n\n\n<p>Running FreeDOS in this way means you are limited to the read-only environment of the LiveCD. If you want to do more with FreeDOS, you will need to <em>install<\/em> it. To install, you\u2019ll need a <em>target<\/em> hard drive, which you will need to define as a virtual hard drive. QEMU provides the <code>qemu-img<\/code> command to do that for you.<\/p>\n\n\n\n<p>The <code>qemu-img<\/code> command can create virtual disk images in several formats, including raw, VDI, VHDK, and QCOW2. I prefer the QCOW2 format. Use this command to define a 500 MB virtual hard disk called <code>freedos.qcow2<\/code> using the QCOW2 virtual disk format:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-img create -f qcow2 freedos.qcow2 500m\nFormatting 'freedos.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=524288000 lazy_refcounts=off refcount_bits=16<\/code><\/pre>\n\n\n\n<p>To use this in a QEMU virtual machine, you need to add it on the command line as the first or <em>primary<\/em> hard disk, which QEMU identifies as <code>hda<\/code>. However, you should also tell QEMU to actually boot from the CD-ROM image instead, at least until FreeDOS is fully installed. To do that, you\u2019ll add an extra QEMU command line option at the end:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom FD13LIVE.iso -boot order=d<\/code><\/pre>\n\n\n\n<p>QEMU recognizes several options to the <code>-boot<\/code> option, and in this example I\u2019ve instructed QEMU to boot with <code>order=d<\/code>. That sets the <em>boot selection order<\/em> to just the CD-ROM drive (<code>d<\/code>). You can also use <code>a<\/code> to indicate the first floppy drive, <code>c<\/code> for the first hard drive, or <code>n<\/code> to boot from the network. Combine options like <code>order=ac<\/code> to try to boot first from the \u201cA:\u201d floppy before attempting to boot from the \u201cC:\u201d hard drive.<\/p>\n\n\n\n<p>In this case, booting from the CD-ROM will boot the FreeDOS 1.3 LiveCD. To run the installer, select the third menu option:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install1.png\" alt=\"\" class=\"wp-image-5619\"\/><\/figure>\n\n\n\n<p>From there, follow the prompts to select your preferred language and start the installation:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install2.png\" alt=\"\" class=\"wp-image-5620\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install3.png\" alt=\"\" class=\"wp-image-5621\"\/><\/figure>\n\n\n\n<p>Since the virtual hard disk that you created with <code>qemu-img<\/code> is completely blank, it is missing any <em>partition<\/em> information. Operating systems need to divide the disk into regions called <em>partitions<\/em>, which also need a filesystem to save files. FreeDOS will recognize that the hard drive doesn\u2019t have any partitions on it, and will offer to create a partition for you. Select the \u201cYes\u201d option to do that:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install4.png\" alt=\"\" class=\"wp-image-5622\"\/><\/figure>\n\n\n\n<p>FreeDOS (like any DOS) reads the hard drive\u2019s partition information <em>once<\/em>, when the operating system boots. Adding or removing partitions means you need to reboot so FreeDOS will recognize the new partition information:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install5.png\" alt=\"\" class=\"wp-image-5623\"\/><\/figure>\n\n\n\n<p>By the way, <em>that<\/em> is why it is important to tell QEMU to boot from the CD-ROM when installing FreeDOS. If QEMU doesn\u2019t boot after you\u2019ve created the partitions, this probably means QEMU is trying to boot from the hard disk &#8211; and because the hard drive doesn\u2019t have an operating system on it yet, QEMU won\u2019t be able to boot.<\/p>\n\n\n\n<p>Otherwise, you should be able to boot back into the installer, and the FreeDOS install program will pick up where it left off. You\u2019ll be prompted to write a filesystem to the new partition (this step is called <em>formatting<\/em>) then FreeDOS will ask for your keyboard layout before actually installing the operating system.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install6.png\" alt=\"\" class=\"wp-image-5624\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install7.png\" alt=\"\" class=\"wp-image-5625\"\/><\/figure>\n\n\n\n<p>You can install a minimal version of FreeDOS that just includes the standard DOS commands, or you can do a \u201cfull\u201d installation that includes a ton of applications and games. Either one will give you a working version of FreeDOS &#8211; the only difference is that with the \u201cplain DOS\u201d system, you\u2019ll need to use the package installer if you want to install other programs later.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install8.png\" alt=\"\" class=\"wp-image-5626\"\/><\/figure>\n\n\n\n<p>Either way, the installer will do the rest automatically and install the packages that you selected:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install9.png\" alt=\"\" class=\"wp-image-5627\"\/><\/figure>\n\n\n\n<p>After the installation is complete, the install program will prompt you to either reboot the computer or exit to DOS. I recommend exiting to DOS, then type the <code>shutdown<\/code> command to let FreeDOS finish writing any data and quit QEMU on its own.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"booting-freedos\">Booting FreeDOS<\/h2>\n\n\n\n<p>Congratulations, you\u2019ve installed FreeDOS in QEMU! After this, you don\u2019t need to boot from the LiveCD anymore; you can boot from the virtual hard disk, just like you were on a real DOS machine. To boot FreeDOS from the virtual hard disk, you\u2019ll need to modify the QEMU command line slightly, to change <code>order=d<\/code> to <code>order=c<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom FD13LIVE.iso -boot order=c<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"427\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-13.png\" alt=\"\" class=\"wp-image-5613\"\/><\/figure>\n\n\n\n<p>You can also omit the <code>-boot<\/code> options altogether, and QEMU will attempt to boot from the \u201cC:\u201d drive before trying the CD-ROM drive. With an installed FreeDOS, this is the same effect as telling QEMU to boot from the hard drive anyway:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom FD13LIVE.iso<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s how I boot FreeDOS on my Linux desktop machine using QEMU.<\/p>\n","protected":false},"author":33,"featured_media":5613,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[340,428],"tags":[267,427,353],"class_list":["post-5612","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-freedos","category-qemu","tag-freedos","tag-qemu","tag-virtual-machine"],"modified_by":"Jim Hall","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/5612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5612"}],"version-history":[{"count":1,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/5612\/revisions"}],"predecessor-version":[{"id":5628,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/5612\/revisions\/5628"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/5613"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}