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?