Building DOS boot disks on Linux
Adding ImageCenter, PartitionMagic and Ghost to the "Ultimate Boot CD" taught me a bit about how to create and manipulate DOS boot disks on a Linux machine without using a floppy drive at all.
The key is in the utilities provided by the mtools package.
Make a disk image from a real floppy disk:
dd if=/dev/fd0 of=floppy.img bs=1024 count=1440
Or create an empty, formated 2.8MB floppy image:
mformat -i floppy.img -C -f 2880 -B /dev/fd0 ::
The "-B /dev/fd0" copies the boot sector from a real floppy disk. You could also use "-B disk.img" if you have a disk image of a bootable floppy. (Or copy and decompress one of the *.igz images off the UBCD and use that.)
With the mtools "::" is a special "drive letter" that points to the floppy disk image specificed with the "-i" option.
Look at the contents of that disk image:
mdir -i floppy.img ::
Copy a file off the floppy:
mcopy -i floppy.img ::\autoexec.bat .
Copy a file to the floppy:
mcopy -i floppy.img autoexec.bat ::
You can edit DOS files on Linux seamlessly, both vi and kwrite handle the DOS/UNIX line end characters transparently.
The Ultimate Boot CD can use uncompressed (.img) or compressed (.igz) disk images. To compress a disk image do:
gzip floppy.img mv floppy.img.gz floppy.igz
To make an ISO for a bootable CD using a floppy image:
mkisofs -v -J -r -o cd.iso -b "floppy.img" /cd-root
The path to "floppy.img" has to be relative to "/cd-root". (The floppy image used would have to contain the drivers and configuration commands necessary to access a CD before the CD itself would be visible after booting. The dosubcd.igz image from the UBCD could be uncompressed and used for this purpose.)
I created tools/ubcd2iso/ubcd2iso.sh on my custom UBCD image to automate the mkisofs command it uses for Linux