{"id":5690,"date":"2024-06-07T03:00:00","date_gmt":"2024-06-07T07:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=5690"},"modified":"2024-06-05T15:04:04","modified_gmt":"2024-06-05T19:04:04","slug":"running-freedos-on-legacy-hardware","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=5690","title":{"rendered":"Running FreeDOS on legacy hardware"},"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=\"5690\" 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\">7    <\/span>\r\n<\/div><\/div>\n<p>Last year, a storefront on AliExpress (a website similar to Amazon, selling all kinds of products from a variety of sellers) produced two interesting \u201cretro computing\u201d products: a micro laptop called the \u201cBook8088\u201d which contained an 8088 CPU, and a handheld device called \u201cHand386\u201d that sported a 386 processor but required you to type with your thumbs.<\/p>\n\n\n\n<p>At the time, I thought these were really cool. But those specific systems didn\u2019t interest me much beyond that. I wanted to <em>use<\/em> whatever computer I bought, and I didn\u2019t want to get stuck typing with my thumbs on the Hand386. And the 8088 CPU would be too slow to run many <em>modern<\/em> DOS programs, especially my favorite DOS applications and games from the 1990s. But I probably would have bought one if they\u2019d \u201cswapped\u201d the configurations: a handheld 8088 or a 386 micro laptop.<\/p>\n\n\n\n<p>And in May this year, they started selling exactly that: the <a href=\"https:\/\/www.aliexpress.us\/item\/3256805356267711.html\">Pocket386<\/a> (about $200) has a 386-SX CPU running at 40 MHz, with 8 MB of memory and 2 GB of storage. It also has a built-in Cirrus CL-GD542x compatible VGA card and OPL-3 sound card. The Pocket386 comes pre-installed with Windows95 &#8211; but that was soon to change.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"600\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/pocket386.jpg\" alt=\"photo of the Pocket 386 micro laptop\" class=\"wp-image-5691\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-freedos\">Installing FreeDOS<\/h2>\n\n\n\n<p>You can\u2019t install FreeDOS directly on the Pocket386. At least, I didn\u2019t have the necessary hardware.<\/p>\n\n\n\n<p>The Pocket386 has a CH375B USB controller in it, but it requires a driver to get it working. Some desktop PC systems provide floppy emulation through the BIOS (or the UEFI, when running in \u201cLegacy\u201d mode) which allow you to connect a USB flash drive at boot time, and the system will recognize it as the \u201cA:\u201d drive. But I couldn\u2019t find any options in the BIOS that activated the USB port. Then again, the Pocket386 has an AMIBIOS version 1.16 from 1996; that\u2019s the same year that USB 1.0 was <em>invented<\/em>. The BIOS doesn\u2019t provide native emulation of USB drives.<\/p>\n\n\n\n<p>The Pocket386 also has pinouts for IDE and parallel, which might support connecting an \u201cexternal\u201d CD-ROM drive or second hard drive. But I don\u2019t have that hardware; I recycled any such \u201cclassic\u201d hardware that I still had in storage about ten years ago when I last moved.<\/p>\n\n\n\n<p>However, the 2 GB storage is on a removable CF card. This gave me an idea: connect the CF card to my Linux desktop, and install FreeDOS from there.<\/p>\n\n\n\n<p>I have a CF card reader at home; after plugging in the CF card, Linux recognized the CF as <code>\/dev\/sda<\/code>. Once I had that, I backed up the storage device (in case I needed to restore to defaults later) using the <code>dd<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo dd if=\/dev\/sda of=win95.cf<\/code><\/pre>\n\n\n\n<p>I could have used the FreeDOS 1.3 installer, but the FreeDOS release coordinator (Jerome) posts a new <a href=\"https:\/\/ibiblio.org\/pub\/micro\/pc-stuff\/freedos\/files\/distributions\/test\/\">Test Release<\/a> every month, with the latest updates. Usually, this is for testing, and will someday become the base for the next official FreeDOS distribution. Releases are named \u201cT\u201d then the two-digit year and two-digit month, so the test release for June 2024 is <code>T2406<\/code>.<\/p>\n\n\n\n<p>I decided to use the test release because it was the most up-to-date, and included several fixes that other folks needed to successfully install FreeDOS on last year\u2019s Book8088 device. This was easy to do using QEMU on Linux:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo qemu-system-i386 -enable-kvm -m 32 -hda \/dev\/sda -cdrom T2406LIVE.iso<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"400\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-install2-1.png\" alt=\"screenshot of the FreeDOS T2406 installer\" class=\"wp-image-5692\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"workaround-for-the-hard-drive\">Workaround for the hard drive<\/h2>\n\n\n\n<p>I used the standard install process, which seemed to go smoothly. But when I swapped the CF back to the Pocket386 and booted it, the system hung after printing <code>Loading FreeDOS<\/code>.<\/p>\n\n\n\n<p>I tried several other ways to install FreeDOS, each time exiting the installer to the DOS prompt, and running commands manually. What followed was a lot of debugging with help from other developers on the FreeDOS email list, where we concluded the BIOS didn\u2019t provide LBA support, and the FreeDOS <code>SYS<\/code> command installed an LBA bootloader for FAT32 partitions.<\/p>\n\n\n\n<p>The secret is in how operating systems address hard drives. In the classic days of computing, you used three parameters to access data on a hard drive: cylinders, heads, and sectors. But since the 1990s, computers supported a different, more flexible way to address the data on hard drives: logical block addressing (LBA). The FreeDOS <code>SYS<\/code> command will detect LBA support where available and use that.<\/p>\n\n\n\n<p>The BIOS on the QEMU virtual machine supported LBA, but the BIOS on the Pocket386 does not. This makes it impossible to boot with LBA on the Pocket386. To fix this, I had to use an undocumented parameter in FreeDOS <code>SYS<\/code> to make the hard drive bootable using CHS.<\/p>\n\n\n\n<p>Normally, the <em>manual<\/em> steps to install DOS on a new system are <code>FDISK<\/code> to create just a small \u201cC:\u201d drive, <code>FORMAT<\/code> to create the filesystem, and <code>SYS<\/code> to make it bootable. After booting QEMU with the CF card on my Linux desktop, I used FreeDOS <code>FDISK<\/code> to create a new partition that used the whole 2 GB disk, and marked it \u201cActive.\u201d (An \u201cActive\u201d partition means it can be a bootable disk.) I then ran <code>FORMAT C:<\/code> to create a DOS filesystem on the new partition. So far, that\u2019s as normal. But to transfer the boot code to the drive, I added this option to the <code>SYS<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SYS C: \/FORCE:CHS<\/code><\/pre>\n\n\n\n<p>Loading the CF back to the Pocket386, FreeDOS successfully booted to a <code>C:\\><\/code> prompt!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"400\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-boot.png\" alt=\"screenshot of FreeDOS booting on the Pocket 386\" class=\"wp-image-5693\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-freedos-in-advanced-mode\">Installing FreeDOS in \u2018Advanced Mode\u2019<\/h2>\n\n\n\n<p>However, the rest of the FreeDOS software wasn\u2019t installed yet. I swapped the CF card back to Linux and ran QEMU one more time, so I could use the FreeDOS installer.<\/p>\n\n\n\n<p>But I didn\u2019t want the installer to perform its usual steps, because that includes running <code>SYS<\/code> on the new filesystem. I could have installed the packages manually by unzipping them, but the installer has an \u201cAdvanced Mode\u201d that gives the user more control &#8211; including skipping the <code>SYS<\/code> step. To access \u201cAdvanced Mode,\u201d exit the installer and return to the DOS prompt. Then type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SETUP ADV<\/code><\/pre>\n\n\n\n<p>If the installer has a \u201cred\u201d theme, you know you\u2019re in \u201cAdvanced Mode.\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"400\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-adv2.png\" alt=\"screenshot of the FreeDOS T2406 installer in Advanced Mode\" class=\"wp-image-5694\"\/><\/figure>\n\n\n\n<p>Running in \u201cAdvanced Mode\u201d gives you more control over the install process, including the ability to skip the <code>SYS<\/code> step. When the installer prompts if you want to transfer the system files to the hard drive, that\u2019s the <code>SYS<\/code> step. Select \u201cNo\u201d to skip this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"400\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/freedos-adv-nosys.png\" alt=\"screenshot of the FreeDOS T2406 installer, skipping the SYS step\" class=\"wp-image-5695\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"retro-computing-on-the-pocket386\">Retro computing on the Pocket386<\/h2>\n\n\n\n<p>After the installation is complete in QEMU, I shut down and swapped the CF card back to the Pocket386. And now I have FreeDOS running on the Pocket386!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"450\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/pocket386-edit.jpg\" alt=\"photo of FreeDOS Edit running on the Pocket 386\" class=\"wp-image-5696\"\/><\/figure>\n\n\n\n<p>The installation requires the extra step to force CHS mode when making the drive bootable, but that\u2019s not a bad tradeoff when I had to install from a completely different system. The root of the problem is QEMU supports LBA mode, because it is a more recent implementation &#8211; but the 1996 BIOS on the Pocket386 only supports CHS mode. The QEMU virtual machine does a great job of emulating a real computer, but it isn\u2019t a perfect match for the hardware on this Pocket386.<\/p>\n\n\n\n<p>To transfer files to and from the Pocket386, I need to connect the CF card to my Linux machine using the CF reader. To access the drive from Linux, I can use the <code>mount<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount \/dev\/sda1 \/mnt<\/code><\/pre>\n\n\n\n<p>This sets the owner of everything on the CF card to the <code>root<\/code> user. To instead set the owner to the user with ID <code>1000<\/code>, you would instead type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount -o uid=1000 \/dev\/sda1 \/mnt<\/code><\/pre>\n\n\n\n<p>Or to use the username <code>jhall<\/code>, you can type:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo mount -o uid=jhall \/dev\/sda1 \/mnt<\/code><\/pre>\n\n\n\n<p>However you access the CF card, you can then transfer files between Linux and the CF drive using your file manager or the command line. When you\u2019re done, don\u2019t forget to use <code>unmount<\/code> so Linux will stop using the drive:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo umount \/mnt<\/code><\/pre>\n\n\n\n<p>Transferring files this way is a bit inconvenient, but not too different than copying files between systems using \u201cold school\u201d floppy disks. And it allows me to copy over any other files I want to use on the Pocket386, such as my favorite shareware games. This is a good system to run classic DOS games, including Commander Keen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"450\" src=\"https:\/\/www.both.org\/wp-content\/uploads\/2024\/06\/pocket386-keen1.jpg\" alt=\"photo of Commander Keen running on the Pocket 386\" class=\"wp-image-5697\"\/><\/figure>\n\n\n\n<p>Overall, the Pocket386 is a great micro laptop for running FreeDOS. I&#8217;ve been experimenting with it, and it does a great job. I can run my favorite classic DOS applications and games &#8211; and I also installed a C compiler so I can write my own programs to add this neat little device. I look forward to playing with it further over the summer. And now, if I need to test FreeDOS on legacy hardware, I can use the Pocket386.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How I installed FreeDOS on a 386-SX micro laptop called the Pocket386.<\/p>\n","protected":false},"author":33,"featured_media":3514,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[340,84],"tags":[267,132],"class_list":["post-5690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-freedos","category-hardware","tag-freedos","tag-hardware"],"modified_by":"David Both","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/5690","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=5690"}],"version-history":[{"count":7,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/5690\/revisions"}],"predecessor-version":[{"id":5704,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/5690\/revisions\/5704"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/3514"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}