Re: Testing requested: Hybrid ISO/USB boot

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Testing requested: Hybrid ISO/USB boot

Thomas Schmitt
Hi,

Benno Rice wrote:
> I’ve been working on the ability to create hybrid ISO/HDD boot images for
> x86, a la what Linux systems do with ISOHYBRID.

Waving friendly over the fence i feel entitled to give some neighbor's
review.


> The general theory seems to
> be that ISO images have a 32KB hunk of zeroes at the front that they
> generally ignore

It is called System Area. ECMA-119, 6.2.1:
"The System Area shall occupy the Logical Sectors with Logical Sector
 Numbers 0 to 15. The System Area shall be reserved for system use.
 Its content is not specified by this Standard."

I collected some info about possible stuffings in
  https://dev.lovelyhq.com/libburnia/libisofs/raw/master/doc/boot_sectors.txt


> Legacy BIOS with HDD: Sees a DOS MBR [...] sees an active BSD
> slice containing a variant of our BSD boot code that reads from the ISO
> [...] This finds loader in the ISO filesystem

The isohybrid MBRs of SYSLINUX and GRUB expect to get patched-in the block
address of the El Torito no-emulation boot image. To be done by SYSLINUX
program "isohybrid", or xorrisofs options -isohybrid-mbr , --grub2-mbr.

They try to stay small in order to create room for fancy partition tables
GPT and APM. The MBR code even begins by a no-op area where one can put
APM magic numbers which happen to be harmless x86 machine code.


> https://people.freebsd.org/~benno/hybrid-bootonly.iso.xz

This does not look much like it addresses EFI.

  $ xorriso -indev hybrid-bootonly.iso -report_el_torito plain -report_system_area plain
  ...
  El Torito catalog  : 19  1
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4          20
  El Torito boot img :   2  BIOS  y   none  0x0000  0x00   1600          24
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0xa5            1           16

UEFI 2.4, 12.3.2.1, says about El Torito:
"A Platform Id of 0xEF indicates an EFI System Partition."
But entry 2 of this catalog is in a section with Platform Id 0x00 (x86 BIOS).

If byte 38977 (decimal) was 0xef rather than 0x00, then it would be marked
as an El Torito boot image for EFI.

Further: This section begins at byte address 38976 by a byte value 0x90.
According to El Torito specs this means that another section follows.
Correct would be value 0x91, which announces the end of the catalog.
(El Torito 1.0, Figure 4, Offset 0)


On HDD, EFI looks for specially marked partitions in GPT or MBR partition
table.
In MBR partiton table it looks for a partition of type 0xEF.
(UEFI 2.4, 5.2.2)
In GPT it looks for Type GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B.
(UEFI 2.4, Table 19)

So to mark the EFI partition, hybrid-bootonly.iso should have a MBR
partition number 2 with type 0xEF, start at 512-byte block 24*2048/512 = 96,
size 1600 blocks.
(Strangely El Torito addresses by 2048-byte blocks but counts by 512-byte
 blocks. Size limit is 65535 blocks. But counts 0 and 1 mean to EFI
 "up to end of medium".)


> I’ve tested this image under qemu

OVMF/SDK-II/Tianocore is too tolerant with the EFI specs and with silently
using BIOS boot equipment. Real iron EFIs insist much more in compliance.


Have a nice day :)

Thomas

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Testing requested: Hybrid ISO/USB boot

Benno Rice-2


> On Mar 22, 2018, at 1:48 PM, Thomas Schmitt <[hidden email]> wrote:
>
> Hi,
>
> Benno Rice wrote:
>> I’ve been working on the ability to create hybrid ISO/HDD boot images for
>> x86, a la what Linux systems do with ISOHYBRID.
>
> Waving friendly over the fence i feel entitled to give some neighbor's
> review.

Hello! Thanks for your response.

[snip]

