1 | GPT boot protocol |
---|
2 | |
---|
3 | There are two ways to boot a GPT-formatted disk on a BIOS system. |
---|
4 | Hybrid booting, and the new GPT-only booting protocol originally |
---|
5 | proposed by the author, and later adopted by the T13 committee in |
---|
6 | slightly modified form. |
---|
7 | |
---|
8 | |
---|
9 | *** Hybrid booting *** |
---|
10 | |
---|
11 | Hybrid booting uses a standard MBR, and has bootable ("active") |
---|
12 | partitions present, as partitions, in the GPT PMBR sector. This means |
---|
13 | the PMBR, instead of containing only one "protective" partition (type |
---|
14 | EE), may contain up to three partitions: a protective partition (EE) |
---|
15 | *before* the active partition, the active partition, and a protective |
---|
16 | partition (EE) *after* the active partition. The active partition is |
---|
17 | limited to the first 2^32 sectors (2 TB) of the disk. |
---|
18 | |
---|
19 | All partitions, including the active partition, should have GPT |
---|
20 | partition entries. Thus, changing which partition is active does NOT |
---|
21 | change the GPT partition table. |
---|
22 | |
---|
23 | This is the only known way to boot Microsoft operating systems from a |
---|
24 | GPT disk with BIOS firmware. |
---|
25 | |
---|
26 | |
---|
27 | *** New protocol *** |
---|
28 | |
---|
29 | This defines the T13-approved protocol for GPT partitions with BIOS |
---|
30 | firmware. It maintains backwards compatibility to the extent |
---|
31 | possible. It is implemented by the file mbr/gptmbr.bin. |
---|
32 | |
---|
33 | The (P)MBR format is the normal PMBR specified in the UEFI |
---|
34 | documentation, with the first 440 bytes used for the boot code. The |
---|
35 | partition to be booted is marked by setting bit 2 in the GPT Partition |
---|
36 | Entry Attributes field (offset 48); this bit is reserved by the UEFI |
---|
37 | Forum for "Legacy BIOS Bootable". |
---|
38 | |
---|
39 | |
---|
40 | -> The handover protocol |
---|
41 | |
---|
42 | The PMBR boot code loads the first sector of the bootable partition, |
---|
43 | and passes in DL=<disk number>, ES:DI=<pointer to $PnP>, sets EAX to |
---|
44 | 0x54504721 ("!GPT") and points DS:SI to a structure of the following |
---|
45 | form: |
---|
46 | |
---|
47 | Offset Size Contents |
---|
48 | --------------------------------------------------------- |
---|
49 | 0 1 0x80 (this is a bootable partition) |
---|
50 | 1 3 CHS of partition (using INT 13h geometry) |
---|
51 | 4 1 0xED (partition type: synthetic) |
---|
52 | 5 3 CHS of partition end |
---|
53 | 8 4 Partition start LBA |
---|
54 | 12 4 Partition length in sectors |
---|
55 | 16 4 Length of the GPT entry |
---|
56 | 20 varies GPT partition entry |
---|
57 | |
---|
58 | The CHS information is optional; gptmbr.bin currently does *NOT* |
---|
59 | calculate them, and just leaves them as zero. |
---|
60 | |
---|
61 | Bytes 0-15 matches the standard MBR handover (DS:SI points to the |
---|
62 | partition entry), except that the information is provided |
---|
63 | synthetically. The MBR-compatible fields are directly usable if they |
---|
64 | are < 2 TB, otherwise these fields should contain 0xFFFFFFFF and the |
---|
65 | OS will need to understand the GPT partition entry which follows the |
---|
66 | MBR one. The "!GPT" magic number in EAX and the 0xED partition type |
---|
67 | also informs the OS that the GPT partition information is present. |
---|
68 | |
---|
69 | Syslinux 4.00 and later fully implements this protocol. |
---|