Hi,

Roland Clobus wrote:
> So there are 3 scenarios to consider:
> A) grub-pc for BIOS, no EFI boot
> B) grub-pc for BIOS, grub-efi for EFI
> C) no BIOS boot, grub-efi for EFI
>
> Am I right that the command line options to xorriso should be:

-------------------------------------------------------------------
Jumping ahead, i give the appropriate options for these cases, using the
sequence of legacy BIOS options as in scripts/build/binary_iso although
this sequence could be improved:

A) grub-pc for BIOS, no EFI boot

  -grub2-boot-info -grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img
  -no-emul-boot -boot-load-size 4 -boot-info-table
  -b boot/grub/grub_eltorito

B) grub-pc for BIOS, grub-efi for EFI

  -grub2-boot-info -grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img
  -no-emul-boot -boot-load-size 4 -boot-info-table
  -b boot/grub/grub_eltorito
  -eltorito-alt-boot
  -e boot/grub/efi.img -no-emul-boot -efi-boot-part --efi-boot-image

C) no BIOS boot, grub-efi for EFI

  -e boot/grub/efi.img -no-emul-boot -efi-boot-part --efi-boot-image

As one can see:  B = A + eltorito-alt-boot + C.

All three cases are assumed with "iso-hybrid".
Without "iso-hybrid" the follwoing options should be omitted:

  -grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img
  -efi-boot-part --efi-boot-image

----------------------------------------------------------------------
Back to conversation:

> When grub-pc is to be used:
> --grub2-boot-info --grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img (from
> line 80)
> -no-emul-boot -boot-load-size 4 -boot-info-table (from line 132)
> -b boot/grub/grub_eltorito (from line 133)

Looks ok.

But --grub2-boot-info is an add-on to option to -b, like -no-emul-boot
-boot-load-size 4 -boot-info-table.
In scripts/build/binary_iso it is bound to "iso-hybrid" but should be
bound to "grub-pc". Consider to move it under line 131:

  grub-pc)
    XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 
-boot-info-table"


(I am not sure what GRUB does when it was not applied. Probably it can
learn what it needs to know from -boot-info-table. Both options cause
ISO 9660 block addresses to be written into the boot image, so that it
can find itself in the ISO after BIOS loaded and started the first 2048
bytes of it.)


> When grub-efi is to be used:
> -e boot/grub/efi.img -no-emul-boot (from line 162)

So far it is good. But ...

> -isohybrid-gpt-basdat (from line 163)

This is appropriate only in the "syslinux" case, but not in the
"grub-pc" case.

-isohybrid-gpt-basdat belongs to the isohybrid feature of ISOLINUX.
It produces GPT only if options -isohybrid-mbr or -part_like_isohybrid
are given. That's the reason why the decision for "grub-pc" and its
option --grub2-mbr causes the need for  a different GPT related option
as can be found in grub-mkrescue.c:

  -efi-boot-part --efi-boot-image

Option -efi-boot-part gets one argument:
- Either the disk path of a file which shall be appended to the ISO image
  and then marked by a GPT partition,
- or the keyword "--efi-boot-image" which causes the GPT partition to
  mark the file content of the file given by option -e.

live-build and grub-mkrescue.c both choose the latter variation.


> When both grub-pc and grub-efi are to be used, in addition:
> -efi-boot-part --efi-boot-image (from line 81)

Yes. As said, because "grub-pc" prevents option -isohybrid-mbr and thus
keeps -isohybrid-gpt-basdat from producing GPT.

But think it is somewhat confusing to add them in line 81, just
because the option for GRUB's own equivalent of "isohybrid" for legacy
BIOS equipment is added in line 80.
I think the two EFI related options should only be added if EFI is
desired. I.e. in line 163, where -isohybrid-gpt-basdat is useless in
in the "grub-pc" case.

I now see that both variations of GPT related options should be bound
to "iso-hybrid". So my proposal for line 160 ff. is now:

  if [ -e binary/boot/grub/efi.img ]; then
    XORRISO_OPTIONS="${XORRISO_OPTIONS} -e boot/grub/efi.img -no-emul-boot"
    if [ "${LB_IMAGE_TYPE}" = "iso-hybrid" ]
    then
      if [ "${LB_BOOTLOADER_BIOS}" = "grub-pc" ]
      then
        XORRISO_OPTIONS="${XORRISO_OPTIONS} -efi-boot-part --efi-boot-image"
      else
        XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-gpt-basdat 
-isohybrid-apm-hfsplus"
      fi
    fi
  else
    Echo_message "No EFI boot code to include in the ISO"
  fi


(I am quite sure that the combination of "grub-legacy" and "iso-hybrid"
cannot be fulfilled. At least i never implemented MBR-to-El-Torito code
for the old "menu.lst" GRUB.)


> -eltorito-alt-boot (from line 155)

This option separates the realm of option -b from the realm of option -e.
It has to be present whenever both -b and -e are present.


I would have written the legacy BIOS options in a slighty different
sequence, to emphasize that -b is boss and the others are add-ons:

  -grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img
  -b boot/grub/grub_eltorito
  -no-emul-boot -boot-load-size 4 -boot-info-table -grub2-boot-info

But for the result it only matters that they are on the right side of
option -eltorito-alt-boot, if a second boot image gets added by -e.


Have a nice day :)

Thomas

Reply via email to