Sunday, September 6, 2009

how to build a DOS boot USB mem stick on Linux

You might find yourself needing to boot DOS on an x86 computer. A popular reason would be to update the BIOS. What if the computer doesn't have a floppy drive? Or you need more room than a floppy? What if the new SATA DVD writer doesn't seem to be recognized by the CDROM drivers on the DOS boot CD you built?

We use sysresccd all the time, but that is Linux and I needed to copy an arbitrary .exe to removable media, boot DOS and run the .exe. I've customized the FreeDOS CD, but CDs wouldn't work so I found this page. Which option to try? Well, I chose a few short options at first, then went with the long option (#1). A lot of procedural language, seems better to just write a script.

Make an empty directory and run this script (on Linux):
Download it here
#!/bin/sh

wget 'http://prdownloads.sourceforge.net/advancemame/makebootfat-1.4.tar.gz?download'
tar -xzf makebootfat-1.4.tar.gz
cd makebootfat-1.4
./configure
make
ls makebootfat

cd ..

wget 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/kernels.zip'
wget 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/commandx.zip'
wget 'http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.0/pkgs/unstablx.zip'

unzip kernels.zip
unzip commandx.zip
unzip unstablx.zip

mkdir fs-root

cp bin/command.com bin/kernel.sys fs-root/
cp source/ukernel/boot/fat*.bin fs-root/
cp /usr/lib/syslinux/mbr.bin fs-root/

#cd fs-root
#sudo ../makebootfat-1.4/makebootfat -o /dev/sdd -E 255 -1 fat12.bin -2 fat16.bin -3 fat32lba.bin -m mbr.bin .
#sudo dd if=/dev/sdd of=~/fdos-usb.dd


Tested on Ubuntu 9.04 with nothing special installed. Apparently some distributions will have /usr/lib/syslinux/mbr.bin in another spot or not at all. The last 3 lines (comments) are there as an example of what to do next. Use "sudo dd" at your own risk.

The end result is a USB mem stick that will boot FreeDOS and allow you to run your BIOS update utility. Now you are free to collect lots of little tools like that on one stick.

No comments:

Post a Comment