|
 |
On 29/02/2012 10:52 AM, Invisible wrote:
> Weird thing #1: For this to work, you have to write the image over the
> top of the entire drive, not just one partition of it. Which is strange,
> because I'm pretty sure that an ISO-9660 file system doesn't contain a
> valid IBM BIOS partition table at the start.
OK, so I did some digging. It turns out that for a Linux CD image to be
usable for booting from a flash drive, 1) it must use isolinux as the
boot loader, and 2) once the CD image has been created, you must run
isohybrid over it, which edits the file a bit.
But what exactly does isohybrid /do/ to the file that makes it work on a
USB flash drive?
Well, it turns out that isohybrid is just a Perl script. [That sound you
just heard was me being sick in the corner.] Since Perl only supports
textual manipulation, all of the "real" work must be being done by some
external tool. So if I can just find out what it is...
...oh dear God. You know what? It turns out you /can/ perform binary
manipulations in Perl. The world is not safe any more. >_<
So what does this script actually do? Well, since it's written in Perl,
I can only take guesses based on the comments in the source code. But it
/appears/ that it searches the ISO image to figure out where isolinux is
stored, and then it creates a valid IBM BIOS partition table at the
front of the CD image, and generates a boot block that runs isolinux.
Quite how it's possible to insert a partition table into a ISO-9660 file
system without breaking it, I'm not sure. But that appears to be what
the trick amounts to. I can imagine it being possible to modify a CD
image to make a bootable flash image. But I'm quite surprised that a
single image can simultaneously be both at once.
It /looks/ like it might even be possible to set up the partition table
so that the rest of the flash drive can be mounted read/write. (But that
presumably would stop the image working on a CD any more.)
In summary, being able to boot a CD image from a flash drive isn't
automatic; the image has to be specially set up with this in mind. (So
it might not work with /every/ Linux distro, for example.) In
particular, if I wanted /my/ CD image to boot this way, I'd have to
figure out how to make it boot with isolinux, and then configure it with
this cursed Perl script.
(Random fact: There's also a C translation of the same program. No, I
couldn't really read that either...)
Post a reply to this message
|
 |