[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#776317: Jessie RC1 amd64 mini image missing efi bootloader



Hi,

Jack Truong wrote:
> I have copied the contents of efi.img to the FAT partition and it does boot
> on my EFI firmware now. Thank you!

So your EFI indeed hopped on that partition.
Possibly only because it sees no other indication where to start
the boot process.

I now wonder whether the MBR partition 2 is actually intended
as EFI System Partition.
The partition type 0x01 generally indicates a FAT12 filesystem.
An EFI partition should have type 0xef.

Regrettably there is no file /.disk/mkisofs in the ISO which
tells the used xorriso -as mkisofs options.
I guess that /boot/grub/efi.img got marked by an option like

  -e boot/grub/efi.img

To mark this file in MBR and GPT, one may add option

  -isohybrid-gpt-basdat

directly after -e and its argument.

I tested by extracting the MBR and partition 2 from mini.iso,
mounting it, and repacking a new mini_with_gpt.iso by:

  $ dd if=mini.iso bs=512 count=1 of=mini_template.mbr

  $ dd if=mini.iso bs=512 skip=45056 count=12288 of=mini_partition2.img

  $ mount -o loop mini.iso /mnt/iso

  $ xorriso -as mkisofs -R \
      -o mini_with_gpt.iso \
      -isohybrid-mbr mini_template.mbr \
      -c '/boot.cat' \
      -b '/isolinux.bin' \
        -no-emul-boot -boot-load-size 4 -boot-info-table \
      -eltorito-alt-boot \
      -e '/boot/grub/efi.img' \
        -isohybrid-gpt-basdat -no-emul-boot \
      -append_partition 3 0x01 mini_partition2.img \
      /mnt/iso

This yields:

  Volume id    : 'ISOIMAGE'
  El Torito catalog  : 45  1
  El Torito cat path : /boot.catalog
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4          46
  El Torito boot img :   2  UEFI  y   none  0x0000  0x00    832          66
  El Torito img path :   1  /isolinux.bin
  El Torito img opts :   1  boot-info-table isohybrid-suitable
  El Torito img path :   2  /boot/grub/efi.img
  System area options: 0x00000102
  System area summary: MBR isohybrid cyl-align-on GPT
  ISO image size/512 : 45056
  Partition offset   : 0
  MBR heads per cyl  : 64
  MBR secs per head  : 32
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0x00            0        45056
  MBR partition      :   2   0x00  0xef          264          832
  MBR partition      :   3   0x00  0x01        45056        12288
  MBR partition path :   2  /boot/grub/efi.img
  GPT                :   N  Info
  GPT disk GUID      :      61bf3bd0595c364488002bde6f8fecfb
  GPT entry array    :      2  248  overlapping
  GPT lba range      :      64  44992  45055
  GPT partition name :   1  490053004f00480079006200720069006400
  GPT partname local :   1  ISOHybrid
  GPT partition GUID :   1  61bf3bd0595c364488022bde6f8fecfb
  GPT type GUID      :   1  a2a0d0ebe5b9334487c068b6b72699c7
  GPT partition flags:   1  0x1000000000000001
  GPT start and size :   1  0  44992
  GPT partition name :   2  490053004f004800790062007200690064003100
  GPT partname local :   2  ISOHybrid1
  GPT partition GUID :   2  61bf3bd0595c364488032bde6f8fecfb
  GPT type GUID      :   2  a2a0d0ebe5b9334487c068b6b72699c7
  GPT partition flags:   2  0x1000000000000001
  GPT start and size :   2  264  832
  GPT partition path :   2  /boot/grub/efi.img

Now the empty FAT12 filesystem is in MBR partition 3.
It is unclear whether it is usiable on a system that knows about GPT.
(Maybe i should enhance -append_partition so that it publishes
 the partition in GPT too.)

Of course, if the empty 6 MB partition is undesired in a 22.5 MB
ISO, then one can omit option
  -append_partition 3 0x01 mini_partition2.img \
from above xorriso run.

If one wants to eradicate GPT and only keep MBR:

  $ cp mini_with_gpt.iso mini_with_mbr_efi.iso

  $ dd if=/dev/zero bs=512 count=1 seek=1 conv=notrunc of=mini_with_mbr_efi.iso

  $ dd if=/dev/zero bs=512 count=1 seek=45055 conv=notrunc of=mini_with_mbr_efi.iso

(The backup GPT header is the last 512 block of the ISO
 filesystem range. Probably the appended partition data
 prevent it from being recognized at all.)


Have a nice day :)

Thomas


Reply to: