Tuesday, November 24, 2009

USB Boot Enabler

Since a few(?) releases, you can simply "dd" your openSUSE ISO-file onto an USB stick and boot from that, which is pretty cool and which I use a lot.
But recently, I came across a machine that simply does not boot from the USB stick. No matter what settings I tried in the BIOS - no boot. I believe it will only boot from internal hdd, internal CDROM or internal floppy and via PXE.
Instead of just burning the ISO onto a CD and using that (that would have been too easy, wouldn't it?), i booted an old rescue system I had still lying around on CD and found out, that the BIOS actually does enumerate the USB stick on boot, at least it shows up in /sys/firmware/edd and /dev/disk/by-id/edd-int13_dev81, so I wondered how to boot from it.

The answer was easy: Just copy what the openSUSE CD does for "boot from local harddrive". It's actually very easy (/tmp/x is the root directory for the ISO)
mkdir -p /tmp/x/isolinux
cp /usr/share/syslinux/isolinux.bin /tmp/x/isolinux/

Then create a /tmp/x/isolinux/isolinux.cfg file, with the following content:
say ***********************************************
say seife's USB boot enabler
say enter 0,1,2,3 for disk 0-3
say disk 0 is usually your local built-in harddrive
say disk 1 is probably your USB stick
say ***********************************************
label 0
localboot 0x80
label 1
localboot 0x81
label 2
localboot 0x82
label 3
localboot 0x83
default 0
prompt 1
timeout 0

That's it!
Create an ISO from it with:
genisoimage -o /tmp/sys.iso \
-b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 \
-boot-info-table \
/tmp/x

And burn onto a CD. Voila, your USB boot enabler is ready!

Now I only need to find a small credit-card size CD-R blank somewhere ;)

And maybe Steffen Winterfeldt puts something like that as a hidden option into the default openSUSE ISOs. It would be quite useful IMHO.

5 comments:

  1. Nice! I have wondered about this myself but hadn't looked into it. If you download NetInstall CD though, why couldn't it access DVD ISO in normal filesystem of USB though? Then later, you can have it loopback mounted somwhere and access it either through local directory or NFS.

    ReplyDelete
  2. I tried this with a very old laptop which is not able to boot on usb 'natively' but unfortunately it's not working for me.
    label 0 boots the local disk
    label 1 fails
    label 2 hangs with a message like "booting ..."
    Is there a way to adapt this to my need?
    Thanks

    ReplyDelete
  3. Well, the BIOS needs to detect the USB drive and map it to a BIOS drive (IIUC, I am not that good at BIOS boot stuff ;)), so if the BIOS does not do that, this simple method cannot work.

    ReplyDelete
  4. Thanks for you answer Seife. Is there an other way? Something like having a micro-kernel which enable the usb then boot on it?

    ReplyDelete
  5. [...] seife’s assorted rants Leer más: arranque, CD, distribución, isolinux, memoria usb flash, pendrive, stick usb, [...]

    ReplyDelete