[syslinux] isohybrid and ISO images whose size is not a multiple of 2048 bytes vs. VirtualBox

Thomas Schmitt scdbackup at gmx.net
Thu Feb 19 13:14:02 PST 2015


Hi,

> Hopefully I am explaining it better this time.

Our ideas of implementation are supposed to yield the
same result.

As said, i am willing to implement my proposal in
a copy of isohybrid.c, if somebody wants to test it.
Advantages and disadvantages should be obvious.

Interested users please send util/isohybrid.c from
your local SYSLINUX source code installation to me.
Just to be sure that the modified copy fits into
that installation.

----------------------------------------------------------
Reasoning for my proposal (math, not computer science):

> > You want to align the
> > resulting ISO to 4 full cylinders in order to avoid
> > the need for a cylinder size divisible by 4.
 
> No :). I want to align to resulting isohybrid image size to 4 full 
> cylinders *only when necessary*.

That's what my proposed computation does.
It predicts the minimum number of cylinders which you need
as padding target in isohybrid.c (or .in).

Sorry for being sloppy with the natural language description
of the concept. Let me try it more formal:

The size of an image file which is aligned to full
cylinder size is:

  number_of_cylinders * h * s * 512

If we divide by 2048 = 2 exp 11, we can cancel
512 = 2 exp 9 and get 

  number_of_cylinders * h * s / 4

In order to cancel the remaining 4, we need two prime
factors 2 among those of number_of_cylinders, h, and s.

We find at least two 2s in h and s if and only if h * s is
divisible by 4. All is fine then. number_of_cylinders can
have any value.

We find exactly one 2 in h and s, if and only if h * s is
divisible by 2 but not by 4. So we need one factor of 2 in
number_of_cylinders. This is equivalent to padding up to
pairs of blocks. I.e. a double granularity of padding.

We find no 2 in h and s if and only if h * s is not
divisible by 2. Then we need two factors 2 in
number_of_cylinders. Thus padding up to full quatruples
of cylinders.

This does not mean that two or four cylinders get
added unconditionally. If the input has 131 cylinders
plus a few sectors, then it gets padded up to 132 cylinders.
But if it has 132 cylinders plus 4 sectors, then it must
get padded up to 136 cylinders. (Assumed -h 255 -s 63.)

This is the theoretical minimum. Math-wise.


> Now, say we have a "good" set of potential CHS values such as 
> 2048*255*63 so to calculate the resulting size of the isohybrid image. 
> That's good for the _size_, but such amount of Cylinders is too big for 
> the partition table. This condition should already be part of the 
> source code

Both isohybrid programs check this already. After
padding is added to size.

The calculated padding cannot exceed cylinder 1024,
as long as the input ISO does not exceed 1024 cylinders.
That's because 1024 is a padding target in all three
granularities.


Have a nice day :)

Thomas



More information about the Syslinux mailing list