[syslinux] isolinux.bin checksum

Ady Ady ady-sf at hotmail.com
Mon Jan 8 08:35:29 PST 2018


> Hi,
> 
> Ady wrote:
> > During May 2009, a commit by Peter deleted the checksumiso.pl file. The 
> > commit is:
> >  core: LZO compress the PM part of the core 
> > repo.or.cz/syslinux.git/commit/0d82b71304d596d80f3c4520f9dcf90048ca50b7 
> > And so, since version 4.00, the 'code/checksumiso.pl' file is no longer 
> > included.
> > How is the checksum of isolinux.bin calculated since then?
> 
> By the ISO 9660 production program which patches in the Boot Info Table.
> 
> The computation of checksumiso.pl can be seen in libisofs function
> make_boot_info_table():
> 
>   https://dev.lovelyhq.com/libburnia/libisofs/blob/master/libisofs/eltorito.c#L1252
> (without Javascript
>   https://dev.lovelyhq.com/libburnia/libisofs/raw/master/libisofs/eltorito.c
>  you have to hop to the line yourself. Sorry. GitLab. Urghhh ...)
> 
> libisofs does not pad to full blocks of 2048 bytes, like checksumiso.pl
> did. But the isolinux.bin binary from SYSLINUX installations is already
> aligned to that block size. It works for libisofs since about 10 years.
> 
> 
> > What was/is the purpose of this range change?
> 
> I'm not sure whether it is due to a range change, but it really looks like
> the checksum in the file isolinux.bin from SYSLINUX installation differs
> from the checksum after the file was put with Boot Info Table into an
> ISO 9660 filesystem.
> 
> I ran
> 
>   xorriso -as mkisofs -o test.iso -b isolinux.bin \
>           -no-emul-boot -boot-load-size 4 -boot-info-table \
>           /usr/lib/ISOLINUX/isolinux.bin
> 
> and the checksum changed from 0x09e675b8 to 0x8cc6977a.
> 
> But i never had to change the algorithm in libisofs in order to keep the
> result bootable. The isolinux,bin binaries do boot and in
>   http://repo.or.cz/syslinux.git/blob/refs/heads/master:/core/isolinux.asm#l262
> i see a checksum computation and later a test which would lead to label
> "kaboom" if not matching.
> 
> 
> So where did the checksum 0x09e675b8 in Sid's installed isolinux.bin come
> from ?
> 
> The source code sets it to 4-byte value
>   0xdeadbeef
> See the comments from
>   http://repo.or.cz/syslinux.git/blob/f1aa00224b23e2b4c71f204c1417c7b6e5ea8e51:/core/isolinux.asm#l213
> up to line 220.
> 
> So i assume that checksumming still is applied somehow during building of
> isolinux.bin.
> 
> In the diff of core/Makefile i see a new program ../lzo/prepcore applied.
> In its source, one can see the Boot Info Table checksum calculation:
>   http://repo.or.cz/syslinux.git/blob/0d82b71304d596d80f3c4520f9dcf90048ca50b7:/lzo/prepcore.c#l370
> It looks to me as if it computes the checksum of payload and block padding.
> (This explains why the installed isolinux.bin are always block aligned.)
> 
> Nevertheless, something must be different there, compared to libisofs and
> the check in the running isolinux.bin boot image program.
> 
> For now i fail to see that difference. Maybe others are smarter.
> I will later chew a bit more on this riddle.
> 
> 
> Have a nice day :)
> 
> Thomas
> 
 
I very much appreciate the reply. From it, either I haven't been as 
clear as I thought, or things are not clear from the starting point.

AFAIK, the default checksum (at least the one I am talking about) in 
official isolinux.bin was supposed to help ISO-building programs. Until 
ISOLINUX (Syslinux) version 2.11, mkisofs was patching the "boot info 
table" by means of an option in its command line. But, what happened 
when a user didn't know that ISOLINUX needed that option, or when using 
other ISO-building tools? One improvement was introduced in version 
2.12 of Syslinux.

Since version 2.12, isolinux.bin included a default checksum that would 
attempt to help ISO-building tools and users that, for whichever 
reason, would not patch the boot info table when building bootable ISO 
images.

Until version 3.86, the checksum in isolinux.bin (at least the one I am 
talking about) was successfully created by checksumiso.pl. An ISO image 
that was created without patching the boot info table would at least 
have a chance of successfully booting anyway, under certain 
(simplified) conditions.

But then, by version 4.00 the checksumiso.pl file was gone (by means of 
the commit I posted in my prior email) and instead "_some kind of_ 
checksum" is introduced in isolinux.bin when building it from source.

Apparently, one of the consequences seems to be that the default 
checksum included in isolinux.bin doesn't seem to help those 
users/programs that, for whichever reason (e.g. user lacking 
knowledge), do not patch the boot info table.

So, my question is whether there is some intentional reason for these 
changes in isolinux.bin. Perhaps the "new" content (since 4.00) 
provides other improvements, or it is compatible with other features 
(e.g. isohybrid perhaps?) but the "old" potentially-helpful checksum 
can no longer be calculated or saved (within isolinux.bin) in the same 
way as it was before (i.e. 2.12-3.86). Is that the issue?

So, to be clear, I am not asking how mkisofs or xorriso are patching 
the boot info table or how ISO-building tools are patching isolinux.bin 
with their own calculated checksum. What I'd like to know is what 
happened with the "default" checksum in isolinux.bin, that was 
previously correctly calculated by checksumiso.pl (and now, it seems to 
be incorrect).

Summing up, in upstream isolinux.bin (with no relation to specific 
ISO-building tools, nor their command lines at the time of building ISO 
images), how is/are the checksum(s) calculated now? Are this/these 
calculation(s) / results "correct", or "expected"? Is it possible that 
the current calculation is incorrect / a bug / not ideal / not taking 
the adequate range of values as input? Is there any way to improve this 
situation?

TIA,
Ady.



More information about the Syslinux mailing list