public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Heyi Guo <heyi.guo@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: How can we identify an ISO file is an EFI bootable ISO image?
Date: Tue, 20 Jun 2017 18:47:10 +0200	[thread overview]
Message-ID: <46cef850-9a4f-b521-a379-037dae1d1a2b@redhat.com> (raw)
In-Reply-To: <30c8ed8a-9ed5-0472-acbe-1d8b17fb38fb@linaro.org>

On 06/20/17 14:34, Heyi Guo wrote:
> Is there any simple tool to parse ISO images (El Torito partition) and
> identify whether it is EFI bootable?

$ dumpet --iso Fedora-Server-dvd-aarch64-25-20161015.n.0.iso

  Validation Entry:
          Header Indicator: 0x01 (Validation Entry)
          PlatformId: 0xef (EFI)                      <---------- [1]
          ID: ""
          Checksum: 0x66aa
          Key bytes: 0x55aa
  Boot Catalog Default Entry:
          Entry is bootable
          Boot Media emulation type: no emulation     <---------- [2]
          Media load address: 0 (0x0000)
          System type: 0 (0x00)
          Load Sectors: 9208 (0x23f8)
          Load LBA: 2456 (0x00000998)

The source for dumpet is at <https://github.com/rhboot/dumpet>.

> I think EFI bootable image should contain a FAT volume so that EFI can
> load bootxx.efi file from the file system.

For a large Wiki page on this, I can recommend:
<https://fedoraproject.org/wiki/User:Pjones/BootableCDsForBIOSAndUEFI>.

For a short summary, these are the commands you need, to format an
EFI-bootable (and EFI-only) CD-ROM:

(1) Create a non-partitioned FAT image in a file, with "mkdosfs -C", and
    populate it with the "mtools" utilities.

    For a heavier-weight (but also a lot more feature-ful) toolset, you
    can also use libguestfs / guestfish.

(2) Generate the ISO image like this:

    genisoimage -input-charset ASCII -J -rational-rock \
      -efi-boot "$FAT_IMAGE_FILE" -no-emul-boot \
      -o "$ISO_IMAGE" -- "$FAT_IMAGE_FILE"

    So what you do is, create an ISO9660 filesystem with the FAT image
    file copied into it as a normal file (simply to the root directory).
    You can enable Joliet and/or RockRidge extensions if you want to,
    but those aren't necessary. Then, you set the EFI boot image name
    with "-efi-boot" [1], and also specify that the boot image is a "no
    emulation" [2] image
    <https://en.wikipedia.org/wiki/El_Torito_(CD-ROM_standard)#Boot_modes>.

> Several tools like mount in Linux will show all files together
> including EFI/BOOT directory,

That directory, displayed as part of the ISO9660 filesystem that was
written to the ISO image / CD-ROM, is entirely irrelevant when it comes
to UEFI-bootability. I doesn't even need to exist, and if it does, it's
likely there only for convenience reasons (so that people don't have to
run "dumpet" or similar tools to extract the FAT image first, and then
the EFI binaries second, if they want to investigate the EFI binaries).

For UEFI boot, only the ElTorito image matters.

> so if an ISO image contains such files but not organizes the data in a
> FAT sub-volume as EFI requires, I can't see any difference.

In order to extract the ElTorito image(s), use "dumpet --dumpdisks", and
then work on the extracted files with guestfish or mtools. For example:

$ MTOOLS_SKIP_CHECK=1 mdir -i extracted.iso.0  -/ ::

Thanks
Laszlo


  reply	other threads:[~2017-06-20 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 12:34 How can we identify an ISO file is an EFI bootable ISO image? Heyi Guo
2017-06-20 16:47 ` Laszlo Ersek [this message]
2017-06-20 17:36   ` Rod Smith
2017-06-20 18:11     ` Laszlo Ersek
2017-06-21  0:48   ` Heyi Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46cef850-9a4f-b521-a379-037dae1d1a2b@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox