[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 06:55:25 PST 2015


Ady wrote:
> my suggestion to modify the _amount_ of Cylinders was intended to 
> overcome the "by 4" (or rather, "by 2048") issue.

Now i get your intention. You want to align the
resulting ISO to 4 full cylinders in order to avoid
the need for a cylinder size divisible by 4.

This would work. But with -h 255 -s 63 it could waste
up to 32,899,072 bytes.

> Hopefully I am clarifying my suggestion in this email:
> [...] loop to step #2.

The algorithm would not have to loop for a solution
but could compute it directly:

  if (Heads * Sectors_per_track) is divisible by 4
     # Pad up to next full cylinder
     align_factor = 1
  else if (Heads * Sectors_per_track) is divisible by 2
     # Pad up to next full double cylinder 
     align_factor = 2
     # Pad up to next full quatruple cylinder (nearly 32 MB)
     align_factor = 4

In isohybrid.c the resulting align_factor would be used
like this:

-    frac = isostat.st_size % cylsize;
-    padding = (frac > 0) ? cylsize - frac : 0;
+    align_cylsize = cylsize * align_factor;
+    frac = isostat.st_size % align_cylsize;
+    padding = (frac > 0) ? align_cylsize - frac : 0;

Similarly in isohybrid.in.
There is no risk that the larger padding would exceed
1024 cylinders as long as the unpadded image does not
exceed this limit.

Nice idea, i must say. Mathematically appealing.
But up to four cylinders of padding ... ?

If anybody really wants to use this, then i would
prepare a modified copy of isohybrid.c for testing.
(I'm not its author or maintainer. Somebody else would
have to bring it into Git.)

Have a nice day :)


More information about the Syslinux mailing list