Monday, December 9, 2013

Creating USB disk images from .iso images in order to update firmware on old devices

I recently needed to update the firmware on an older Seagate hard drive. Seagate only offered a .iso image for me; however, I don't have a CD-ROM available.

Upon examination of the contents of the files stored inside of the .iso disk image, I didn't find anything that looked like a DOS executable; however, I did find an .ima file -- several megabytes in size.

This .ima file turned out to be another disk image that Seagate loaded using a tool called "Bootable CD Wizard" (or BCDW). I deduced that the El Torito bootable image in the .iso was using BCDW to load the .ima file into memory and "chain-load" the .ima file.

In order to make my bootable flash disk, I downloaded a FreeDos 1.1 image, and copied it directly to my USB device using the Unix dd command (note that my USB flash device is /dev/sdb). Don't accidentally overwrite something important by making a typo!
dd if=FreeDOS-1.1-memstick-2-256M.img of=/dev/sdb bs=1M
I then unplugged and plugged in the USB disk, and extracted the contents of the .iso file into my USB stick's FreeDOS partition with the Gnome Archive Manager (aka file-roller). This left the .ima file on the root directory of my USB stick's filesystem.

The trick was to figure out how to "chain-load" the .ima file, and I accomplished that by editing FreeDOS' syslinux.cfg file. Here's a snippet from the configuration file with the apropos section highlighted:

say Press ENTER to boot FreeDOS, or choose from these alternatives:
say ---------------------------------------------------------------
say :    fdos :: FreeDOS 1.1
say :    odin :: Boot ODIN 0.6 floppy disk image (tiny FreeDOS)
say : memtest :: Run Memtest86+ 4.20
say :      di :: Upgrade
say ---------------------------------------------------------------
say Example: To boot Memtest86+, type "memtest" and hit Enter.

label di
    menu label di upgrade
    linux /img/memdisk
    initrd /HE-CC35.ima

label fdos
    menu label fdos - Load FreeDOS 1.1 from USB flash drive
    com32 /fdos/bin/chain.c32
    append freedos=/fdos/bin/kernel.sys
In the boldfaced "di" (short for disk image, you can choose any word as the label) entry above, I instructed syslinux to load memdisk, which is a utility for booting floppy images. The initrd command tells syslinux to load a disk image into RAM.

Saving my work, I plugged the flash drive into the system that needed the firmware upgrade, and typed in di at the syslinux prompt in order to execute the corresponding menu entry.

Hopefully this is enough to help those of us with Seagate drives to get things working!