FreeDOS USB stick

FreeDOS bootable USB

This document describes how to put FreeDOS 1.1 onto an USB flash drive ("USB stick") and make it bootable.

This HOWTO is rather terse. In October 2013 I wrote a new HOWTO explaining how to generate your own bootable FreeDOS image file, suitable for dd'ing onto a USB stick or booting via PXE. I think the new HOWTO is more elaborate than the one you are reading right now, so please take a look at it.

If you are simply looking for a downloadable image which you can write onto an USB stick to boot FreeDOS, just have a look at the downloads I offer here.

Prerequisites

First, you'll need the FreeDOS 1.1 ISO image (fd11src.iso – get it from http://www.freedos.org/download/ )

Additionally, these tools are required:

  • syslinux

  • GNU parted – Note: Neither fdisk nor cfdisk will work for this!

  • mkfs.msdos or mkdosfs – package dosfstools in Arch Linux and Debian

  • mtools package is required by syslinux during installation

  • A spare USB flash drive – WARNING! Don't use a flash drive holding important data! We will delete everything on this stick!

Installation

Device and path names used within this howto:

Name Description
/dev/sdz The device name of the USB flash drive.
/dev/sdz1 The FAT partition on the USB flash drive, holding the FreeDOS installation.
/mnt/fdos This is where the FreeDOS ISO image is mounted to. This directory contains all files you would see when you burn the ISO image to a CD-R and insert the CD-R into your CD-drive.
/mnt/usb This is the mount point of the FAT partition on the USB drive.
~/freedos A temporary directory holding unzipped files from the FreeDOS ISO image.

Prepare USB stick

Partitioning

Create one primary partition on your USB stick. Mark the partition as FAT16 (type 0E) if the size is up to 2 GB, use FAT32 (type 0C) for sizes exceeding 2 GB or if you need support for long filenames.

Here you see how to make a 2000 MB FAT16 partition with parted:

# parted /dev/sdz mklabel msdos
# parted /dev/sdz mkpart primary fat16 0 2000MB
# parted /dev/sdz set 1 boot on

As a final step, take a look at the partition table you've made. It should look like this:

# parted /dev/sdz print
Model: Ut165 USB2FlashStorage (scsi)
Disk /dev/sdz: 2022MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start  End     Size    Type     File system  Flags
1      512B   2000MB  2000MB  primary  fat16        boot, lba

Double check for the boot and lba flags being set, as they are important for proper booting from the stick!

Create filesystem

Now, create the appropriate filesystem (FAT16 or FAT32):

FAT16 filesystem:

# mkfs.msdos -F 16 -n FREEDOS /dev/sdz1

FAT32 filesystem:

# mkfs.msdos -F 32 -n FREEDOS /dev/sdz1

Install syslinux bootloader

Make the USB flash drive bootable using syslinux::

# syslinux -i /dev/sdz1

Mount stick

Mount USB flash drive to /mnt/usb:

# mount /dev/sdz1 /mnt/usb

Create the directories fdos and img:

# mkdir /mnt/usb/{fdos,img}

Mount FreeDOS ISO image:

# mkdir /mnt/fdos
# mount -o loop,ro /path/to/fd11src.iso /mnt/fdos

Copy files

Download my preconfigured syslinux.cfg configuration file and save it to /mnt/usb/syslinux.cfg.

Unpack the BASE and BOOT packages from the FreeDOS distribution CD::

# unzip /mnt/fdos/freedos/packages/boot/syslnxx.zip -d /mnt/usb/fdos
# find /mnt/fdos/freedos/packages/base/*.zip | xargs -l unzip -d /mnt/usb/fdos

AUTOEXEC.BAT and CONFIG.SYS

The BASE package comes with preconfigured files named config.txt and autoexec.txt. Simple copy them into the root directory of your USB stick::

# cp /mnt/usb/fdos/autoexec.txt /mnt/usb/autoexec.bat
# cp /mnt/usb/fdos/config.txt /mnt/usb/config.sys

Optional addons

memtest86+

Go to http://www.memtest.org/#downiso and download one of the pre-compiled bootable binary files. The file is either zipped or gzipped. Unpack the file and copy it to /mnt/usb/img/memtest.bin.

The syslinux.cfg configuration file is already preconfigured to load the memtest.bin binary. Just type memtest on the boot prompt and hit .