You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1710 lines
77 KiB

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