Hi,

my assembler reading skills are obviously insufficient. It turns out that
the bytes in the MBR partition table range are not significant for booting
the ISO from qemu -hda.

I boldly zeroed them in a copy of the GNU/Hurd ISO and it still boots.
(To make sure that it does not boot by El Torito i copied the
 terminating volume descriptor from block 19 to block 17.)

Encouraged by this outcome, i repacked the ISO by these commands:

  # Obtain GRUB image file from start of original ISO
  dd if=debian-hurd-2017-i386-NETINST-1.iso bs=2048 count=16 of=grub_embed

  mount debian-hurd-2017-i386-NETINST-1.iso /mnt/iso

  # Most options as learned from file /mnt/iso/.disk/mkisofs
  # but adding option --protective-msdos-label to create a partition table.
  xorriso  -as mkisofs \
    -o test.iso \
    -J -joliet-long -r \
    -V 'Debian 9.0 h-i386 n' \
    --embedded-boot grub_embed \
    --protective-msdos-label \
    -cache-inodes \
    -c boot/boot.cat \
    -b boot/grub/grub_eltorito \
       -no-emul-boot -boot-load-size 4 -boot-info-table -no-pad \
    /mnt/iso

The resulting test.iso boots as qemu -hda to the same GRUB menu as
the original ISO.

The partition table is what grub-mkrescue would ask for in case of
i386-pc without any efi platform:

  $ sbin/fdisk -lu test.iso
  ...
  Disklabel type: dos
  ...
  Device     Boot Start    End Sectors   Size Id Type
  test.iso1  *        1 311555  311555 152.1M cd unknown

This partition is not mountable because of its start offset 1.
But that's how Vladimir wanted it for grub-mkrescue.

------------------------------------------------------------------
Udate after receiving reply on grub-devel:
  http://lists.gnu.org/archive/html/grub-devel/2017-06/msg00043.html

Vladimir 'phcoder' Serbinenko wrote:
> Those are only for floppies with old BIOS. If your image is over 2.88 MiB
> and thus never useful on floppies, it's safe to overwrite.

This explains why it looks like somewhat plausible executable code
and why i386-pc/boot.img of Debian 8 is in the state it is in.


------------------------------------------------------------------

So my proposal to Debian GNU/Hurd is to boldly add option 
  --protective-msdos-label
to the debian-installer run of xorriso -as mkisofs for hurd.

If an empty partition table is desired instead, then at least zeroize
the 64 bytes beginning at offset 446 of file "grub_embed" before it
gets handed over to xorriso.


Have a nice day :)

Thomas

Reply via email to