Disclaimer: I am not an investment advisor. When I describe my own trading activities, it is not intended as advice or solicitation of any kind.

04 February 2011

Booting Custom ISOs with Syslinux / Memdisk

Last night I needed to run Seagate's diagnostic utility, SeaTools, against an old Maxtor drive so I could verify it as viable for installing a new NAS onto (more on that nightmare of a project in a different post).  Seagate worked against me on this, instead of with me.

They have a version that runs in Windows, but this machine doesn't have Windows.  It has FreeNAS (based on FreeBSD) on another drive, but I preferred not to have that drive hooked up during the testing.

They have a bootable CD image in the form of an ISO, but this machine doesn't have a CD-ROM.  They claim it runs FreeDOS, so I naively figured I could use UNetBootin to throw it on a USB drive and boot from that.  No dice.

To make a long story short, I managed to get it working with a combination of syslinux, memdisk, and vanilla FreeDOS.  But I had a lot of trouble finding the information I need online.  Most of what I found didn't apply to me (search for "boot usb iso linux" and all you get is how to install Linux from USB, not how to boot a custom ISO from USB and create it from Linux), and some of it was misleading (e.g. "you must format it with FAT, erasing the boot sector, but not with mkdosfs" -- wrong).

So here's what I did, and hopefully someone else will find this useful:

  1. Download UNetBootin, use it to install FreeDOS onto the USB drive straight from the GUI
  2. Install syslinux onto the USB drive
  3. Copy the memdisk bootloader onto the USB drive
  4. Download the SeaTools ISO and copy it onto the USB drive
  5. Create a file called syslinux.cfg with the contents below, and copy it onto the USB drive, replacing the one that UNetBootin put there
DEFAULT SeaTools
LABEL SeaTools
LINUX memdisk
INITRD SeaToolsDOS222ALL.576.ISO
APPEND iso

This gave me a bootable USB drive that went straight into Seagate's custom-boot environment.  I reckon I can use this same trick to boot any DOS-based utility like this.

Here's the command transcript:

$ sudo apt-get install p7zip-full syslinux
$ wget http://downloads.sourceforge.net/project/unetbootin/UNetbootin/494/unetbootin-linux-494
$ chmod u+x unetbootin-linux-494
$ sudo ./unetbootin-linux-494
$ sudo syslinux /dev/sdc1
$ sudo mount /dev/sdc1 /mnt/usb
$ cp /usr/lib/syslinux/memdisk /mnt/usb
$ wget http://www.seagate.com/staticfiles/support/seatools/SeaToolsDOS222ALL.576.ISO
$ cp SeaToolsDOS222ALL.576.ISO /mnt/usb
$ cat - > syslinux.cfg
DEFAULT SeaTools
LABEL SeaTools
LINUX memdisk
INITRD SeaToolsDOS222ALL.576.ISO
APPEND iso
^D
$ sudo cp syslinux.cfg /mnt/usb
$ sudo umount /mnt/usb

2 comments:

  1. This isn't relevant to anything you have posted lately but I found your bejeweled blitz bot posts interesting. I had recently discovered the game and had written a working bot and was still improving it yesterday when the thing started going haywire. I then did a search and your old posts turned up. Seems that the board size increased roughly 5% yesterday. I confirmed this by digging some old screen captures out of my trash and comparing them in a photo editing program. Your bot may no longer work as well.

    ReplyDelete
  2. Thanks for this Mark. I didn't actually need to boot an ISO, I had run across a FreeDOS.img that had the version I needed all wrapped up, but I wanted to boot it from a Unetbootin like you mentioned, so I pulled the memdisk using your example and put the img on the USB drive and was able to boot it using the syntax from the official syslinux documentation. Thanks for the pointers!

    ReplyDelete