We have a lot of computers with a broken Award BIOS (version F9 for the Gigabyte MA785GMT-UD2H) that is insanely picky about what must be on a USB key if it is going to boot.
For instance, the BIOS compatibility (memtest86+) test at http://www.pendrivelinux.com/testin...atibility/ not only didn't run, it wasn't even displayed as an option in the HDD list! I tried a bunch of USB installers (some from the pendrivelinux site) and USB how to's, including the ones about how to make the USB look like a zip drive, and the only success was by installing syslinux with RMPrepUSBon Windows. By essentially working backwards from the USB stick it produced, and with a lot of help from the author of that package, I finally came up with a series of more or less standard linux commands that would generate a bootable USB stick for this BIOS. Hopefully the next person who runs into this BIOS issue will find this post and can save themselves a lot of time and effort.
The USB stick used is a SanDisk Cruzer Blade 4GB. Using a different stick would only change the number of Cylinders in the following (to adjust to the size of that disk).
The device on this machine is /dev/sdb, use what is appropriate on your machine or this could munch other disks!!!
#wipe the beginning of the disk. Here the first 4M. dd if=/dev/zero of=/dev/sdb bs=4k count=1k
# partition the USB stick so that H=255,Sec=63, and C*H*S is
# the size of the disk (or slightly smaller). This is KEY.
# I used the grub4dos installer option in RMPrepUSB to see
# what geometry the BIOS would accept. It turned out that if
# a second partition was created, or the ends of this one
# changed around, the linux kernel would use its own logical
# geometry information for the drive, which would then be used
# in turn by mkfs.vfat. That is, even if it was set to the CHS
# I wanted with fdisk or sfdisk, if there was any inconsistency,
# the kernel would fall back to its own representation instead
# of using the CHS specified. Note the math for the values
# below: 489*255*63= 7855785, 7855785 = 7855722+63
# The partition starts at sector 63 since that worked in the one
# produced by RMprepUSB, and there was no good reason to change it.
sfdisk -f -C489 -H255 -S63 /dev/sdb <sfdisk.in
# Install fat32 in the one partition.
# Install master and partition boot blocks.
# ms-sys is from http://ms-sys.sourceforge.net/
# mkfs.vfat -F 32 -n Test /dev/sdb1
./ms-sys -H 255 -w /dev/sdb
./ms-sys -p -H 255 -w /dev/sdb1
# at this point for some odd reason syslinux tends to go nuts if run
# immediately, looping like crazy on
# file is read only, overwrite anyway (y/n) ?
# so unplug the drive, plug it in again, wait for it to automount
# then do:
# umount /dev/sdb1
and it boots into syslinux. Test by booting on the target machine and:
1. it shows up in the HDD list (after pressing F12 to get to the boot list)
2. it does not stop with a "boot error"
3. it does not stop with an "operating system not found"
4. it ends up with the expected syslinux text on the screen
That is all as it should be, since there is nothing else on the disk for syslinux to transfer control to.
At this point one can install whatever linux distro or other tools are desired on the USB stick. Since mine was for recovery purposes, I used
PLD Rescue (http://rescuecd.pld-linux.org/). usb.zip (see below) is from that site too.
mount /dev/sdb1 /tmp/usb
mount -o loop,exec /tmp/RCDx86_11_02.iso /tmp/foo
cp rescue.cpi ../usb
cp initrd.ide vmlinuz memtest /tmp/usb
This USB Flash key was displayed in the HDD boot menu and booted into PLD on the target machines, despite everything that Award BIOS put in the way to prevent it.
The following variant also creates an extra small empty partition which may help to increase success with some BIOSes.