"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/doc/boot_sectors.txt" (30 Jan 2021, 78788 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "boot_sectors.txt": 1.5.2_vs_1.5.4.

    1 
    2 
    3 
    4             Collection of Boot Sector Formats for ISO 9660 Images
    5 
    6 
    7             by Thomas Schmitt    - scdbackup@gmx.net
    8             Libburnia project    - bug-xorriso@gnu.org
    9                                    pkg-libburnia-devel@lists.alioth.debian.org
   10 
   11 This information is collected from various sources. Some is backed by
   12 specifications, some is just rumor which happens to work (maybe not even that).
   13 
   14 
   15                                   Content
   16 
   17 EL Torito CD booting, for PC-BIOS x86, PowerPC, (old) Mac, EFI.
   18 
   19 Boot Info Table and GRUB2 Boot Info
   20 
   21 Master Boot Record (MBR), for PC-BIOS x86 from (pseudo-) hard disk
   22 
   23 Apple Partition Map (APM), for more modern Mac
   24 
   25 GUID Partition Table (GPT), for EFI from (pseudo-) hard disk
   26 
   27 MIPS Volume Header, for MIPS Big Endian, e.g. SGI Indigo2.
   28 
   29 DEC Boot Block, for MIPS Little Endian , e.g. DECstation.
   30 
   31 SUN Disk Label and boot images, for SUN SPARC
   32 GRUB2 SUN SPARC Core File Address
   33 
   34 PowerPC Reference Platform (PReP), for IBM PowerPC
   35 
   36 Common Hardware Reference Platform (CHRP), for IBM PowerPC
   37 
   38 HP-PA via PALO header version 4
   39 HP-PA via PALO header version 5
   40 
   41 DEC Alpha SRM boot sector, for Alpha architecture
   42 
   43 Combinations of boot mechanisms:
   44 - SYSLINUX isohybrid MBR
   45 - SYSLINUX isohybrid for MBR, UEFI and x86-Mac
   46 - GRUB2 grub-mkrescue MBR
   47 >>> Mac and/or PowerPC bootable GRUB2 image with HFS+/FAT, APM,
   48     EFI GPT partition, PreP MBR partition, mountable FAT partition
   49 
   50 ------------------------------------------------------------------------------
   51 
   52 
   53                          EL Torito CD booting
   54                  for PC-BIOS x86, PowerPC, (old) Mac, EFI
   55 
   56 Sources:
   57     El Torito, Bootable CD-ROM Format Specification, Version 1.0, 1995
   58     which refers to ECMA-119, the standard for ISO 9660 filesystems.
   59     libisofs/eltorito.[ch] by Vreixo Formoso.
   60     http://www.uefi.org/sites/default/files/resources/2_4_Errata_B.pdf
   61 
   62 
   63 ECMA-119 prescribes that the first 32 kB of an ISO 9660 image are System Area
   64 with arbitrary content. This prescription is obeyed by PC-BIOS systems only
   65 if the ISO 9660 image is presented on CD, DVD or BD media.
   66 In this case the El Torito Boot record is the starting point of booting.
   67 
   68 After the System Area, an ISO 9660 image usually has three distinct block
   69 intervals for:
   70 - Volume descriptors (Primary Volume Descriptor, Boot Record, Joliet, ...)
   71 - Directory trees, tables, boot catalog, embedded partitions and filesystems.
   72 - Data file content, including content of El Torito boot images.
   73 
   74 The Boot Record is an ECMA-119 Volume Descriptor which is located at 2 kB block
   75 number 17 (decimal), if present at all. Its content points to the location of
   76 the Boot Catalog.
   77 The format is described in part by ECMA-119 8.2 "Boot Record" and further
   78 specified by El Torito figure 7.
   79 
   80 Byte Range | Value      | Meaning
   81 ---------- | ---------- | ----------------------------------------------------
   82    0 -   0 |          0 | Volume Descriptor Type. 0= Boot record
   83    1 -   5 |    "CD001" | Standard Identifier
   84    6 -   6 |          1 | Volume Descriptor Version
   85    7 -  38 |  el_torito | Boot System Identifier
   86   39 -  70 |          0 | Boot Identifier
   87            |            |
   88   71 -2047 | ========== | Boot System Use
   89            |            |
   90   71 - 74  | cataloglba | The 2 kB block number of the Boot Catalog
   91            |            | as little-endian 32 bit number.
   92            |            |
   93   75 -2047 |          0 | Unused
   94 ---------- | ---------- | ----------------------------------------------------
   95 
   96 el_torito is the constant string "EL TORITO SPECIFICATION" padded by 9 zeros.
   97 cataloglba has to be provided by the file system generator.
   98 
   99 
  100 The Boot Catalog lists the available boot images which may be prepared for
  101 multiple system architectures, called "platforms".
  102 It consists of one or more 2 kB blocks. The content is a sequence of fixed
  103 format entries, 32 bytes each.
  104 The entries are grouped in sections, which assign the entries to a particular
  105 system architecture. The booting system will then choose an entry from an
  106 appropriate section.
  107 
  108 Byte Range | Value      | Meaning
  109 ---------- | ---------- | ----------------------------------------------------
  110    0 -  31 | ========== | Validation Entry
  111            |            | begins the first section, specifies an architecture
  112   32 -  63 | ========== | Initial/Default Entry
  113            |            | points to a boot image for given architecture
  114 ---------- | ---------- | ----------------------------------------------------
  115 Optional: 
  116 ---------- | ---------- | ----------------------------------------------------
  117   64 -  95 | ========== | Section Header entry
  118            |            | begins new section, specifies an architecture
  119   96 - 127 | ========== | Section Entry
  120            |            | points to a boot image for given architecture
  121     ...    | .......... | Optional more Section Entries
  122     ...    | .......... | Optional more Section Headers and their Section
  123            |            | Entries
  124 ---------- | ---------- | ----------------------------------------------------
  125 
  126 An architecture is referred by a Platform Id number.
  127 Defined by El Torito are:
  128     0 = "80x86" which is used for standard PCs with Intel x86 or compatible CPU
  129     1 = "PowerPC" (possibly for IBM machines with PowerPC CPU)
  130     2 = "Mac" (possibly for Apple computers with MC68000 or PowerPC CPU)
  131 UEFI 2.4 specifies in 12.3.2.1 "ISO-9660 and El Torito":
  132  0xef = EFI, a competitor and successor to PC-BIOS, further in use with
  133              Intel ia64 Itanium and newer Apple machines.
  134 
  135 Words and numbers are represented as little-endian. 
  136 
  137 Validation Entry:
  138 
  139 Byte Range | Value      | Meaning
  140 ---------- | ---------- | ----------------------------------------------------
  141    0 -   0 |          1 | Header Id
  142            |            |
  143    1 -   1 | platform_id| Platform Id. One of: 0, 1, 2, 0xef. See above.
  144            |            |
  145    2 -   3 |          0 | Reserved
  146    4 -  27 |  manuf_dev | ID string identifies the manufacturer/developer
  147            |            | (no non-zero examples known yet)
  148            |            |
  149   28 -  29 |   checksum | Checksum Word for the Validation Entry. 
  150            |            | The sum of all words in the entry has to be 0.
  151            |            |
  152   30 -  30 |       0x55 | 
  153   31 -  31 |       0xaa | 
  154 ---------- | ---------- | ----------------------------------------------------
  155 
  156 
  157 Initial/Default Entry:
  158 
  159 Byte Range | Value      | Meaning
  160 ---------- | ---------- | ----------------------------------------------------
  161    0 -   0 | boot_indct | Boot Indicator: 0x88 = bootable, 0x00 = not bootable
  162            |            |
  163    1 -   1 | boot_media | Boot Media Type (i.e. media emulated by boot image):
  164            |            | 0= no emulation , 1= 1.2 MB diskette, 2=1.44 MB,
  165            |            | 3= 2.88 MB , 4= hard disk
  166            |            | (About everybody uses 0 = no emulation)
  167            |            |
  168    2 -   3 |   load_seg | Load Segment. (meaning unclear)
  169            |            | "If this value is 0 the system will use the
  170            |            |  traditional segment of 7C0."
  171            |            | libisofs default is 0
  172            |            |
  173    4 -   4 |   sys_type | System Type.
  174            |            | "Must be a copy of byte 5 from the partition table
  175            |            |  found in the boot image."
  176            |            | libisofs reads the start the boot image as MBR
  177            |            | if  boot_media == 4. This emulated MBR has a
  178            |            | partition table from where a byte gets copied.
  179            |            | Else this byte is 0.
  180            |            |
  181    5 -   5 |          0 | Unused
  182            |            |
  183    6 -   7 |  sec_count | Sector Count. Sector size 512:
  184            |            | "the number of virtual/emulated sectors the system
  185            |            |  will store at Load Segment during the initial boot
  186            |            |  procedure."
  187            |            | libisofs stores 1 for emulated boot_media and a
  188            |            | user defined value for boot_media == 0. Often: 4.
  189            |            |
  190    8 -  11 |  load_rba  | Load RBA. The 2 kB block address where the boot
  191            |            | image file content is located in the ISO 9660 image.
  192            |            |
  193   12 -  31 |          0 | Unused
  194 ---------- | ---------- | ----------------------------------------------------
  195 
  196 
  197 Section Header Entry:
  198 
  199 Byte Range | Value      | Meaning
  200 ---------- | ---------- | ----------------------------------------------------
  201    0 -   0 |   head_ind | Header Indicator: 0x90 = more headers follow
  202            |            |                   0x91 = final header, last section
  203            |            |
  204    1 -   1 | platform_id| Platform Id. One of: 0, 1, 2, 0xef. See above.
  205            |            |
  206    2 -   3 | num_entries| Number of entries to follow in this section
  207            |            |
  208    4 -  31 |            | ID string identifies the manufacturer/developer
  209 ---------- | ---------- | ----------------------------------------------------
  210 
  211 
  212 Section Entry:
  213 
  214 Byte Range | Value      | Meaning
  215 ---------- | ---------- | ----------------------------------------------------
  216    0 -   0 | boot_indct | Boot Indicator: 0x88 = bootable, 0x00 = not bootable
  217            |            |
  218    1 -   1 | boot_media | Boot Media Type (i.e. media emulated by boot image):
  219            |            | Bit 0 to 3 govern emulation
  220            |            |   0= no emulation , 1= 1.2 MB diskette, 2=1.44 MB,
  221            |            |   3= 2.88 MB , 4= hard disk
  222            |            |   (About everybody uses 0 = no emulation)
  223            |            | Bit 4 is reserved and must be 0
  224            |            | Bit 5 "Continuation entry follows" (meaning unclear)
  225            |            |       Might be the indicator for Extension Entries,
  226            |            |       which are not described here.
  227            |            | Bit 6 "Image contains an ATAPI driver"
  228            |            | Bit 7 "Image contains SCSI drivers"
  229            |            |
  230    2 -   3 |   load_seg | Load Segment. (meaning unclear)
  231            |            | See above Initial/Default Entry
  232            |            | libisofs default is 0.
  233    4 -   4 |   sys_type | System Type.
  234            |            | See above Initial/Default Entry
  235            |            | 0 if not emulation == 4.
  236    5 -   5 |          0 | Unused
  237            |            |
  238    6 -   7 |  sec_count | Sector Count. Sector size 512.
  239            |            | See above Initial/Default Entry
  240            |            | libisofs stores 1 for emulated boot_media and a
  241            |            | user defined value for boot_media == 0. Often: 4.
  242            |            |
  243    8 -  11 |  load_rba  | Load RBA. The 2 kB block address where the boot
  244            |            | image file content is located in the ISO 9660 image.
  245            |            |
  246   12 -  31 |   sel_crit | "Vendor unique selection criteria."
  247 ---------- | ---------- | ----------------------------------------------------
  248 
  249 ------------------------------------------------------------------------------
  250 
  251 
  252                       Boot Info Table and GRUB2 Boot Info
  253 
  254 Sources:
  255     man mkisofs by Joerg Schilling
  256     Mail conversations with Vladimir Serbinenko.
  257 
  258 
  259 The boot image file content is mostly opaque to the ISO 9660 image generator.
  260 Nevertheless there is a tradition named "Boot Info Table" which prescribes
  261 to write information into byte fields of the boot image file content.
  262 Recent versions of GRUB2 expect a similar patching which has no name yet.
  263 For now let's call it "GRUB2 Boot Info"
  264  
  265 There are no general means known how a producer of ISO 9660 images could
  266 detect the need for Boot Info Table production.
  267 It rather needs a hint from the user who has to know whether the boot image
  268 expects a Boot Info Table.
  269 The Boot Info Table begins at byte 8 of the boot image content.
  270 
  271 Byte Range | Value      | Meaning
  272 ---------- | ---------- | ----------------------------------------------------
  273    8 -  11 |    pvd_lba | Block address of the Primary Volume Descriptor.
  274            |            | This is the session start LBA + 16.
  275            |            |
  276   12 -  15 |   file_lba | Block address of the start of the boot image file
  277            |            | content. Block size is 2048.
  278            |            |
  279   16 -  19 |   file_len | Number of bytes in boot image file content.
  280            |            |
  281   20 -  23 |   checksum | The sum of all 32-bit words of the file content
  282            |            | from byte 64 to file end.
  283            |            |
  284   24 -  63 |          0 | Reserved
  285 ---------- | ---------- | ----------------------------------------------------
  286 All numbers are stored little-endian.
  287 
  288 GRUB2 Boot Info represents a particular block address inside the boot image.
  289 It may well be combined with Boot Info Table. See GRUB2 script grub-mkrescue
  290 use of xorrisofs options -boot-info-table and --grub2-boot-info.
  291 
  292 Byte Range | Value      | Meaning
  293 ---------- | ---------- | ----------------------------------------------------
  294 2548 -2555 |  grub2_adr | Block address of the start of the boot image file
  295            |            | content plus 5. Block size is 512.
  296            |            | 64 bit Little-endian.
  297 ---------- | ---------- | ----------------------------------------------------
  298 
  299 ------------------------------------------------------------------------------
  300 
  301 
  302                            Master Boot Record (MBR)
  303                   for PC-BIOS x86 from (pseudo-) hard disk
  304 
  305 Sources:
  306     http://en.wikipedia.org/wiki/Master_boot_record
  307     https://en.wikipedia.org/wiki/INT_13H
  308     Mailing list conversations with H. Peter Anvin and Vladimir Serbinenko.
  309     Mail conversations with Natalia Portillo.
  310 
  311 
  312 The candidates for MBR booting will normally use El Torito rather than MBR
  313 if the ISO image is presented on CD, DVD, or BD media.
  314 The MBR comes into effect if the image is on a media that is interpreted by
  315 the BIOS as some kind of hard disk. Usually real hard disks, floppy disks,
  316 USB sticks, memory cards.
  317 
  318 An important part of an MBR is the DOS style partition table. It describes up
  319 to four primary partitions. There are two formats used for block address:
  320 Cylinder/Head/Sector (C/H/S) and Logical Block Address (LBA). Both are based
  321 on units of 512 bytes. So MBR_LBA = ISO_LBA * 4.
  322 
  323 Contemporary x86 BIOS normally supports LBA addressing directly.
  324 If INT 0x13 AH 0x41 returns with CX bit0 set, then INT 0x13 AH 0x42 may be used
  325 for reading. (Sometimes even if the bit is not set to indicate the capability.)
  326 
  327 For C/H/S, the sector address is broken up into whole cylinders, remaining
  328 heads, and remaining sectors + 1. The nomenclature seems to stem from antique
  329 drum storage.
  330 There are two parameters, sectors_per_head and heads_per_cylinder which are not
  331 stored in the MBR. So at ISO production time it is more or less arbitrary how
  332 to convert a LBA into a C/H/S address and vice versa.
  333 At boot time the x86 BIOS decides about the two parameters. The boot loader may
  334 inquire these values by INT 0x13 AH 0x08 and use them to convert LBA to C/H/S
  335 for the read operation INT 0x13 AH 0x02. So the C/H/S values in an ISO's
  336 partition table are quite fictional and of few impact on boot loaders.
  337 
  338 More important seems to align partition ends to a consistent cylinder size,
  339 because some partition editors deduce their idea of disk geometry from there
  340 and raise protest if they deem it inconsistent.
  341 For maximum range of C/H/S addresses one may use sectors_per_head = 63 ,
  342 heads_per_cylinder = 255. But that is not divisible by 4 and imposes alignment
  343 problems with ISO 9660 filesystems. So (32,64) for images up to 1 GiB
  344 or (63,252) for larger images are better.
  345 
  346 Words are composed little-endian style.
  347 
  348 Byte Range | Value      | Meaning
  349 ---------- | ---------- | ----------------------------------------------------
  350    0 - 439 | = opaque = | Code Area filled with bytes for some boot system,
  351            |            | typically machine code.
  352            |            |
  353  440 - 443 | disk_sgntr | Disc signature: An individual disk id. Some software
  354            |            | might use it to recognize the same storage medium
  355            |            | at different device addresses.
  356            |            | (The Code Area might extend up to this field.)
  357            |            |
  358  444 - 445 |          0 | "usually nulls"
  359            |            | (The Code Area might extend up to this field.)
  360            |            |
  361  446 - 461 | ========== | Partition Table Entry for partition 1
  362            |            |
  363  446 - 446 |     status | For some generic MBRs this marks the one partition
  364            |            | from which the MBR should load and run more code.
  365            |            | 0x80 = bootflag/active , 0x00 = noboot/inactive
  366            |            | Some BIOSes ignore MBRs with no bootflag in any of
  367            |            | their partition table entries.
  368            |            |
  369  447 - 449 | ========== | C/H/S address of partition start
  370  447 - 447 | start_head | Heads part of start address.
  371  448 - 448 |  start_c_s | Bits 0 to 5 : Sectors part of start address.
  372            |            | Bits 6 to 7 : Bits 8 to 9 of cylinders part.
  373  449 - 449 |  start_cyl | Lower 8 bits of cylinders part of start address
  374            |            |
  375  450 - 450 |  part_type | Partition type indicates the purpose or kind of
  376            |            | filesystem in the partition.
  377            |            |
  378  451 - 453 | ========== | C/H/S address of last absolute sector in partition
  379  451 - 451 |   end_head | Heads part of end address.
  380  452 - 452 |    end_c_s | Bits 0 to 5 : Sectors part of end address.
  381                         |               Values: 1 to 63, not 0.
  382            |            | Bits 6 to 7 : Bits 8 to 9 of cylinders part.
  383  453 - 453 |    end_cyl | Lower 8 bits of cylinders part of end address
  384            |            |
  385  454 - 457 |  start_lba | LBA of first absolute sector in partition. 
  386            |            | Block size is 512. Counting starts at 0.
  387            |            |
  388  458 - 461 | num_blocks | Number of sectors in partition.
  389            |            |
  390  462 - 477 | ========== | Partition Table Entry for partition 2
  391            | part_entr2 | 16 bytes. Format as with partition 1.
  392            |            | All 0 means that partition is unused/undefined.
  393            |            |
  394  478 - 493 | ========== | Partition Table Entry for partition 3
  395            | part_entr3 | 16 bytes. See above.
  396            |            |
  397  494 - 509 | ========== | Partition Table Entry for partition 4
  398            | part_entr4 | 16 bytes. See above.
  399            |            |
  400  510 - 510 |       0x55 | MBR signature
  401  511 - 511 |       0xaa | MBR signature
  402            |            |
  403 ---------- | ---------- | ----------------------------------------------------
  404 
  405 
  406 By tradition the MBR itself and possibly more blocks are not claimed by any
  407 partition. But starting the first partition at a non-zero block address causes
  408 on Linux a partition device file (e.g. /dev/sdb1) which cannot be used to mount
  409 the ISO filesystem.
  410 
  411 libisofs is able to produce a second set of trees and meta data which is
  412 suitable for being mounted at start block 16 (ISO) which is block 64 in MBR.
  413 See <libisofs/libisofs.h> for call iso_write_opts_set_part_offset()
  414 and http://libburnia-project.org/wiki/PartitionOffset for examples with
  415 program xorriso.
  416 
  417 ------------------------------------------------------------------------------
  418 
  419 
  420                            Apple Partition Map (APM) 
  421     for Apple Macs introduced since 2000 and more computer-like than iPad
  422                   from CD and often from (pseudo-) hard disk
  423 
  424 Sources:
  425     http://mjg59.dreamwidth.org/11285.html
  426     http://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-116/IOApplePartitionScheme.h (typedef struct Block0)
  427     http://www.informit.com/articles/article.aspx?p=376123&seqNum=3
  428     syslinux-4.05/utils/isohybrid.c
  429     Mail conversations with Vladimir Serbinenko.
  430     Mail conversations with Natalia Portillo of DiskImageChef,
  431                             who quoted "Inside Macintosh" Volumes IV and V.
  432 
  433 
  434 APM has an adjustable block size. Because the ISO images shall always work
  435 on optical media, and in order to make room for the header block of an
  436 additional GPT, only block size 2048 is considered here.
  437 The role of APM in the boot process is to guide the firmware to a
  438 HFS+ filesystem.
  439 
  440 Block0 (aka Driver Descriptor Map) of an APM begins at byte 0 of the medium.
  441 Thus it collides with MBR and other boot sector formats. By lucky coincidence
  442 it is possible to compose a mock-up of a Block0 which is acceptable to firmware
  443 which expects APM, and is also harmless x86 machine code with no negative
  444 side effects. So it is possible to combine APM with an especially prepared MBR.
  445 
  446 Block0 is optional. But in the context of bootable hybrid ISOs it is not only
  447 needed to announce block size 2048, but also it is much better suited for
  448 staging as harmless x86 machine code than is an APM partition entry.
  449 
  450 Usually there is no Device Partition Map block (signature "TS"), although it
  451 is demanded by the book "Inside Macintosh". It would sit where GPT has its
  452 header block. So DPM is not described here.
  453 
  454 The layout of a Block0 of an APM is:
  455 
  456 Byte Range | Value      | Meaning (all numbers are stored big endian)
  457 ---------- | ---------- | ----------------------------------------------------
  458    0 -   1 | sig        | Signature 0x45 = 'E' , 0x52 = 'R'
  459    2 -   3 | block_size | 0x0800 = 2048
  460    4 -   7 | block_count| Number of blocks covered by APM
  461            |            | Often some x86-harmless dummy. E.g. 0x9090 = 37008
  462            |            | or 0xeb02ffff = 3,942,842,367                         
  463    8 -   9 | dev_type   | Device type: The id of the Mac driver which is in
  464            |            | charge of the storage device.
  465   10 -  11 | dev_id     | Device id: Address in an i/o bus system.
  466   12 -  15 | drv_data   | Driver data: Not used.
  467   16 -  17 | drv_count  | Driver count: Count of entries in drv_map.
  468   18 - 505 | drv_map    | Driver descriptor table:
  469            |            | Up to 61 entries of 8 bytes each.
  470            |            | They contain the 32 bit 512-byte LBA of the driver's
  471            |            | storage location, its 16 bit size in 512-byte blocks,
  472            |            | and value 0x0001.
  473  506 - 511 | reserved   |
  474 ---------- | ---------- | ----------------------------------------------------
  475 
  476 The SYSLINUX program isohybrid.c overwrites the first 32 bytes of this
  477 layout by its dummy values. It uses the small block_count 0x00009090 and
  478 sets all bytes up to 31 to 0.
  479 The libisofs HFS+ extension by Vladimir Serbinenko overwrites only the
  480 first 8 bytes. It uses the large block_count 0xeb02ffff.
  481 
  482 Block0 and the following APM entries each occupy 1 block of the announced size.
  483 
  484 The first APM entry describes the range from its own start to the end of the
  485 last APM entry. Each of the other APM entries describes a partition.
  486 
  487 The layout of an Apple partition map entry is:
  488 
  489 Byte Range | Value      | Meaning (all numbers are stored big endian)
  490 ---------- | ---------- | ----------------------------------------------------
  491    0 -   1 | sig        | Signature 0x50 = 'P' , 0x4d = 'M'
  492    2 -   3 | reserved   |
  493    4 -   7 | map_entries| Number of partition entries.
  494            |            | All entries show the same number.
  495    8 -  11 | start_block| "physical block start of partition"
  496   12 -  15 | block_count| "physical block count of partition"
  497   16 -  47 | name       | Partition name 
  498   48 -  79 | type       | Type string
  499   80 -  83 | lb_start   | Logical block start = 0
  500   84 -  87 | lb_count   | Logical block count (same as block_count)
  501   88 -  91 | flags      | Status flags
  502            |            | bit0= entry is valid
  503            |            | bit1= partition is allocated
  504            |            | bit2= partition is in use
  505            |            | bit3= partition contains valid boot information
  506            |            | bit4= partition is readable
  507            |            | bit5= partition is writable
  508            |            | bit7= boot code is position independent
  509            |            | bit30= automatic mount (legacy Mac)
  510   92 -  95 | boot_block | Logical start block number of boot code = 0
  511   96 -  99 | boot_bytes | Number of bytes in boot code = 0
  512  100 - 119 |            | More boot code stuff = 0
  513  120 - 135 | processor  | "processor type" = 0
  514  136 - 511 | reserved   |
  515 ---------- | ---------- | ----------------------------------------------------
  516 
  517 For the first APM entry (byte 0x0800), the following values apply:
  518 map_entries = number of APM entries, including itself. E.g. 4.
  519 start_block = 1
  520 block_count = map_entries
  521 name        = "Apple"
  522 type        = "Apple_partition_map"
  523 flags       = 3
  524 
  525 libisofs uses APM to mark a HFS+ filesystem partition within an ISO 9660 image.
  526 Usually the APM has 3 more entries after the first entry:
  527 
  528 Entry 2 (byte 0x1000) describes the block interval from ISO image start to
  529 the start of the HFS+ filesystem meta data.
  530 start_block = 16
  531 block_count = start_of_hfs - 16
  532 name        = "Gap0"
  533 type        = "ISO9660_data"
  534 flags       = 0x13
  535 
  536 Entry 3 (byte 0x1800) describes the interval from the start of the HFS+ meta
  537 data to the end of the HFS+ data at the end of its partition. This includes all
  538 content blocks of the data files in the ISO image.
  539 start_block = start_of_hfs
  540 block_count = end_of_hfs - start_of_hfs
  541 name        = "HFSPLUS_Hybrid"
  542 type        = "Apple_HFS"
  543 flags       = 0x40000013
  544 
  545 Entry 4 (byte 0x2000) describes the interval from the end of the HFS+
  546 partition to the end of the ISO image. It is possible that this interval is
  547 empty. In this case, no fourth APM entry will be written.
  548 start_block = end_of_hfs
  549 block_count = end_of_iso - end_of_hfs
  550 name        = "Gap1"
  551 type        = "ISO9660_data"
  552 flags       = 0x13
  553 
  554 
  555 >>> Open questions:
  556 >>> What HFS+ blessings are needed for booting ?
  557 >>> What files need what HFS creator and type settings ?
  558 
  559 
  560 ------------------------------------------------------------------------------
  561 
  562 
  563                         GUID Partition Table (GPT)
  564                     for alternative mountability paths
  565       and for EFI booting of some Apple Macs from (pseudo-) hard disk
  566 
  567 Sources:
  568   http://mjg59.dreamwidth.org/11285.html
  569   http://mjg59.fedorapeople.org/Fedora-LiveCD.iso
  570   http://en.wikipedia.org/wiki/GUID_Partition_Table
  571   http://en.wikipedia.org/wiki/GUID
  572   http://www.uefi.org/sites/default/files/resources/2_4_Errata_B.pdf
  573 
  574 
  575 GPT is the partition map format of EFI, a successor of PC-BIOS.
  576 Block size is always 512. GPT consists of a header block at block address 1 and
  577 a partition table near the start of the medium. This is called the primary GPT.
  578 There is a backup copy of header and table near the end of the medium.
  579 
  580 GPT is particularly designed to co-exist with MBR. Officially only with a
  581 Protective MBR which covers the whole medium (except the MBR itself) by
  582 a single partition of type 0xee. Inofficially often with filesystem partitions
  583 marked in both, GPT and MBR. In the latter case the booting firmware may
  584 or may not prefer GPT over the MBR partition table.
  585 GPT can co-exist with APM if APM block size is at least 1024. In this case,
  586 the primary partition table will begin after the last APM entry block.
  587 
  588 The header block format is:
  589 Byte Range | Value      | Meaning (little endian numbers, LBA unit is 512 byte)
  590 ---------- | ---------- | ----------------------------------------------------
  591    0 -   7 | sig        | Signature "EFI PART" (with no trailing zero)
  592    8 -  11 | revision   | Revision = {0x00, 0x00, 0x01, 0x00} meaning "1.0"
  593   12 -  15 | head_size  | Header size = 0x5c = 92
  594   16 -  19 | head_crc   | CRC-32 of this header while head_crc is 0
  595   20 -  23 | reserved   | = 0
  596   24 -  31 | curr_lba   | Location of this header block = 1
  597   32 -  39 | backup_lba | Location of header backup block. See below.
  598   40 -  47 | first_lba  | First usable LBA for partitions
  599   48 -  55 | last_lba   | Last usable LBA for partitions
  600   56 -  71 | guid       | Disk GUID, Random
  601   72 -  79 | part_start | Partition entries start
  602            |            | Normally this is 2. But to co-exist with APM, it
  603                         | might become some other number up to 62.
  604   80 -  83 | entry_count| Number of partition entries
  605   84 -  87 | entry_size | Size of a partition entry = 0x80 = 128
  606   88 -  91 | p_arr_crc  | CRC-32 of the partition array
  607   92 - 511 | reserved   | Must be 0
  608 ---------- | ---------- | ----------------------------------------------------
  609 
  610 The CRC-32 algorithm can be characterized as follows:
  611 The generating polynomial has the bit representation 0x104c11db7.
  612 The seed value for a bit shifting division algorithm is 0x46af6449. It is
  613 chosen so that the CRC of 0 bytes of input is 0x00000000.
  614 The least significant bits of input bytes get processed first. I.e. bit0 of
  615 the last input byte gets mapped to x exp (7 + 32), bit7 of this byte gets
  616 mapped to x exp (0 + 32).
  617 The resulting division residue gets bitwise mirrored. E.g. bit0 becomes bit31,
  618 bit1 becomes bit30, and so on. Further it gets exored with 0xffffffff.
  619 
  620 A GUID consists of a 32-bit integer, two 16-bit integers, and an array of
  621 8 bytes. The integers are to be stored big-endian.
  622 A globally registered class of GUID are the partition type GUIDs:
  623 Basic data partition:  a2 a0 d0 eb , e5 b9 , 33 44 , 87 c0 68 b6 b7 26 99 c7
  624 HFS+ partition      :  00 53 46 48 , 00 00 , aa 11 , aa 11 00 30 65 43 ec ac
  625 EFI System partition:  28 73 2a c1 , 1f f8 , d2 11 , ba 4b 00 a0 c9 3e c9 3b
  626 Note that the wikipedia list shows the first 32-bit word and the next two
  627 16-bit words in little-endian interpretation.
  628 
  629 The partition table is an array of entries. Each has a size of 128 bytes.
  630 A partition table entry looks like:
  631 
  632 Byte Range | Value      | Meaning (numbers are stored little endian)
  633 ---------- | ---------- | ----------------------------------------------------
  634    0 -  15 | type_guid  | Partition type GUID
  635   16 -  31 | part_guid  | Unique partition GUID, Random
  636   32 -  39 | start_lba  | First LBA
  637   40 -  47 | end_lba    | Last LBA (inclusive)
  638   48 -  55 | flags      | Attribute flags
  639            |            | bit0= "System Partition" Do not alter.
  640            |            | bit2= Legacy BIOS bootable (MBR partition type 0x80)
  641            |            | bit60= read-only
  642   56 - 127 | name       | Characters encoded as UTF-16LE. Padded by 0-bytes.
  643 ---------- | ---------- | ----------------------------------------------------
  644 
  645 
  646 About header field "Location of header backup block":
  647 
  648 Near to the end of the image, after any data blocks which might be of interest
  649 for the filesystems covered by GPT partitions, there is a backup of partition
  650 table and header block.
  651 The header block is supposed to mark the end of the usable medium. But libisofs
  652 may have the need to add more data.
  653 The partition table is stored directly before the header block. So it will
  654 normally not begin at a 2 KiB block start.
  655 
  656 The content of the backup partition table is the same as the one of the
  657 primary table.
  658 The backup header differs from the primary header by 
  659 Byte Range | Value      | Meaning (little endian numbers, LBA unit is 512 byte)
  660 ---------- | ---------- | ----------------------------------------------------
  661   16 -  19 | head_crc   | CRC-32 of this header while head_crc is 0.
  662            |            | Is recomputed after the following changes.
  663   24 -  31 | curr_lba   | Location of this header block.
  664            |            | Shows own block address.
  665   32 -  39 | backup_lba | Location of header backup block.
  666            |            | Points to primary header block = 1
  667   72 -  79 | part_start | Partition entries start.
  668            |            | Points to start of backup partition table.
  669 ---------- | ---------- | ----------------------------------------------------
  670 
  671 
  672 An EFI System partition usually contains the same data blocks as the El Torito
  673 boot image for EFI. It is used for booting some Macs from (pseudo-) hard disk.
  674 
  675 
  676 ------------------------------------------------------------------------------
  677 
  678 
  679                                MIPS Volume Header
  680                        for MIPS Big Endian, e.g. SGI Indigo2
  681 
  682 Sources:
  683    cdrkit-1.1.10/genisoimage/boot-mips.c
  684    by Steve McIntyre <steve@einval.com>
  685    which refers to
  686       genisovh by Florian Lohoff <flo@rfc822.org>
  687               and Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
  688       who seem to have learned parameter settings from IRIX CD media
  689       There are traces in the web which relate this to specs by
  690                MIPS Computer Systems, Inc. , 1985
  691                Silicon Graphics Computer Systems, Inc. , 2000
  692    Mail conversations with Natalia Portillo.
  693 
  694 
  695 The first 512 bytes of the media constitute the Volume Header.
  696 Words are composed big-endian style.
  697 
  698 Byte Range | Value      | Meaning
  699 ---------- | ---------- | ----------------------------------------------------
  700    0 -   3 | 0x0be5a941 | Magic number
  701    4 -   5 |          0 | Root partition number
  702    6 -   7 |          0 | Swap partition number
  703    8 -  23 |          0 | One of the boot_name items from the Volume Directory
  704            |            | may be put here to choose for booting the entry with
  705            |            | that name.
  706            |            | (Obviously it may be empty if only one non-zero entry
  707            |            |  exists in the Volume Directory.)
  708            |            |
  709   24 -  71 | ========== | Device Parameters
  710            |            |
  711   24 -  24 |          0 | Spiral addressing skew (unclear what this means)
  712   25 -  25 |          0 | Words of 0 before header
  713   26 -  26 |          0 | Words of 0 between hdr and data
  714   27 -  27 |          0 | Spare sectors per cylinder
  715   28 -  29 |  num_cyl_l | Number of usable cylinder, lower two bytes
  716            |            |  ((iso_size + BYTES_PER_SECTOR - 1) /
  717            |            |   (SECTORS_PER_TRACK * BYTES_PER_SECTOR)) & 0xffff
  718   30 -  31 |          0 | Starting head of volume 0 
  719   32 -  33 |          1 | Number of tracks per cylinder
  720   34 -  34 |          0 | Depth of CTQ queue (unclear what this means)
  721   35 -  35 |  num_cyl_h | Number of usable cylinders, high byte 
  722            |            |  ((iso_size + BYTES_PER_SECTOR - 1) /
  723            |            |   (SECTORS_PER_TRACK * BYTES_PER_SECTOR)) >> 16
  724   36 -  37 |          0 | unused
  725   38 -  39 |         32 | SECTORS_PER_TRACK
  726   40 -  41 |        512 | BYTES_PER_SECTOR
  727   42 -  43 |          0 | Sector interleave (unclear what this means)
  728   44 -  47 | 0x00000034 | Controller characteristics composed from
  729            |            | DP_RESEEK 0x00000020 /* recalibrate as last resort */
  730            |            | DP_IGNOREERRORS 0x00000010
  731            |            |              /* transfer data regardless of errors */
  732            |            | DP_TRKFWD 0x00000004
  733            |            |                    /* forward to replacement track */
  734   48 -  51 |          0 | Bytes/sec for kernel stats
  735   52 -  55 |          0 | Max num retries on data error
  736   56 -  59 |          0 | ms per word to xfer, for iostat
  737   60 -  71 |          0 | 6 parameter words for xylogics controllers
  738            |            |
  739   72 - 311 | ========== | Volume Directory with 15 entries of 16 bytes each
  740            |            |
  741   72 -  87 | ========== | Volume Directory Entry 1
  742   72 -  79 |  boot_name | Boot file basename, eventually padded by 0 to length 8
  743   80 -  83 | boot_block | ISO 9660 LBA of boot file * 4, i.e. in blocks of 512
  744   84 -  87 | boot_bytes | File length in bytes
  745            |            |
  746   88 - 311 | see above  | Volume Directory Entries 2 to 15
  747            |            |
  748  312 - 504 | ========== | Partition Table with 16 entries of 12 bytes each
  749            |            |
  750  312 - 407 |          0 | Unused partition entries 1 to 8
  751            |            |
  752  408 - 419 | ========== | Partition Table Entry 9 for Volume Header
  753  408 - 411 |  part_blks | Number of 512 byte blocks in partition
  754            |            |(iso_size + (BYTES_PER_SECTOR - 1)) / BYTES_PER_SECTOR
  755  412 - 415 |          0 | Start block of partition
  756  416 - 419 |          0 | PTYPE_VOLHDR = Partition is volume header
  757            |            |
  758  420 - 431 |          0 | Unused partition entry 10
  759            |            |
  760  432 - 443 | ========== | Partition Table Entry 11 for Volume
  761  432 - 435 |  part_blks | Number of 512 byte blocks in partition
  762            |            |(iso_size + (BYTES_PER_SECTOR - 1)) / BYTES_PER_SECTOR
  763  436 - 439 |          0 | Start block of partition
  764  440 - 443 |          6 | PTYPE_VOLUME = Partition is entire volume
  765            |            |
  766  444 - 503 |          0 | Unused partition entries 12 to 16
  767            |            |
  768  504 - 507 |   head_chk | Volume header checksum
  769            |            | The two's complement of bytes 0 to 503 read as big
  770            |            | endian unsigned 32 bit: sum(words) + head_chk == 0
  771            |            |
  772  508 - 511 |          0 | Volume header end padding
  773            |            |
  774 up to 2048 |          0 | ISO 9660 Block end padding
  775 ---------- | ---------- | ----------------------------------------------------
  776 
  777 
  778 ------------------------------------------------------------------------------
  779 
  780 
  781                                DEC Boot Block
  782                     for MIPS Little Endian , e.g. DECstation
  783 
  784 Sources:
  785    cdrkit-1.1.10/genisoimage/boot-mipsel.c
  786    by Steve McIntyre <steve@einval.com>
  787    which refers to
  788       delo   by Florian Lohoff <flo@rfc822.org>
  789             and Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
  790    cdrkit-1.1.10/include/glibc_elf.h
  791    by Steve McIntyre
  792    which is based on
  793       <elf.h> from GNUC C Library by Free Software Foundation, Inc. 
  794 
  795 
  796 There seems to be only one boot file possible.
  797 Some information needs to be read out of the ELF headers of this boot file.
  798 
  799 Byte Range | Value      | Meaning
  800 ---------- | ---------- | ----------------------------------------------------
  801    0 -   7 |          0 | Padding
  802            |            |
  803    8 -  11 | 0x0002757a | Magic number
  804            |            |
  805   12 -  15 |          1 | Mode /* 0: Single extent, 1: Multi extent boot */
  806            |            |
  807   16 -  19 |   load_adr | Load address /* Load below kernel */
  808            |            | Stems from ELF header of boot file.
  809            |            | See below Elf32_Phdr field p_vaddr.
  810            |            |
  811   20 -  23 |   exec_adr | Execution address /* And exec there */
  812            |            | Stems from ELF header of boot file.
  813            |            | See below Elf32_Ehdr field e_entry.
  814            |            |
  815   24 -  31 | ========== | Boot Map Entry 1
  816            |            |
  817   24 -  27 |   seg_size | Segment size in file. Blocks of 512 bytes.
  818            |            | Stems from ELF header of boot file.
  819            |            | (Elf32_Phdr field p_filesz + 511) / 512;
  820            |            |
  821   28 -  31 |  seg_start | Segment file offset. Blocks 512 bytes.
  822            |            | ISO 9660 LBA of boot file * 4 plus offset which
  823            |            | stems from ELF header of boot file:
  824            |            | (Elf32_Phdr field p_offset + 511) / 512;
  825            |            |
  826   32 - 431 | ========== | Boot Map Entries 2 to 51
  827            |          0 |
  828            |            |
  829 ---------- | ---------- | ----------------------------------------------------
  830 
  831 
  832 Elf32_Ehdr gets loaded from boot file byte address 0:
  833 
  834 Byte Range | Value      | Meaning
  835 ---------- | ---------- | ----------------------------------------------------
  836    0 -  23 |            | ( Magic number, file information )
  837            |            | 
  838   24 -  27 |    e_entry | /* Entry point virtual address */
  839            | = exec_adr | Needed for exec_adr
  840            |            |
  841   28 -  31 |    e_phoff | /* Program header table file offset */
  842            |            | Byte address of Elf32_Phdr
  843            |            |
  844 
  845 Elf32_Phdr gets loaded from boot file byte_address Elf32_Ehdr.e_phoff :
  846 Byte Range | Value      | Meaning
  847 ---------- | ---------- | ----------------------------------------------------
  848    0 -   3 |            | ( Segment type )
  849            |            |
  850    4 -   7 |   p_offset | /* Segment file offset */
  851            |-> seg_start| Needed for seg_start
  852            |            |
  853    8 -  11 |    p_vaddr | /* Segment virtual address */
  854            |  =load_adr | Needed for load_adr
  855            |            |
  856   12 -  15 |            | (Segment physical address)
  857            |            |
  858   16 -  19 |   p_filesz | /* Segment size in file */
  859            |-> seg_size | Needed for seg_size
  860            |            |
  861 ---------- | ---------- | ----------------------------------------------------
  862 
  863 
  864 ------------------------------------------------------------------------------
  865 
  866 
  867                           SUN Disk Label and boot images
  868                                  for SUN SPARC
  869 
  870 Sources:
  871    cdrtools-2.01.01a77/mkisofs/sunlabel.h
  872    cdrtools-2.01.01a77/mkisofs/mkisofs.8
  873    by Joerg Schilling
  874 
  875 
  876 The Disk Label is written to the first 512 bytes of the image. It can mark
  877 8 partitions (slices ) of which the first contains the ISO image. The other
  878 7 may contain boot images.
  879 Words are composed big-endian style. Block size is 512.
  880 
  881 Boot images are provided externally. mkisofs arranges them after the end of
  882 the ISO image so that each starts at a cylinder boundary (320 kB).
  883 
  884 There is a mechanism in mkisofs which fills unused partitions by copies of
  885 their predecessor in the partition table:
  886 "If the special filename ... is used, the actual and all following
  887  boot partitions are mapped to  the  previous  partition.
  888  If mkisofs is called with -G image -B ... all boot partitions are
  889  mapped to the partition that contains the ISO9660 filesystem."
  890 
  891 Disk Label components:
  892 
  893 Byte Range | Value      | Meaning
  894 ---------- | ---------- | ----------------------------------------------------
  895    0 - 127 |      label | ASCII Label
  896            |            | "CD-ROM Disc with Sun sparc boot created by ..."
  897            |            | mkisofs option -sparc-label
  898            |            |
  899  128 - 263 | ========== | /* vtoc inclusions from AT&T SVr4 */
  900            |            |
  901  128 - 131 |          1 | Layout version
  902  132 - 139 |          0 | /* volume name           */
  903  140 - 141 |          8 | Number of partitions
  904            |            |
  905  142 - 173 | ========== | 8 partition entries of 4 bytes
  906            |            |
  907  142 - 145 | ========== | Entry for partition 1
  908  142 - 143 |          4 | ID tag of partition: 4 = User partition
  909  144 - 145 |       0x10 | Permissions: 0x10 = read-only
  910            |            |
  911  146 - 149 | ========== | Entry for partition 2 
  912  146 - 147 |    id_tag2 | ID tag of partition:
  913            |            | 0 = unused
  914            |            | 2 = Root partition with boot image
  915  148 - 149 |      perm2 | Permissions:
  916            |            | 0 = unused
  917            |            | 0x10 = read-only (if used)
  918            |            |
  919  150 - 173 | ========== | Entries for partition 3 to 8.
  920            |            | See above: Entry for partition 2
  921            |            |
  922  174 - 175 |          0 | Padding
  923            |            |
  924  176 - 187 |          0 | /* info for mboot       */
  925            |            |
  926  188 - 191 | 0x600ddeee | /* to verify vtoc sanity */
  927            |            |
  928  192 - 231 |          0 | Reserved
  929            |            |
  930  232 - 263 |          0 | 8 Timestamps of yet unknown format
  931            |            |
  932  264 - 419 |          0 | Padding
  933            |            |
  934  420 - 443 | ========== | Disk properties
  935            |            |
  936  420 - 421 |        350 | Rotations per minute
  937  422 - 423 |       2048 | Number of physical cylinders (fixely 640 MB)
  938  424 - 425 |          0 | /* alternates per cylinder */
  939  426 - 429 |          0 | /* obsolete */
  940  430 - 431 |          1 | /* interleave factor */
  941  432 - 433 |       2048 | Number of data cylinders (fixely 640 MB)
  942  434 - 435 |          0 | /* # of alternate cylinders */
  943  436 - 437 |          1 | Number of heads per cylinder (i.e. 1 cyl = 320 kB)
  944  438 - 439 |        640 | Number of sectors per head (i.e. 1 head = 320 kB)
  945  440 - 443 |          0 | /* obsolete */
  946            |            |
  947  444 - 507 | ========== | Partition table
  948            |            |
  949  444 - 451 | ========== | Partition table entry #1
  950            |            |
  951  444 - 447 |  start_cyl | Start cylinder
  952            |            |
  953  448 - 451 | num_blocks | Number of 512-byte blocks in partition
  954            |            |
  955  452 - 507 | ========== | Partition table entries #2 to #8
  956            |        ... | See above Partition table entry #1
  957            |            |
  958  508 - 509 |     0xdabe | Magic Number
  959            |            |
  960  510 - 511 |   checksum | The result of exoring 2-byte words 0 to 254
  961            |            |
  962 ---------- | ---------- | ----------------------------------------------------
  963 
  964 ------------------------------------------------------------------------------
  965 
  966 
  967                       GRUB2 SUN SPARC Core File Address
  968 
  969 Sources:
  970     Mail conversations with Vladimir Serbinenko.
  971 
  972 GRUB2 lets libisofs write after the disk label block the address and size of a
  973 data file in the ISO image. E.g. of /boot/grub/sparc64-ieee1275/core.img.
  974 This is combined with a SUN Disk Label which exposes only the single partition
  975 describing the overall ISO filesystem size.
  976 
  977   Byte Range | Value      | Meaning
  978 ------------ | ---------- | --------------------------------------------------
  979  512 -   551 |     opaque | Code and data provided by GRUB2
  980              |            |
  981  552 -   559 |     offset | Start byte number of the file. 64-bit big-endian.
  982              |            |
  983  560 -   563 |      size  | Number of bytes in the file. 32-bit big-endian.
  984              |            |
  985  564 - 32767 |     opaque | Code and data provided by GRUB2
  986              |            |
  987 ------------ | ---------- | --------------------------------------------------
  988 
  989 ------------------------------------------------------------------------------
  990 
  991 
  992                       PowerPC Reference Platform (PReP)
  993                               for IBM PowerPC
  994 
  995 Sources:
  996     Mail conversations with Vladimir Serbinenko.
  997 
  998 
  999 PReP boots via a MBR partition containing only raw ELF and having type 0x41.
 1000 
 1001 
 1002 ------------------------------------------------------------------------------
 1003 
 1004 
 1005                  Common Hardware Reference Platform (CHRP)
 1006                               for IBM PowerPC
 1007 
 1008 Sources:
 1009     Mail conversations with Vladimir Serbinenko.
 1010     http://stuff.mit.edu/afs/sipb/contrib/doc/specs/protocol/chrp/chrp1_7a.pdf
 1011     https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/W51a7ffcf4dfd_4b40_9d82_446ebc23c550/page/PowerLinux%20Boot%20howto
 1012 
 1013 CHRP is marked by an MBR partition entry of type 0x96 spanning the whole
 1014 ISO 9660 image.
 1015 
 1016 The specs in chrp1_7a.pdf promise that CHRP also recognizes ISO 9660 file
 1017 systems on unpartitioned disks. (See 11.1.1. Media Layout Format)
 1018 
 1019 The firmware looks up a file /ppc/bootinfo.txt which in SGML-ish tag
 1020 <boot-script> contains firmware commands.
 1021 E.g. to execute the binary /boot/grub/powerpc.elf as first stage of GRUB2:
 1022   <boot-script>boot &device;:\boot\grub\powerpc.elf</boot-script> 
 1023 
 1024 Vladimir Serbinenko stated:
 1025 PReP boot may be preferable. At least it can co-exist with other partitions
 1026 in the ISO image [without causing overlapping between partitions].
 1027 
 1028 
 1029 ------------------------------------------------------------------------------
 1030 
 1031                       HP-PA via PALO header version 4
 1032                               for HP PA-RISC  
 1033 
 1034 Sources:
 1035    cdrkit-1.1.10/genisoimage/boot-hppa.c
 1036    by Steve McIntyre <steve@einval.com>
 1037       who states "Heavily inspired by palo"
 1038 
 1039 This format is expected by PALO versions before 1.92. Their source code defines
 1040 PALOHDRVERSION as 4. The format also serves as fallback for newer versions,
 1041 which expect header version 5, if a 0-byte is found at byte position 1024.
 1042 
 1043 There are five parameters which get encoded into the first 248 bytes of the
 1044 System Area: cmdline, bootloader, 32-bit kernel, 64-bit kernel, and ramdisk.
 1045 They are all mandatory.
 1046 While cmdline is simply a string of at most 127 characters, the other four
 1047 point to data files inside the ISO image.
 1048 
 1049 All numbers are recorded big endian.
 1050 
 1051 Boot sector components:
 1052 
 1053 Byte Range | Value      | Meaning
 1054 ---------- | ---------- | ----------------------------------------------------
 1055    0 -   1 |     0x8000 | Magic
 1056            |            |
 1057    2 -   6 |     "PALO" | Zero terminated string
 1058            |            |
 1059    7 -   7 |          4 | Version
 1060            |            |
 1061    8 -  11 | kern32_adr | Byte address of the "HPPA 32-bit kernel" file
 1062            |            | genisoimage option -hppa-kernel-32
 1063   12 -  15 | kern32_len | Byte count of the "HPPA 32-bit kernel" file
 1064            |            |
 1065   16 -  19 | ramdsk_adr | Byte address of the "HPPA ramdisk" file
 1066            |            | genisoimage option -hppa-ramdisk
 1067   20 -  23 | ramdsk_len | Byte count of the "HPPA ramdisk" file
 1068            |            |
 1069   24 - 151 |    cmdline | "Command line"
 1070            |            | genisoimage option -hppa-cmdline
 1071            |            |
 1072  232 - 235 | kern64_adr | Byte address of the "HPPA 64-bit kernel" file
 1073            |            | genisoimage option -hppa-kernel-64
 1074  236 - 239 | kern64_len | Byte count of the "HPPA 64-bit kernel" file
 1075            |            |
 1076  240 - 243 | bootld_adr | Byte address of the "HPPA bootloader" file
 1077            |            | genisoimage option -hppa-bootloader
 1078  244 - 247 | bootld_len | Byte count of the "HPPA bootloader" file
 1079            |            |
 1080 ---------- | ---------- | ----------------------------------------------------
 1081 
 1082 
 1083 ------------------------------------------------------------------------------
 1084 
 1085                       HP-PA via PALO header version 5
 1086                               for HP PA-RISC  
 1087 
 1088 Sources:
 1089    Public mail conversations with Helge Deller, beginning with
 1090       https://lists.debian.org/debian-hppa/2014/01/msg00016.html
 1091    http://git.kernel.org/cgit/linux/kernel/git/deller/palo.git/tree/lib/
 1092       (especially struct firstblock in common.h and struct partition in part.h)
 1093 
 1094 This format is expected by PALO versions 1.92 or higher. They fall back to
 1095 header version 4 if a 0-byte is found at byte position 1024.
 1096 Their source code defines PALOHDRVERSION as 5.
 1097 
 1098 There are five parameters which get encoded into the first 2048 bytes of the
 1099 System Area: cmdline, bootloader, 32-bit kernel, 64-bit kernel, and ramdisk.
 1100 They are all mandatory.
 1101 While cmdline is simply a string of at most 1023 characters, the other four
 1102 point to data files inside the ISO image.
 1103 
 1104 Several fields of the firstblock shall be hardcoded to 0, on advise of
 1105 Helge Deller. Their description is shown in round brackets.
 1106 
 1107 All numbers are recorded big endian.
 1108 Except flags, all 4-byte integers are signed.
 1109 
 1110 Boot sector components:
 1111 
 1112 Byte Range | Value      | Meaning
 1113 ---------- | ---------- | ----------------------------------------------------
 1114    0 -   1 |     0x8000 | Magic
 1115            |            |
 1116    2 -   6 |     "PALO" | Zero terminated string
 1117            |            |
 1118    7 -   7 |          5 | Version
 1119            |            |
 1120    8 -  11 | kern32_adr | Byte address of the 32-bit kernel file
 1121            |            |
 1122   12 -  15 | kern32_len | Byte count of the 32-bit kernel file
 1123            |            |
 1124   16 -  19 | ramdsk_adr | Byte address of the ramdisk file
 1125            |            |
 1126   20 -  23 | ramdsk_len | Byte count of the ramdisk file
 1127            |            |
 1128   24 - 141 |          0 | All 0s. Old command line of version 4.
 1129            |            |
 1130            |            |
 1131  220 - 223 |          0 | (Length of uncompressed 32-bit kernel)
 1132            |            |
 1133  224 - 227 |          0 | (Length of uncompressed 64-bit kernel)
 1134            |            |
 1135  228 - 231 |          0 | (flags)
 1136            |            |
 1137  232 - 235 | kern64_adr | Byte address of the 64-bit kernel file
 1138            |            |
 1139  236 - 239 | kern64_len | Byte count of the 64-bit kernel file
 1140            |            |
 1141  240 - 243 |    ipl_adr | Byte address of the bootloader file
 1142            |            |
 1143  244 - 247 |    ipl_len | Byte count of the bootloader file
 1144            |            |
 1145  248 - 251 |          0 | (ipl_entry: offset to first command in bootloader)
 1146            |            |
 1147  446 - 511 |          0 | (MBR partition table and signature)
 1148            |            |
 1149 1024 -2047 |    cmdline | Zero terminated command line of up to
 1150            |            | 1023 characters
 1151            |            |
 1152 ---------- | ---------- | ----------------------------------------------------
 1153 
 1154 
 1155 ------------------------------------------------------------------------------
 1156 
 1157                           DEC Alpha SRM boot sector
 1158                            for Alpha architecture
 1159 
 1160 Sources:
 1161     http://www.tldp.org/HOWTO/text/SRM-HOWTO
 1162       SRM Firmware Howto - Rich Payne, and David Huggins-Daines
 1163     cdrkit-1.1.10/genisoimage/boot-alpha.c
 1164       by Steve McIntyre
 1165       who states "Heavily inspired by isomarkboot by David Mosberger in 1996"
 1166     mail conversations with Helge Deller
 1167     
 1168 The SRM firmware expects a Secondary Bootstrap Loader program, which usually
 1169 is a data file of the ISO filesystem. This loader is announced by size and
 1170 block address in the first 512 bytes of the System Area.
 1171 SRM accepts the boot sector and executes the loader if the checksum matches.
 1172 
 1173 All numbers are recorded as unsigned 64 bit little endian.
 1174 
 1175 Boot sector components:
 1176 
 1177 Byte Range | Value      | Meaning
 1178 ---------- | ---------- | ----------------------------------------------------
 1179    0 -   ? | boot_string| genisoimage writes
 1180            |            | "Linux/Alpha aboot for ISO filesystem." 
 1181            |            | with terminating zero byte.
 1182            |            |
 1183    ? - 479 |          0 | Unused / undefined.
 1184            |            |
 1185  480 - 487 |     length | Size of boot loader file in units of 512 bytes.
 1186            |            |
 1187  488 - 495 |    address | LBA of the boot loader file in units of 512 bytes.
 1188            |            |
 1189  496 - 503 |       flag | "Always 0"
 1190            |            |
 1191  504 - 511 |   checksum | Sum of 64 bit words 0 to 63 (bytes 0 to 503).
 1192            |            |
 1193 ---------- | ---------- | ----------------------------------------------------
 1194 
 1195 
 1196 ------------------------------------------------------------------------------
 1197 
 1198                          Combinations of boot mechanisms
 1199 
 1200 ------------------------------------------------------------------------------
 1201 
 1202 
 1203                              SYSLINUX Isohybrid MBR
 1204 
 1205 Sources:
 1206     syslinux-3.72/utils/isohybrid , a perl script by H. Peter Anvin = hpa.
 1207     Mailing list conversations with hpa.
 1208 
 1209 
 1210 An isohybrid MBR directs the booting BIOS to an ISOLINUX boot image which
 1211 is also the target of an El Torito boot catalog entry.
 1212 For that purpose one has to take an MBR template and has to set a few bytes
 1213 to values which sufficiently describe the ISO image and the boot image file.
 1214 
 1215 Words are composed little-endian style.
 1216 
 1217 Byte Range | Value      | Meaning
 1218 ---------- | ---------- | ----------------------------------------------------
 1219    0 - 431 | = opaque = | Syslinux machine code provided by MBR template
 1220            |            |
 1221  432 - 439 | hd_bootlba | Address of the ISOLINUX boot image file in the
 1222            |            | ISO image. Counted in 512 byte blocks.
 1223            |            |
 1224  440 - 443 |     mbr_id | Random number
 1225  444 - 445 |          0 | Padding
 1226            |            |
 1227  446 - 509 | ========== | Partition table
 1228            |            |
 1229  446 - 461 | part_entry | Partition table entry 1 describing ISO image size
 1230            |            | rounded up to the next full MiB. The partition starts
 1231            |            | at LBA 0. (I.e. contrary to tradition.)
 1232            |            | See above for partition table entry format.
 1233            |            |
 1234  462 - 509 |          0 | Unused partition entries 2 to 4
 1235  510 - 511 |     0xaa55 | MBR signature
 1236 ---------- | ---------- | ----------------------------------------------------
 1237 
 1238 The ISO image file gets padded up to the next full MiB.
 1239 
 1240 hpa about MBR templates and partition table filesystem types:
 1241 
 1242 "[MBR templates] are available in the Syslinux build tree under the names:
 1243    mbr/isohdp[fp]x*.bin
 1244  The default probably should be mbr/isohdppx.bin, but it's ultimately up
 1245  to the user.
 1246  [...]
 1247  Note: the filesystem type is largely arbitrary, in theory it can be any
 1248  value other than 0x00, 0x05, 0x0f, 0x85, 0xee, or 0xef.  0x17 ("Windows
 1249  IFS Hidden") seems safeish, some people believe 0x83 (Linux) is better.
 1250 "
 1251 
 1252 
 1253 >>>                SYSLINUX isohybrid for MBR, UEFI and x86-Mac
 1254 
 1255 Sources:
 1256   http://mjg59.dreamwidth.org/11285.html
 1257   http://mjg59.fedorapeople.org/Fedora-LiveCD.iso
 1258   http://opensource.apple.com/source/IOStorageFamily/IOStorageFamily-116/IOApplePartitionScheme.h (typedef struct Block0)
 1259   http://www.informit.com/articles/article.aspx?p=376123&seqNum=3
 1260   http://en.wikipedia.org/wiki/GUID_Partition_Table
 1261   http://en.wikipedia.org/wiki/GUID
 1262   syslinux-4.05/utils/isohybrid.c
 1263 
 1264 >>> Motivation: What systems will use the additional data ? amd64 UEFI ?
 1265 
 1266 This is a very condensed format which exposes a lot of entry points for boot
 1267 firmware. It disobeys some of the prescriptions in the previous chapter.
 1268 
 1269   Byte Range   | Value      | Meaning
 1270 -------------- | ---------- | -------------------------------------------------
 1271      0 -   511 | mbr        | Isohybrid MBR pointing to x86 boot image file,
 1272                |            | with three entries in its partition map.
 1273                |            | It shares its first 32 bytes with apm_head.
 1274      0 -    31 | apm_head   | Mock-up of the start of the first block of
 1275                |            | an Apple Partition Map (APM).
 1276    446  -  461 | mbr_entry1 | Partition table entry 1 describing the size of
 1277                |            | the ISO image plus the backup GPT, padded up to
 1278                |            | the next full MiB.
 1279    462  -  477 | mbr_entry2 | Entry 2 describing the EFI VFAT boot image.
 1280    478  -  493 | mbr_entry3 | Entry 3 describing the HFS+ boot image.
 1281                |            |
 1282    512 -  1023 | gpt_head   | GPT header describing the GPT partition array.
 1283   1024 -  2047 | unused     |
 1284   2048 -  4095 | apm_entry1 | APM entry 1 describing APM entries 1 to 3.
 1285   4096 -  6143 | apm_entry2 | APM entry 2 describing the EFI VFAT boot image.
 1286   6144 -  8195 | apm_entry3 | APM entry 3 describing the HFS+ boot image.
 1287   8192 -  8319 | gpt_entry1 | GPT partition entry 1 for the ISO image size.
 1288   8320 -  8447 | gpt_entry2 | GPT partition entry 2 for EFI VFAT boot image,
 1289   8448 -  8575 | gpt_entry3 | GPT partition entry 3 for the HFS+ boot image.
 1290   8576 - 24575 | gtp_empty  | Empty GPT partition entries 4 to 128.
 1291  24576 - 32767 | unused     |
 1292  32768 - 34815 | iso_pvd    | ISO 9660 superblock
 1293  34816 - 36863 | el_torito  | EL Torito boot block pointing to a boot catalog
 1294                |            | with entries for the MBR boot image (platform id
 1295                |            | 0x00), and for the two other boot images
 1296                |            | (platform id 0xef)
 1297 -------------- | ---------- | -------------------------------------------------
 1298 
 1299 
 1300 For the purpose of booting, there may be two EFI boot image files in the
 1301 ISO image. A VFAT image and a HFS+ image. The content of both is not in the
 1302 scope of this document.
 1303 These boot images get announced by EL Torito boot catalog entries with
 1304 Platform Id 0xef.
 1305 
 1306 
 1307 Newer SYSLINUX MBR templates begin by 32 bytes of machine code which are
 1308 intentionally non-essential:
 1309    33  ed  90  90  90  90  90  90  90  90  90  90  90  90  90  90
 1310    90  90  90  90  90  90  90  90  90  90  90  90  90  90  90  90
 1311 They may be overwritten by other bytes which must not produce errors or
 1312 undesirable side effects when executed as x86 machine code.
 1313 The following 32 bytes from block 0 of an Apple Partition Map (APM) are such
 1314 harmless code. They stem from Fedora-LiveCD.iso by Matthew Garrett:
 1315    45  52  08  00  00  00  90  90  00  00  00  00  00  00  00  00
 1316    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1317 They do not depend on any properties of the ISO image or the information
 1318 that is described in the following text.
 1319 
 1320 The layout of Block0 is constant:
 1321 
 1322 Byte Range | Value      | Meaning (all numbers are stored big endian)
 1323 ---------- | ---------- | ----------------------------------------------------
 1324    0 -   1 | sig        | Signature 0x45 = 'E' , 0x52 = 'R'
 1325    2 -   3 | block_size | 0x0800 = 2048
 1326    4 -   7 | block_count| 0x9090 = 37008
 1327    8 -   9 | dev_type   | obscure: "device type" = 0
 1328   10 -  11 | dev_id     | obscure: "device id"   = 0
 1329   12 -  15 | drv_data   | obscure: "driver data" = 0
 1330   16 -  17 | drv_count  | obscure: "driver descriptor count" = 0
 1331   18 -  81 | drv_map    | obscure: "driver descriptor table"
 1332            |            |          with 8 entries of 16 bytes each
 1333            |            |          first 14 bytes are 0
 1334 ---------- | ---------- | ----------------------------------------------------
 1335 
 1336 The block_count of 0x9090 is pure fantasy. It shall only mark the disc as
 1337 not empty.
 1338 
 1339 The data block ranges of the two EFI boot images get described by MBR
 1340 partition entries 2 and 3, which thus claim blocks inside of partition 1.
 1341 This partition nesting is acceptable to some EFI implementations only if the
 1342 type of partition 1 is 0x00.
 1343 
 1344 The MBR partition entry number 1 is
 1345    80  00  01  00  00  3f  a0  89  00  00  00  00  00  50  14  00
 1346 It marks the partition as bootable, starting at block 0, with a size that
 1347 is the smallest full MiB not smaller than the ISO image size + 18 KiB.
 1348 (The 18 KiB are needed for the GPT backup.)
 1349 The ISO image has a size of 332362 blocks of 2K = 1329448 * 512 = 649.14 MiB.
 1350 The partition size is 0x145000 = 1331200 * 512 = 650 MiB.
 1351 Start C/H/S = 0/0/1, type is 0x0 ("Empty"), end C/H/S is 649/63/32.
 1352 
 1353 Partition 2:
 1354    00  fe  ff  ff  ef  fe  ff  ff  a4  00  00  00  70  04  00  00
 1355 Start block is 0xa4 = 164 * 512 = 41 * 2048. The VFAT image file.
 1356 Partition size is 0x0470 = 1136 * 512. The size of that file.
 1357 Start C/H/S = 1023/254/63, type 0xef (fdisk says: "EFI (FAT-12/16/"),
 1358 end C/H/S =  1023/254/63.
 1359 
 1360 Partition 3:
 1361    00  fe  ff  ff  00  fe  ff  ff  44  05  00  00  c0  08  00  00
 1362 Start block is 0x0544 = 1348 * 512 = 337 * 2048. The HFS+ image file.
 1363 Partition size is 0x08c0 = 2240 * 512. The size of that file.
 1364 Start C/H/S = 1023/254/63, type 0x00 ("Empty"), end C/H/S =  1023/254/63.
 1365 
 1366 
 1367 The second 512-block in the ISO image is the GPT header.
 1368 
 1369    45  46  49  20  50  41  52  54  00  00  01  00  5c  00  00  00
 1370     E   F   I       P   A   R   T
 1371    13  db  71  5d  00  00  00  00  01  00  00  00  00  00  00  00
 1372    fe  4f  14  00  00  00  00  00  30  00  00  00  00  00  00  00
 1373    de  4f  14  00  00  00  00  00  73  23  c8  79  19  e6  97  4d
 1374    95  17  69  30  c5  38  e2  99  10  00  00  00  00  00  00  00
 1375    80  00  00  00  80  00  00  00  5b  6b  8a  65
 1376 
 1377 Byte Range | Value      | Meaning (little endian numbers, LBA unit is 512 byte)
 1378 ---------- | ---------- | ----------------------------------------------------
 1379   12 -  15 | head_size  | Header size = 0x5c = 92
 1380   24 -  31 | curr_lba   | Location of this header block = 0x1
 1381   32 -  39 | backup_lba | Location of header backup block = 0x144ffe = 1331198
 1382            |            | This is 1 KiB before the end of MBR partition 1
 1383            |            | (but should be 512 bytes).
 1384            |            | (Potential isohybrid.c bug #1:
 1385            |            |  Backup GPT is dislocated by 512 bytes.)
 1386   40 -  47 | first_lba  | First usable LBA for partitions = 0x30 = 48
 1387   48 -  55 | last_lba   | Last usable LBA for partitions  = 0x144fde = 1331166
 1388   56 -  71 | guid       | Disk GUID
 1389            |            | Random, produced by uuid_generate(),
 1390            |            | 32,16,16 byte swapped
 1391   72 -  79 | part_start | Partition entries start LBA = 0x10 = 16 = byte 0x2000
 1392            |            | (This is unusual. It leaves room for the Apple
 1393            |            |  partition map entries.)
 1394   80 -  83 | entry_count| Number of partition entries 0x80 = 128
 1395   84 -  87 | entry_size | Size of a partition entry = 0x80 = 128
 1396 ---------- | ---------- | ----------------------------------------------------
 1397 
 1398 
 1399 Because the block size was announced as 2048, the first Apple partition map
 1400 entry is located at byte 0x800 = 2048.
 1401 It describes the partition map itself:
 1402    50  4d  00  00  00  00  00  03  00  00  00  01  00  00  00  10
 1403     P   M
 1404    41  70  70  6c  65  00  00  00  00  00  00  00  00  00  00  00
 1405     A   p   p   l   e
 1406    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1407    41  70  70  6c  65  5f  70  61  72  74  69  74  69  6f  6e  5f
 1408     A   p   p   l   e   _   p   a   r   t   i   t   i   o   n   _
 1409    6d  61  70  00  00  00  00  00  00  00  00  00  00  00  00  00
 1410     m   a   p
 1411    00  00  00  00  00  00  00  0a  00  00  00  03  00  00  00  00
 1412 
 1413 
 1414 Byte Range | Value      | Meaning (all numbers are stored big endian)
 1415 ---------- | ---------- | ----------------------------------------------------
 1416    4 -   7 | map_entries| "number of partition entries" = 3
 1417    8 -  11 | start_block| "physical block start of partition" = 1
 1418   12 -  15 | block_count| "physical block count of partition" = 16
 1419            |            | (Potential isohybrid.c bug #2:
 1420            |            |  The value of 16 claims the ISO 9660 PVD as part of
 1421            |            |  the partition table. It should be 4 instead.)
 1422   16 -  47 | name       | Partition name = "Apple"
 1423   48 -  79 | type       | Type string = "Apple_partition_map"
 1424   80 -  83 | lb_start   | Logical block start = 0
 1425   84 -  87 | lb_count   | Logical block count = 10
 1426   88 -  91 | flags      | Status flags = 3 (valid, allocated)
 1427   92 -  95 | boot_block | Logical start block number of boot code = 0
 1428   96 -  99 | boot_bytes | Number of bytes in boot code = 0
 1429  100 - 119 |            | More boot code stuff = 0
 1430  120 - 135 | processor  | "processor type" = 0
 1431  136 - 511 | reserved   |
 1432 ---------- | ---------- | ----------------------------------------------------
 1433 
 1434 (Potential isohybrid.c bug #2:
 1435  Apple partition map entries bear the block count for blocks of 512 bytes
 1436  whereas Apple Block0 announces blocks of 2048 bytes.)
 1437 
 1438 The next Apple partition map entry is at byte 0x1000 = 4096:
 1439 
 1440    50  4d  00  00  00  00  00  03  00  00  00  29  00  00  04  70
 1441    45  46  49  00  00  00  00  00  00  00  00  00  00  00  00  00
 1442     E   F   I
 1443    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1444    41  70  70  6c  65  5f  48  46  53  00  00  00  00  00  00  00
 1445     A   p   p   l   e   _   H   F   S
 1446    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1447    00  00  00  00  00  00  04  70  00  00  00  33  00  00  00  00
 1448 
 1449 3 partitions, start block is 0x29 = 41,
 1450 block count is 0x0470 = 1136 (should be 284), name is "EFI",
 1451 type is "Apple_HFS" (although this is a FAT image),
 1452 logical block start = 0, lb_count = 1136 (should be 284),
 1453 flags = 0x33 : valid, allocated, readable, writable.
 1454 This points to file /isolinux/efiboot.img in the ISO image.
 1455 (Potential isohybrid.c bug #2:
 1456  Apple partition map entries bear the block count for blocks of 512 bytes
 1457  whereas Apple Block0 announces blocks of 2048 bytes.)
 1458 
 1459 At byte 0x1800 = 6144, there is Apple partition map entry 3:
 1460 
 1461    50  4d  00  00  00  00  00  03  00  00  01  51  00  00  08  c0
 1462    45  46  49  00  00  00  00  00  00  00  00  00  00  00  00  00
 1463     E   F   I
 1464    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1465    41  70  70  6c  65  5f  48  46  53  00  00  00  00  00  00  00
 1466     A   p   p   l   e   _   H   F   S
 1467    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1468    00  00  00  00  00  00  08  c0  00  00  00  33  00  00  00  00
 1469 
 1470 3 partitions, start block is 0x0151 = 337 (LBA of /isolinux/macboot.img),
 1471 block count = 0x08c0 = 2240 (should be 560), name is "EFI",
 1472 type is "Apple_HFS", logical block start = 0, lb_count = 2240 (should be 560),
 1473 flags = 0x33 : valid, allocated, readable, writable.
 1474 (Potential isohybrid.c bug #2:
 1475  Apple partition map entries bear the block count for blocks of 512 bytes
 1476  whereas Apple Block0 announces blocks of 2048 bytes.)
 1477 
 1478 At byte 0x2000 = 8192 begins the GPT partition array.
 1479 It ends at byte 0x4000 = 16384.
 1480 
 1481    a2  a0  d0  eb  e5  b9  33  44  87  c0  68  b6  b7  26  99  c7
 1482    a1  87  a1  ba  4d  2c  27  45  ae  05  cf  ab  a6  fa  87  c1
 1483    00  00  00  00  00  00  00  00  28  49  14  00  00  00  00  00
 1484    00  00  00  00  00  00  00  00  49  53  4f  48  79  62  72  69
 1485                                     I   S   O   H   y   b   r   i
 1486    64  20  49  53  4f  00  49  53  4f  48  79  62  72  69  64  00
 1487     d       I   S   O       I   S   O   H   y   b   r   i   d   
 1488    41  70  70  6c  00  00  00  00  00  00  00  00  00  00  00  00
 1489     A   p   p   l
 1490    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1491    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1492 
 1493 Byte Range | Value      | Meaning (numbers are stored little endian)
 1494 ---------- | ---------- | ----------------------------------------------------
 1495    0 -  15 | type_guid  | Partition type GUID = Basic data partition
 1496            |            | Wikipedia: "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
 1497            |            | (Note: The first three words are shown byte swapped)
 1498   16 -  31 | part_guid  | Unique partition GUID
 1499            |            | Random, produced by uuid_generate()
 1500            |            | 32,16,16 byte swapped
 1501   32 -  39 | start_lba  | First LBA = 0
 1502   40 -  47 | end_lba    | Last LBA (inclusive) = 0x144828 = 1329448
 1503            |            | This is the ISO image size in blocks of 512.
 1504            |            | (Potential isohybrid.c bug #3:
 1505            |            |  The end_lba in the first GPT entry should be 1 less
 1506            |            |  than the count of 512 byte blocks of the ISO image.)
 1507   48 -  55 | flags      | Attribute flags = 0
 1508   56 - 127 | name       | Wikipedia says UTF-16LE.
 1509            |            | (Potential isohybrid.c bug #4:
 1510            |            |  The name in Fedora-LiveCD.iso is 8 bit and result
 1511            |            |  of faulty memory operation on a text constant.)
 1512 ---------- | ---------- | ----------------------------------------------------
 1513 
 1514 Next entry is at 0x2800 = 10240:
 1515 
 1516    a2  a0  d0  eb  e5  b9  33  44  87  c0  68  b6  b7  26  99  c7
 1517    c8  de  c8  1f  fb  f0  51  40  8c  8a  d2  f6  b1  46  16  dc
 1518    a4  00  00  00  00  00  00  00  13  05  00  00  00  00  00  00
 1519    00  00  00  00  00  00  00  00  49  53  4f  48  79  62  72  69
 1520                                     I   S   O   H   y   b   r   i
 1521    64  00  41  70  70  6c  65  00  41  70  70  6c  00  00  00  00
 1522     d       A   p   p   l   e       A   p   p   l
 1523    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1524    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1525    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1526 
 1527 Partition type GUID : "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" = Basic data
 1528 Start at block 0xa4 = 164 * 512 = 41 * 2048. The VFAT image file.
 1529 Last block is 0x0513 = 1299 = 164 + 1135. This end is correct.
 1530 (Potential isohybrid.c bug #4:
 1531  Wrong character set and incidential bytes in GPT partition name.)
 1532 (Potential isohybrid.c bug #5:
 1533  The EFI System Partition should have type GUID :
 1534  "C12A7328-F81F-11D2-BA4B-00A0C93EC93B")
 1535 
 1536 Next entry at byte 0x02100 = 8448:
 1537 
 1538    00  53  46  48  00  00  aa  11  aa  11  00  30  65  43  ec  ac
 1539    c8  de  c8  1f  fb  f0  51  40  8c  8a  d2  f6  b1  46  16  dc
 1540    44  05  00  00  00  00  00  00  03  0e  00  00  00  00  00  00
 1541    00  00  00  00  00  00  00  00  49  53  4f  48  79  62  72  69
 1542                                     I   S   O   H   y   b   r   i
 1543    64  00  41  70  70  6c  65  00  41  70  70  6c  00  00  00  00
 1544     d       A   p   p   l   e       A   p   p   l
 1545    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1546    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1547    00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
 1548 
 1549 Partition type GUID : "48465300-0000-11AA-AA11-00306543ECAC" = HFS+
 1550 Start block is 0x0544 = 1348 * 512 = 337 * 2048. The HFS+ image file.
 1551 Last block is  0x0e03 = 3587 = 1348 + 2239. Correct.
 1552 (Potential isohybrid.c bug #4:
 1553  Wrong character set and incidential bytes in GPT partition name.)
 1554 
 1555 The rest of the System Area is 0 up to the Primary Volume Descriptor
 1556 at block 16.
 1557 
 1558 
 1559 The ISO image file gets padded up to full MiB with sufficient room for the GPT
 1560 backup which is stored near the very end of the image file. There is need for
 1561 at least 16.5 KiB, which effectively occupy 18 KiB.
 1562 
 1563 The backup partition array is stored 17 KiB before the end of MBR partition 1,
 1564 which is also the end of the image file.
 1565 (Potential isohybrid.c bug #1:
 1566  Wikipedia suggests "LBA -33" counted from end. This would be 16.5 KiB before
 1567  end.)
 1568 
 1569 The GPT header is stored 1 KiB before the end of MBR partition 1.
 1570 (Potential isohybrid.c bug #1:
 1571  Wikipedia suggests "LBA -1" counted from end. This would be 512 bytes.)
 1572 
 1573    45  46  49  20  50  41  52  54  00  00  01  00  5c  00  00  00
 1574     E   F   I       P   A   R   T
 1575    f6  61  10  1c  00  00  00  00  fe  4f  14  00  00  00  00  00
 1576    01  00  00  00  00  00  00  00  30  00  00  00  00  00  00  00
 1577    de  4f  14  00  00  00  00  00  73  23  c8  79  19  e6  97  4d
 1578    95  17  69  30  c5  38  e2  99  de  4f  14  00  00  00  00  00
 1579    80  00  00  00  80  00  00  00  5b  6b  8a  65 
 1580 
 1581 It differs by its own CRC and by some of its parameters:
 1582 Own address is 0x144ffe. The backup lba is 0x01 = Primary GPT header.
 1583 Partition entries start is 0x144fde
 1584 (Potential isohybrid.c bug #1:
 1585  This overlaps with the last usable LBA. The backup GPT must move up by
 1586  512 bytes.)
 1587 
 1588 ------------------------------------------------------------------------------
 1589 
 1590 
 1591                           GRUB2 grub-mkrescue MBR
 1592 
 1593 Sources:
 1594     Mailing list conversations with Vladimir Serbinenko.
 1595 
 1596 
 1597 The MBR file that is used with older versions of GRUB2 script grub-mkrescue
 1598 needs only a partition table entry which describes the image size.
 1599 Newer versions get patched by the block address of the content of the first
 1600 El Torito boot image. See grub-mkrescue use of xorrisofs option --grub2-mbr.
 1601 
 1602 Byte Range | Value      | Meaning
 1603 ---------- | ---------- | ----------------------------------------------------
 1604    0 - 431 | = opaque = | GRUB2 machine code provided by MBR template
 1605            |            |
 1606  432 - 439 | bootimg_adr| With newer versions of grub-mkrescue:
 1607            |            | Block address of the start of the boot image file
 1608            |            | content plus 4. Block size is 512.
 1609            |            | 64 bit Little-endian.
 1610            |            |
 1611  440 - 445 | = opaque = | provided by MBR template
 1612            |            |
 1613  446 - 509 | ========== | Partition table
 1614            |            |
 1615  446 - 461 | part_entry | Partition table entry 1 describing ISO image size
 1616            |            | Peculiar is the start offset of 1 block.
 1617            |            | This prevents mounting of the partition.
 1618            |            | See above for partition table entry format.
 1619            |            |
 1620  462 - 509 |          0 | Unused partition entries 2 to 4
 1621  510 - 511 |     0xaa55 | MBR signature
 1622 ---------- | ---------- | ----------------------------------------------------
 1623 
 1624 Vladimir Serbinenko about the partition table entry:
 1625 "Currently we use first and not last entry. You need to:
 1626  1) Zero-fill 446-510
 1627  2) Put 0x55, 0xAA into 510-512
 1628  3) Put 0x80 (for bootable partition), 0, 2, 0 (C/H/S of the start), 0xcd
 1629    (partition type), [3 bytes of C/H/S end], 0x01, 0x00, 0x00, 0x00 (LBA
 1630    start in little endian), [LBA end in little endian] at 446-462
 1631 "
 1632 
 1633 ------------------------------------------------------------------------------
 1634 
 1635 >>> Mac and/or PowerPC bootable GRUB2 image with HFS+/FAT, APM,
 1636     EFI GPT partition, PreP MBR partition, mountable FAT partition
 1637 
 1638 >>> ? With PC-BIOS MBR x86 Code ?
 1639 
 1640 This storage layout was mainly defined by Vladimir Serbinenko. It relies much
 1641 on the embedded HFS+/FAT filesystem for which he provided the code to libisofs.
 1642 
 1643 Start Blocks (2 KiB):
 1644      0  System Area
 1645     16  Volume Descriptors
 1646   TREE  ISO-RR tree, Joliet tree, other trees and meta data, except HFS+/FAT
 1647    EFI  EFI boot image partition (optional)
 1648   PREP  Prep image partition (optional)
 1649   HFAT  HFS+/FAT metadata (optional)
 1650   DATA  Data file content (including El Torito boot images)
 1651   HFSB  HFS superblock backup (if HFS+/FAT metadata)
 1652   TAIL  Further tails and paddings (optional)
 1653   GPTB  GPT backup (if GPT in System Area) 
 1654    END  End of ISO image
 1655  
 1656 System Area may contain simultaneously:
 1657    MBR (x86 boot code must leave room for 8 bytes mock-up of APM Block0)
 1658    APM
 1659    GPT
 1660 
 1661 MBR Partitions:
 1662    0xee from    0 to PREP-1, protective partition, announcing presence of GPT
 1663    0x41 from PREP to HFAT-1, PreP partition
 1664    0x0c from HFAT to  END-1, FAT partition, bootable bit on
 1665    0x00                      Empty partition
 1666 
 1667 GPT Partitions:
 1668    The primary GPT itself covers the System Area.
 1669    Basic Data  from   16 to  EFI-1, protects first part of ISO image
 1670    EFI System  from  EFI to PREP-1, offers EFI image for booting
 1671    Basic Data  from PREP to HFAT-1, protects PreP partition
 1672    HFS+        from HFAT to TAIL-1, offers HFS+ for mounting
 1673    Basic Data  from TAIL to GPTB-1, protects rest of ISO image (if there is)
 1674 
 1675 APM Partitions:
 1676    The range from end of APM to end of System Area stays unprotected.
 1677    (The primary GPT might sit there.) 
 1678    Apple_partition_map from    1 to 3 or 4, covers the APM itself
 1679    ISO9660_data        from   16 to HFAT-1, covers first part of ISO image
 1680    Apple_HFS           from HFAT to GPTB-1, offers HFS+ for boot and mount
 1681    ISO9660_data        from GPTB to  END-1, covers rest of ISO image
 1682                                             (might be omitted if empty)
 1683 
 1684 El Torito:
 1685    Boot image for 80x86 PC-BIOS 
 1686    Boot image for EFI (usually the same file as the partition EFI to PREP-1).
 1687 
 1688 If optional components are not present, then their addresses coincide with
 1689 the address of the next component that is present. E.g. HFAT == DATA if no
 1690 HFS+/FAT filesystem is present.
 1691 If no FAT filesystem is present within HFS+/FAT, then the type of the last
 1692 partition is 0xcd.
 1693 If neither EFI, nor PreP, nor FAT within HFS+/FAT, are present, then there
 1694 is only one partition. It has type 0xee, if GPT is present in the System Area.
 1695 It has type 0xcd and offset 1*512, if no GPT is present.
 1696 
 1697 Involved -as mkisofs options:
 1698   -hfsplus
 1699   -fat
 1700   -efi-boot-part DISKFILE
 1701   -prep-boot-part DISKFILE
 1702 
 1703 
 1704 >>> What boots by what ?
 1705 
 1706 
 1707 
 1708 ------------------------------------------------------------------------------
 1709