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

Collection of Boot Sector Formats for ISO 9660 Images的更多相关文章

  1. U盘安装CentOS6.x报错:Missing ISO 9660 Image

    以前都是DVD安装CentOS,这次因为装固态硬盘,然后把光驱给卸载了.所以就尝试用U盘引导安装CentOS,结果安装时竟然出现了Missing ISO 9660 Image的错误. 解决方案: 将C ...

  2. RHEL64 缺少ISO 9660图像 安装程序试图挂载映像#1,在硬盘上无法找到该映像

    用光盘安装Linux,很容易,按照提示一步一步就好.如果没有光驱,只好想办法用硬盘或者U盘安装了. 首先说说怎样用U盘启动Linux的安装程序:1.将ISO镜像文件拷贝到U盘中,并解压到U盘根目录.将 ...

  3. err:安装程序试图挂载映像 1(缺少ISO 9660图像)

    一般出现此错误是因为你没有把相应的CentOS-6.4-i386-bin-DVD1.iso文件放入到你装系统所引导的盘中,造成找不到挂载映像文件. ubuntu-12.04.3-desktop-i38 ...

  4. 自制操作系统Antz(1)——Boot Sector

    0.引子 最近在看操作系统底层方面的东西,最开始的为什么是07c00h这个问题就让我对操作系统有了很大的兴趣.所以准备在看书之余顺便写一个操作系统(Anz).至于为什么这个系统会被叫做Antz,可以参 ...

  5. Boot Sector - Hello world

    1. code bits org 7c00h mov ax, cs mov ds, ax mov es, ax call DispStr jmp $ DispStr: mov ax, BootMess ...

  6. U盘安装centos6.4:缺少iso 9660映像

    方法: 1.下载安装的ISO文件    到www.centos.org网站下载对应的Centos 6.4安装文件.下载站点我一般选择网易镜像站点    64位下载参考链接:http://mirrors ...

  7. boot sector FAT

  8. liunx mkisofs 命令的使用(制作iso)

    参考的博客 http://www.cnblogs.com/darkknightzh/p/8564483.html 有很多时候需要在liunx 环境中将文件打成 iso 所有很多时候就会用到这个命令(m ...

  9. centos custom iso

    http://www.smorgasbork.com/2012/01/04/building-a-custom-centos-6-kickstart-disc-part-1/ Create a dir ...

随机推荐

  1. 三读bootmem【转】

    转自:http://blog.csdn.net/lights_joy/article/details/2704788 版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[-] 11  ...

  2. 解决win2008下IIS7的HTTP500错误

    造成500错误常见原因有:ASP语法出错.ACCESS数据库连接语句出错.文件引用与包含路径出错.使用了服务器不支持的组件如FSO等.另外,对于win2008的IIS默认不显示详细出错信息的问题以下就 ...

  3. AC日记——Weird Rounding Codeforces 779b

    B. Weird Rounding time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  4. AC日记——[USACO15DEC]最大流Max Flow 洛谷 P3128

    题目描述 Farmer John has installed a new system of  pipes to transport milk between the  stalls in his b ...

  5. 如何快速定位TempDB产生问题

    步骤1.TempDB压力诊断 等待类型诊断 TempDB的争用压力在等待篇中已经简单介绍,等待的表现为 pagelatch_类等待,等待的资源是 “2: X :X ” tempDB所在磁盘的响应时间 ...

  6. 洛谷—— P1440 求m区间内的最小值

    https://www.luogu.org/problemnew/show/P1440 题目描述 一个含有n项的数列(n<=2000000),求出每一项前的m个数到它这个区间内的最小值.若前面的 ...

  7. 洛谷——P1144 最短路计数

    P1144 最短路计数 题目描述 给出一个N个顶点M条边的无向无权图,顶点编号为1-N.问从顶点1开始,到其他每个点的最短路有几条. 输入输出格式 输入格式: 输入第一行包含2个正整数N,M,为图的顶 ...

  8. AtCoder - 3913 XOR Tree

    Problem Statement You are given a tree with N vertices. The vertices are numbered 0 through N−1, and ...

  9. 转:PHP 生成复杂JSON格式 简单快速方法

    PHP 生成JSON 格式主要使用json_encode()函数.这个函数的输入参数支持PHP数组和对象类型. 查阅网上的例子通常都是使用数组的,也有个别使用对象生成.但实际项目中,我们要生成的JSO ...

  10. Window10下Apache2.4的安装和运行

    以前用Python运行的Web框架都是要运行在Linux下,加上WSGI服务器,比如Gunicorn+Flask,后来了解到了Apache,看看能不能基于Apache这个Web服务器下给python提 ...