>> https://people.freebsd.org/~benno/hybrid-bootonly.iso.xz
>
> This does not look much like it addresses EFI.
>
>  $ xorriso -indev hybrid-bootonly.iso -report_el_torito plain -report_system_area plain
>  ...
>  El Torito catalog  : 19  1
>  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
>  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4          20
>  El Torito boot img :   2  BIOS  y   none  0x0000  0x00   1600          24
>  ...
>  MBR partition table:   N Status  Type        Start       Blocks
>  MBR partition      :   1   0x80  0xa5            1           16
>
> UEFI 2.4, 12.3.2.1, says about El Torito:
> "A Platform Id of 0xEF indicates an EFI System Partition."
> But entry 2 of this catalog is in a section with Platform Id 0x00 (x86 BIOS).
>
> If byte 38977 (decimal) was 0xef rather than 0x00, then it would be marked
> as an El Torito boot image for EFI.

I think I’ve addressed this in this revision:

https://svnweb.freebsd.org/changeset/base/331463 <https://svnweb.freebsd.org/changeset/base/331463>

And I’ve regenerated the image here:

https://people.freebsd.org/~benno/hybrid-bootonly-20180323-00.iso.xz <https://people.freebsd.org/~benno/hybrid-bootonly-20180323-00.iso.xz>

> Further: This section begins at byte address 38976 by a byte value 0x90.
> According to El Torito specs this means that another section follows.
> Correct would be value 0x91, which announces the end of the catalog.
> (El Torito 1.0, Figure 4, Offset 0)

I’ll look into this too.

> On HDD, EFI looks for specially marked partitions in GPT or MBR partition
> table.
> In MBR partiton table it looks for a partition of type 0xEF.
> (UEFI 2.4, 5.2.2)
> In GPT it looks for Type GUID C12A7328-F81F-11D2-BA4B-00A0C93EC93B.
> (UEFI 2.4, Table 19)
>
> So to mark the EFI partition, hybrid-bootonly.iso should have a MBR
> partition number 2 with type 0xEF, start at 512-byte block 24*2048/512 = 96,
> size 1600 blocks.
> (Strangely El Torito addresses by 2048-byte blocks but counts by 512-byte
> blocks. Size limit is 65535 blocks. But counts 0 and 1 mean to EFI
> "up to end of medium”.)

I’ll look in to this one too.

>> I’ve tested this image under qemu
>
> OVMF/SDK-II/Tianocore is too tolerant with the EFI specs and with silently
> using BIOS boot equipment. Real iron EFIs insist much more in compliance.

So it appears. Thanks again for looking at this!

Thanks,
        Benno.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Testing requested: Hybrid ISO/USB boot

Thomas Schmitt
Hi,

i wrote:
> > If byte 38977 (decimal) was 0xef rather than 0x00, then it would be marked
> > as an El Torito boot image for EFI.

Benno Rice wrote:
> I’ve regenerated the image here:
> https://people.freebsd.org/~benno/hybrid-bootonly-20180323-00.iso.xz

Looks better now:

  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4          20
  El Torito boot img :   2  UEFI  y   none  0x0000  0x00   1600          24


Have a nice day :)

Thomas

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Testing requested: Hybrid ISO/USB boot

O'Connor, Daniel-2
In reply to this post by Benno Rice-2


> On 24 Mar 2018, at 07:31, Benno Rice <[hidden email]> wrote:
> I think I’ve addressed this in this revision:
>
> https://svnweb.freebsd.org/changeset/base/331463 <https://svnweb.freebsd.org/changeset/base/331463>
>
> And I’ve regenerated the image here:
>
> https://people.freebsd.org/~benno/hybrid-bootonly-20180323-00.iso.xz <https://people.freebsd.org/~benno/hybrid-bootonly-20180323-00.iso.xz>

Hi Benno,
I tried this image on a Supermicro SYS-5019S-M (X11SSH-Fmotherboard) and it boots both ways (USB was via a USB stick, ISO was via the IPMI CD emulation with the Java JNLP applet)

The USB way booted legacy and the CD emulation booted UEFI (not sure if that's significant).

I also tried renaming it to .img and then telling the JNLP applet it was a hard disk image but the BIOS didn't detect it.

It also has a 'Web ISO' option but I can't figure out how you're supposed to enter a URL so I couldn't try it.

Thanks for the work!

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[hidden email]"