bug-xorriso
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xorriso modifies file


From: Thomas Schmitt
Subject: Re: xorriso modifies file
Date: Wed, 29 Apr 2020 17:29:05 +0200

Hi,

Adda Rathbone wrote:
> I stumbled about an md5sum mismatch for a file when generating an iso image
> with xorriso (version 1.4.8):
> 59e8ae36353a50a11ae1fd2abc5cc52d  image/isolinux/bios.img
> 9eec18586e3cd22143ba6df562b7d97a  iso/isolinux/bios.img
> At least the bytes 9 to 24 have been changed from zero to something else:
> First 32 bytes of  iso/isolinux/bios.img:
> 00000000: e800 00eb 3b00 0000 1000 0000 2200 0000  ....;......."...
> 00000010: 5f60 0300 1f64 3238 0000 0000 0000 0000  _`...d28........

This would be the necessary changes caused by -as mkisofs option

  -boot-info-table
     Overwrite  bytes  8  to  63  in  the  current  boot  image.  The
     information  will  be supplied by xorriso in the course of image
     production: Block address  of  the  Primary  Volume  Descriptor,
     block  address  of  the  boot image file, size of the boot image
     file.

The format is little endian. So the table says:
PVD at block 0x00000010 = 16, bios.img at block 0x00000022 = 34,
size in bytes 0x0003605f = 221279 , (plus checksum 0x3832641f).
16 is standard, 34 could be verified by the output of

  xorriso -indev ubuntu-from-scratch.iso -report_el_torito plain

which should report:

  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4          34


The El Torito boot images of ISOLINUX and GRUB for PC-BIOS need this
information to load the bulk of their program code. BIOS gets only
instructed to load the first 4 * 512 bytes. The rest has to be done by
the code in these bytes.


> xorriso \
>    -as mkisofs \
>    [...]
>    -eltorito-boot boot/grub/bios.img \
>    -no-emul-boot \
>    -boot-load-size 4 \
>    -boot-info-table \
>    [...]
>      /boot/grub/bios.img=isolinux/bios.img

So /boot/grub/bios.img in the ISO was isolinux/bios.img on hard disk.

But why is the file with the boot info table named "iso/isolinux/bios.img" ?


> What would be the correct way to generate an iso with matching
> md5 sums?

I take this as: How to predict the checksum of bios.img in the ISO ?

Since the LBA of the boot image file in the ISO cannot be easily
predicted, the only way i can imagine is to make use of the fact that
xorriso is prepared for reproducible ISO image production. This
implies that the position of the boot image file will be always the
same if the program version, the program options and the input
file trees are the same.

So you would have to build a first ISO image where the pre-recorded
checksum of bios.img will be wrong, extract this file, compute its
checksum, and use it for building a second ISO with identical options
and identical other input files.
The production of the second ISO will write the same bytes into the
boot image file as it already contains. So the checksum will stay
correct.


Have a nice day :)

Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]