Hi,

Robert Heller wrote:
> Originally, the Linux boot (live / install) images were just a raw ISO-9660
> file system image, normally ment to be "burned" onto an optical disk (write
> once CD-ROM or one of the various flavors of writable DVDs). PC BIOS's (before
> UEFI/Secure boot) would treat a USB drive with an ISO-9660 file system just
> like a CD-ROM

It is a bit different.

Legacy BIOS looks on CD, DVD, or Blu-ray for an El Torito Boot Record
at block address 17 (decimal) which would point to a Boot Catalog which
lists boot images.
In a Debian amd64 ISO, there are two boot images. One for Legacy
BIOS and one for EFI. Both are also accessible as files in the ISO:

  $ xorriso -indev debian-13.5.0-amd64-netinst.iso -report_el_torito plain
  ...
  El Torito images   :   N  Pltf  B   Emul  Ld_seg  Hdpt  Ldsiz         LBA
  El Torito boot img :   1  BIOS  y   none  0x0000  0x00      4        2828
  El Torito boot img :   2  UEFI  y   none  0x0000  0x00   7200        1028
  El Torito img path :   1  /isolinux/isolinux.bin
  El Torito img opts :   1  boot-info-table isohybrid-suitable
  El Torito img path :   2  /boot/grub/efi.img

But on USB stick a legacy BIOS will look for a Master Boot Record at
the very beginning of the USB stick. The first 446 bytes are x86
machine code which is supposed to start up the operating system.
The next 64 bytes are the MBR partition table.
In case of a Debian amd64 ISO, the MBR code stems from the SYSLINUX
project (department ISOLINUX). During ISO production it learns the
block address of /isolinux/isolinux.bin, so that it can load and start
that program. This is called "isohybrid".

  $ xorriso -indev debian-13.5.0-amd64-netinst.iso -report_system_area plain
  ...
  System area summary: MBR isohybrid cyl-align-on GPT APM
  ...
  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0x00            0      1546240
  MBR partition      :   2   0x00  0xef         4112         7200
  MBR partition path :   2  /boot/grub/efi.img

>From this point both storage media families are handled the same way.
But the initial boot lures differ.


> I think the newer images, which are meant to be imaged onto
> flash drives, have a partituon table and a FAT32 UEFI partition, plus the
> bootable ISO-9660 file system in a separate partition.

isohybrid for legacy BIOS was introduced before EFI support. It brought
a first partition table with one entry and "boot" flag in order to keep
partition editors from re-using the block range of the ISO filesystem
and to appease HP firmware which would not start MBR code without
seeing such a partition.
More or less like partition 1 in a modern Debian amd64 ISO.

EFI support came a few years later. El Torito boot sector, catalog, and
MBR partition table or GPT point to the same EFI System Partition /
Boot image, which is a FAT filesystem with .efi programs. The partition
layout of the contemporary Debian amd64 ISOs was invented for Fedora
(http://mjg59.dreamwidth.org/11285.html , 2012) and implemented in the
already existing ISOLINUX program named "isohybrid".

It became one of the layouts which can be produced by xorriso.
Dirty, hunchbacked, mildly specs violating ... but boots about
everywhere.
Other distros have abandoned it long ago in favor of neater
partitioning at the price of leavng behind dirty, hunchbacked, mildly
specs violating firmwares.

How this all works on byte level is documented in
  
https://dev.lovelyhq.com/libburnia/libisofs/raw/branch/master/doc/boot_sectors.txt
Most of it is used in the Debian ISOs for the respective CPU
architectures. (Some of them have possibly died out meanwhile ...)


Have a nice day :)

Thomas

Reply via email to