Skip to content

Instantly share code, notes, and snippets.

@kmullin
Last active January 4, 2016 01:49
Show Gist options
  • Save kmullin/8551054 to your computer and use it in GitHub Desktop.
Save kmullin/8551054 to your computer and use it in GitHub Desktop.
FreeDOS BIOS Flasher / Util bootdisk

Create a FreeDOS BIOS Flash bootdisk

General Info

Those BIOS images not fitting onto 1.44MB floppy anymore?

Did you need to use some other utilities in a minimal DOS environment?

In order to boot a system into DOS and have an emulated CDROM drive with the extra utilities, we need to first create a boot floppy which has a minimal FreeDOS environment. FreeDOS will load the needed drivers to emulate a CDROM drive with the rest of your utilities on it.

This README along with the attached script can be found on GitHub as a gist.

Instructions

To create a bootable CDROM image, we're going to create a minimal boot floppy image first, then create a ISO 9660 CD-ROM formatted filesystem using our floppy image as the boot image of the CDROM.

Part 1: Floppy Boot Image

The floppy boot image is for the actual DOS bootup. It is added into the CDROM image as the boot sector information. It's only responsibility is to boot into FreeDOS, and load drivers to emulate the rest of the CDROM.

  1. Download FreeDOS 1.0 Floppy Image.

  2. Mount Floppy image with write permissions.

  3. Edit fdconfig.sys menu to taste.

  4. Edit freedos/fdauto.bat to run autoexec.bat after its run:

    ...snip...
    
    echo Running autoexec.bat...
    A:\AUTOEXEC.BAT
    
  5. Create autoexec.bat in the root directory.

  6. Add reboot.exe to the root directory used for actually rebooting (optional).

  7. Unmount fdboot.img.

Part 2: CD-ROM contents / Extra Binaries

We use the CDROM to hold the BIOS flash utility, firmware, etc. This part of the CD is emulated as a drive (A:\) after FreeDOS boots.

  1. Download FreeDOS 1.0 Base CD.

  2. Mount CD ISO.

  3. Copy isolinux files from base cd:

    mkdir -p ~/tmp/isolinux && \
    cp -av /mnt/fdbootiso/isolinux/{iso,data}* ~/tmp/isolinux
    

    You should have the following files:

    isolinux/
    isolinux/isolinux.bin
    isolinux/isolinux.cfg
    isolinux/data
    isolinux/data/bootmsg.txt
    isolinux/data/f1_help.txt
    isolinux/data/f2_licen.txt
    isolinux/data/f_about.txt
    isolinux/data/logo.lss
    isolinux/data/memdisk
    isolinux/data/fdboot.img
    
  4. Replace isolinux/data/fdboot.img with the one you created earlier (it can be compressed):

    gzip -c -9 fdboot.img > ~/tmp/isolinux/data/fdboot.img

  5. Edit isolinux/isolinux.cfg and remove most of the fluffy menu stuff.

    All you really need is:

    default fdos
    timeout 1
    
    label fdos
        kernel data/memdisk
        append initrd=data/FDBOOT.IMG
    
  6. Add any utilities you need to your bootdisk inside the root.

Part 3: mkisofs

I've included a sample script I've pieced together to do the heavy lifting.

  1. Edit make_boot_iso.sh to fit your needs.

  2. Run make_boot_iso.sh.

#!/bin/sh
#
# https://gist.github.com/kmullin/8551054
#
# This script will create a bootable ISO file from
# a directory structure
# expects isolinux.bin to exist inside the directory tree
# directory where we're storing our tree
IN_DIR='bootimage'
# where relative to the above dir is isolinux
ISOLINUX='isolinux/isolinux.bin'
# where we write iso
ISO_OUT=~/boot.iso
# customize if you want
APP_ID='FreeDOS beta9 Distribution'
PUBLISHER='FreeDOS - www.freedos.org'
VOL_NAME='FDOS_BETA9' # no spaces
MKISOFS=`which mkisofs`
# check existence
if [ -z "$MKISOFS" ]; then
echo "Cannot find 'mkisofs' in $PATH"
exit 1
fi
cat <<-EOS
Creating $ISO_OUT from $IN_DIR/
Application: $APP_ID
Publisher: $PUBLISHER
Volume Name: $VOL_NAME
EOS
# -q quiet
# -v verbose
# -l caution; maybe comment out
# -N caution; maybe comment out
# -o "${ISO_OUT}" output; duh
# -b "${ISOLINUX}" eltorito_boot_image; isolinux
# -publisher "${PUBLISHER}" publisher info
# -A "${APP_ID}" application id; what is it?
# -V ${VOL_NAME} 32 characters VOLUME NAME
$MKISOFS \
-boot-info-table \
-iso-level 4 \
-no-emul-boot \
-q \
-v \
-l \
-N \
-o "${ISO_OUT}" \
-b "${ISOLINUX}" \
-publisher "${PUBLISHER}" \
-A "${APP_ID}" \
-V ${VOL_NAME} \
"${IN_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment