From d7401f0a4c11949de67f4668936f89fbd6403e07 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 12 Jun 2012 17:42:22 +0200 Subject: [PATCH] Updated description of boot sectors by sparse info about PReP, CHRP. Described the layout for GRUB2 based hybrid images. --- doc/boot_sectors.txt | 135 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 124 insertions(+), 11 deletions(-) diff --git a/doc/boot_sectors.txt b/doc/boot_sectors.txt index 07c6dc8..9935dd0 100644 --- a/doc/boot_sectors.txt +++ b/doc/boot_sectors.txt @@ -17,9 +17,9 @@ EL Torito CD booting, for PC-BIOS x86, PowerPC, (old) Mac, EFI. Master Boot Record (MBR), for PC-BIOS x86 from (pseudo-) hard disk -Apple Partition Map (APM) +Apple Partition Map (APM), for more modern Mac -GUID Partition Table (GPT) +GUID Partition Table (GPT), for EFI from (pseudo-) hard disk MIPS Volume Header, for MIPS Big Endian, e.g. SGI Indigo2. @@ -27,10 +27,16 @@ DEC Boot Block, for MIPS Little Endian , e.g. DECstation. SUN Disk Label and boot images, for SUN SPARC +PowerPC Reference Platform (PReP), for IBM PowerPC + +Common Hardware Reference Platform (CHRP), for IBM PowerPC + Combinations of boot mechanisms: - SYSLINUX isohybrid MBR - SYSLINUX isohybrid for MBR, UEFI and x86 Mac - GRUB2 grub-mkrescue MBR +>>> Mac and/or PowerPC bootable GRUB2 image with HFS+/FAT, APM, + EFI GPT partition, PreP MBR partition, mountable FAT partition ------------------------------------------------------------------------------ @@ -50,7 +56,13 @@ with arbitrary content. This prescription is obeyed by PC-BIOS systems only if the ISO 9660 image is presented on CD, DVD or BD media. In this case the El Torito Boot record is the starting point of booting. -The Boot Record is a ECMA-119 Volume Descriptor which is eventually located +After the System Area, an ISO 9660 image usually has three distinct block +intervals for: +- Volume descriptors (Primary Volume Descriptor, Boot Record, Joliet, ...) +- Directory trees, tables, boot catalog, embedded partitions and filesystems. +- Data file content, including content of El Torito boot images. + +The Boot Record is an ECMA-119 Volume Descriptor which is eventually located at 2 kB block number 17 (decimal). Its content points to the location of the Boot Catalog. The format is described in part by ECMA-119 8.2 "Boot Record" and further @@ -373,8 +385,8 @@ HFS+ filesystem. Block0 of an APM begins at byte 0 of the medium. Thus it collides with MBR and other boot sector formats. By lucky coincidence it is possible to compose a mock-up of a Block0 which is acceptable to firmware which expects APM, -and is also harmless x86 machine with no negative side effects. -So it is possible to combine APM with specially prepared MBR. +and is also harmless x86 machine code with no negative side effects. +So it is possible to combine APM with an especially prepared MBR. The layout of a Block0 of an APM is: @@ -424,6 +436,7 @@ Byte Range | Value | Meaning (all numbers are stored big endian) | | bit1= entry is allocated | | bit4= partition is readable | | bit5= partition is writable + | | bit30= automatic mount (legacy Mac) 92 - 95 | boot_block | Logical start block number of boot code = 0 96 - 99 | boot_bytes | Number of bytes in boot code = 0 100 - 119 | | More boot code stuff = 0 @@ -457,11 +470,11 @@ start_block = start_of_hfs block_count = end_of_hfs - start_of_hfs name = "HFSPLUS_Hybrid" type = "Apple_HFS" -flags = 0x13 +flags = 0x40000013 Entry 4 (byte 0x2000) describes the interval from the end of the HFS+ partition to the end of the ISO image. It is possible that this interval is -empty. In this case, no forth APM entry will be written. +empty. In this case, no fourth APM entry will be written. start_block = end_of_hfs block_count = end_of_iso - end_of_hfs name = "Gap1" @@ -479,7 +492,7 @@ flags = 0x13 GUID Partition Table (GPT) for alternative mountability paths - and for booting of some Apple Macs from (pseudo-) hard disk + and for EFI booting of some Apple Macs from (pseudo-) hard disk Sources: http://mjg59.dreamwidth.org/11285.html @@ -536,6 +549,7 @@ A globally registered class of GUID are the partition type GUIDs. This example uses two of them Basic data partition: a2 a0 d0 eb , e5 b9 , 33 44 , 87 c0 68 b6 b7 26 99 c7 HFS+ partition : 00 53 46 48 , 00 00 , aa 11 , aa 11 00 30 65 43 ec ac +EFI System partition: 28 73 2a c1 , 1f f8 , d2 11 , ba 4b 00 a0 c9 3e c9 3b Note that the wikipedia list shows the first 32-bit word and the next two 16-bit words in little-endia interpretation. @@ -581,6 +595,11 @@ Byte Range | Value | Meaning (little endian numbers, LBA unit is 512 byte) | | Points to start of backup partition table. ---------- | ---------- | ---------------------------------------------------- + +An EFI System partition usually contains the same data blocks as the El Torito +boot image for EFI. It is used for booting some Macs from (pseudo-) hard disk. + + ------------------------------------------------------------------------------ @@ -866,6 +885,36 @@ Byte Range | Value | Meaning ---------- | ---------- | ---------------------------------------------------- +------------------------------------------------------------------------------ + + + PowerPC Reference Platform (PReP) + for IBM PowerPC + +Sources: + Mail conversations with Vladimir Serbinenko. + + +PReP boots via a MBR partition containing only raw ELF and having type 0x41. + + +------------------------------------------------------------------------------ + + + Common Hardware Reference Platform (CHRP) + for IBM PowerPC + +Sources: + Mail conversations with Vladimir Serbinenko. + + +CHRP is marked by an MBR partition entry of type 0x96 spanning the whole +ISO 9660 image. + +PReP boot may be preferable. At least it can co-exist with other partitions +in the ISO image. + + ------------------------------------------------------------------------------ >>> ??? HP-PA @@ -1299,9 +1348,73 @@ Vladimir Serbinenko about the partition table entry: ------------------------------------------------------------------------------ ->>> Mac bootable GRUB2 image with HFS+ and APM ->>> ? With EFI partition ? ->>> ? With PC-BIOS MBR ? +>>> Mac and/or PowerPC bootable GRUB2 image with HFS+/FAT, APM, + EFI GPT partition, PreP MBR partition, mountable FAT partition + +>>> ? With PC-BIOS MBR x86 Code ? + +This storage layout was mainly defined by Vladimir Serbinenko. It relies much +on the embedded HFS+/FAT filesystem for which he provided the code to libisofs. + +Start Blocks (2 KiB): + 0 System Area + 16 Volume Descriptors + TREE ISO-RR tree, Joliet tree, other trees and meta data, except HFS+/FAT + EFI EFI boot image partition (optional) + PREP Prep image partition (optional) + HFAT HFS+/FAT metadata (optional) + DATA Data file content (including El Torito boot images) + HFSB HFS superblock backup (if HFS+/FAT metadata) + TAIL Further tails and paddings (optional) + GPTB GPT backup (if GPT in System Area) + END End of ISO image + +System Area may contain simultaneously: + MBR (x86 boot code must leave room for 8 bytes mock-up of APM Block0) + APM + GPT + +MBR Partitions: + 0xee from 0 to PREP-1, protective partition, announcing presence of GPT + 0x41 from PREP to HFAT-1, PreP partition + 0x0c from HFAT to END-1, FAT partition, bootable bit on + 0x00 Empty partition + +GPT Partitions: + The primary GPT itself covers the System Area. + Basic Data from 16 to EFI-1, protects first part of ISO image + EFI System from EFI to PREP-1, offers EFI image for booting + Basic Data from PREP to HFAT-1, protects PreP partition + HFS+ from HFAT to TAIL-1, offers HFS+ for mounting + Basic Data from TAIL to GPTB-1, protects rest of ISO image (if there is) + +APM Partitions: + The range from end of APM to end of System Area stays unprotected. + (The primary GPT might sit there.) + Apple_partition_map from 1 to 3 or 4, covers the APM itself + ISO9660_data from 16 to HFAT-1, covers first part of ISO image + Apple_HFS from HFAT to GPTB-1, offers HFS+ for boot and mount + ISO9660_data from GPTB to END-1, covers rest of ISO image + (might be omitted if empty) + +El Torito: + Boot image for 80x86 PC-BIOS + Boot image for EFI (usually the same file as the partition EFI to PREP-1). + +If optional components are not present, then their addresses coincide with +the address of the next component that is present. E.g. HFAT == DATA if no +HFS+/FAT filesystem is present. +If no FAT filesystem is present within HFS+/FAT, then the type of the last +partition is 0xcd. +If neither EFI, nor PreP, nor FAT within HFS+/FAT, are present, then there +is only one partition. It has type 0xee, if GPT is present in the System Area. +It has type 0xcd and offset 1*512, if no GPT is present. + +Involved -as mkisofs options: + -hfsplus + -fat + -efi-boot-part DISKFILE + -prep-boot-part DISKFILE ------------------------------------------------------------------------------