Hi,

Andy Smith wrote:
> Currently when I add the Debian 12 netinst ISO as a virtual media it
> EFI boots grub, not isolinux,

That's because Debian ISOs advertise a EFI System Partition with GRUB
initial boot equipment:

  $ xorriso -indev debian-12.2.0-amd64-netinst.iso \
            -report_el_torito plain -report_system_area plain
  ...
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4        5863
  El Torito boot img :   2  UEFI  y   none  0x0000  0x00  18976        1119
  El Torito img path :   1  /isolinux/isolinux.bin
  El Torito img opts :   1  boot-info-table isohybrid-suitable
  El Torito img path :   2  /boot/grub/efi.img
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0x00            0      1286144
  MBR partition      :   2   0x00  0xef         4476        18976
  MBR partition path :   2  /boot/grub/efi.img

The file /boot/grub/efi.img is a FAT filesystem image.
One could mount it read-write

  mount -o offset=2291712 /dvdbuffer/debian-12.2.0-amd64-netinst.iso /mnt/fat

and manipulate it inside the ISO. (2291712 = 4476 * 512)
But new SYSLINUX content would be an expert task and would not work from
optical media, because SYSLINUX EFI from CDROM is broken and will hardly
ever be fixed.


> I guess I need to find the grub configuration that is in use from
> the ISO and add the usual
>    serial --unit=1 --speed=115200 --word=8 --parity=no --stop=1
>    terminal_input serial
>    terminal_output serial

Such stuff is in the /boot/grub/ directory of the ISO. The sparse config
in the EFI partition /mnt/fat/efi/debian/grub.cfg

  search --file --set=root /.disk/id/1af76032-4f8c-416b-90c5-76b1833daf0a
  set prefix=($root)/boot/grub
  source $prefix/${grub_cpu}-efi/grub.cfg

loads one of the ISO files  /boot/grub/*-efi/grub.cfg  which both load
/boot/grub/grub.cfg :

  source /boot/grub/grub.cfg


Problem is that the FAT filesystem is tightly wrapped around its content:

  $ df /mnt/fat
  Filesystem     1K-blocks  Used Available Use% Mounted on
  /dev/loop0          9450  9446         4 100% /mnt/fat

If you can omit 32-bit EFI, then there would be plenty of room to recover
by deleting

  -rwxr-xr-x 1 root root  758552 Oct  7  2023 /mnt/fat/efi/boot/bootia32.efi
  -rwxr-xr-x 1 root root 3753408 Oct  7  2023 /mnt/fat/efi/boot/grubia32.efi


> Should I just edit that into $iso_root/boot/grub/grub.cfg and repack
> the ISO?

If altering the EFI partition is not viable, then surely: Yes.
(The debian-cd people might already object manipulations of their
carefully composed EFI partition.)


> Is there any documentation page about this?

Repacking ISOs:
  https://wiki.debian.org/RepackBootableISO
Especially look at this example:
  
https://wiki.debian.org/RepackBootableISO#In_xorriso_load_ISO_tree_and_write_modified_new_ISO

(Beware of bug with -boot_image "any" "replay" in xorriso <= 1.5.6:
Do not overwrite the BIOS boot image /isolinux/isolinux.bin by the
manipulation commands like -map.)


Have a nice day :)

Thomas

Reply via email to