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

Thomas Schmitt scdbackup at gmx.net
Tue Feb 17 11:51:30 PST 2015


Hi,

intrigeri wrote:
> We're using `isohybrid -h 255 -s 63' [...]
> isohybrid produces ISO
> images whose size is not a multiple of 2048 bytes.

Seems to be intentional.

http://git.kernel.org/cgit/boot/syslinux/syslinux.git/tree/utils/isohybrid.in
  # Target image size: round up to a multiple of $h*$s*512

http://git.kernel.org/cgit/boot/syslinux/syslinux.git/tree/utils/isohybrid.c
    cylsize = head * sector * 512;
    frac = isostat.st_size % cylsize;
    padding = (frac > 0) ? cylsize - frac : 0;

With -h 255 -s 63, both pad to an integer number of cylinders
with an impair multiple of 512 bytes. So if the number of
cylinders is not divisible by 4, then the number of bytes is
not divisible by 2048.

An ISO image may have a fuzzy end, but a virtual CD-ROM
should indeed provide an integer number of 2048-byte blocks.


> truncate -s %2048 $ISO

This makes the image larger than the partition.
Not overly unhealthy, i'd say, because the ISO filesystem
still fits into the partition.
Nevertheless not totally clean.
Does fdisk -lu complain ?


An alternative would be to request a cylinder size which
is divisible by 2048. E.g.

  isohybrid -h 252 -s 63

The cylinder sizes 64x32 and 255x63 emerged as best
candidates when we compared our collections of questionable
experience and rumors. More substance is not to see behind
them.
(Actually Cylinder/Head/Sector addressing is so brain
 damaged that only ill firmware can insist in it having
 a particular form. All sane firmwares will simply use
 LBA numbers for addressing.)


Ady wrote:

> For isohybrid images, the result should be a multiple of 1MiB (1048576 
> bytes), which is itself a multiple of 2048 bytes.

This is possible only up to an image size of 1024 MiB,
because the cylinder field allows numbers from 0 to 1023.
For larger images the current isohybrid advise is
indeed -h 255 -s 63 (ends shortly before 8 GiB).

The found problem should make us rethink and trigger
massive testing.


> I don't know whether there is some bug in any one of the isohybrid 
> tools included in Syslinux (there might be).

No. This time it is a conceptional problem of isohybrid.
It wants to be an MBR partitioned hard disk and a CD-ROM
at the same time. I am quite sure that VirtualBox does
not complain about the ISO filesystem but about the
virtual DVD-ROM.

If isohybrid pads to a cylinder size, then it would be
odd to add further 1, 2, or 3 blocks of 512 bytes.
I think the workaround with truncate is a valid way to
override the valid decision of the isohybrid program
... if one cannot affort a cylinder size that is
divisible by 2048.


Have a nice day :)

Thomas



More information about the Syslinux mailing list