xorriso: boot.catalog and -eltorito-catalog not working

3

I've been trying to create a bootable CD with xorriso by using a custom boot.catalog file in order to - that was my goal - specify the LBA my boot sector should be placed at. However, the xorriso option -eltorito-catalog does not seem to use my custom boot.catalog, instead, it creates a new catalog which is then placed in the final ISO image.

My custom boot.catalog looks like this (shortened, rest is cleared):

 $ xxd boot.catalog | head -n 8
00000000: 0100 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 aa55 55aa  .............UU.
00000020: 8800 0000 0000 0400 2000 0000 0000 0000  ........ .......
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
[...]

My understanding was that the DWORD at 0x00000028 (2000 0000, LBA 32) is used to place the boot image at the specified LBA in the bootable CD medium. I am using the following command to create a new bootable ISO image:

 $ xorriso -as mkisofs -iso-level 3 -full-iso9660-filenames -eltorito-boot bootimg.bin -eltorito-catalog boot.catalog -no-emul-boot -boot-load-size 4 -boot-info-table -o test2.iso build

The resulting ISO image looks as follows:

 $ isoinfo -i test2.iso -l -s

Directory listing of /
d---------   0    0    0               1 Mar 17 2020 [     19 02]  . 
d---------   0    0    0               1 Mar 17 2020 [     19 02]  .. 
----------   0    0    0               1 Mar 17 2020 [     33 00]  boot.catalog;1 
----------   0    0    0               1 Mar 17 2020 [     34 00]  bootimg.bin;1 
----------   0    0    0               1 Mar 17 2020 [     35 00]  bootstrap.bin;1

As you can see, the bootimg.bin boot image is located at LBA 34 (instead of 32, as written in my boot.catalog). Also, extracting and dumping the boot.catalog from the resulting ISO gives me:

 $ xxd boot.catalog | head -n 8
00000000: 0100 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 aa55 55aa  .............UU.
00000020: 8800 0000 0000 0400 2200 0000 0000 0000  ........".......
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
[...]

My question is, depending on my understanding: Why is the boot image placed at a different sector (and why is my boot.catalog being replaced with a new, different one)?

If my understanding of the -eltorito-catalog option is wrong: Is there a way to tell xorriso where to start writing files at in the ISO image? Are there ways to tell xorriso where to place files in the CD?

boot
iso
bootable
iso9660
asked on Stack Overflow Mar 17, 2020 by CRoemheld • edited Mar 17, 2020 by CRoemheld

1 Answer

1

It seems that xorriso actually provides an option which modifies the boot image by placing additional information, like the sector the boot image was loaded from, into a structure which can be accessed from assembly code. The option -boot-info-table places a structure at offset 8 which looks like this:

DWORD boot_image_pvd
DWORD boot_image_lba
DWORD boot_image_len
DWORD boot_image_checksum

The entire structure is written between bytes 8 and 63 in the boot image.

  • boot_image_pvd is the block of the Primary Volume Descriptor
  • boot_image_lba is the block where the first 2 KB of the boot image were loaded from
  • boot_image_len is the length of the entire boot image (in bytes)

More information here.

answered on Stack Overflow Mar 18, 2020 by CRoemheld

User contributions licensed under CC BY-SA 3.0