com32: export the filename of a com32 module to the module itself
[profile/ivi/syslinux.git] / doc / gpt.txt
1                           GPT boot protocol
2
3 There is no official MBR-to-partition handover protocol defined for
4 booting from disks partitioned using GPT partition tables with
5 BIOS-style firmware.  This is because the GPT partition format comes
6 from the EFI spec, which thinks the universe is all going to be EFI.
7 Sigh.
8
9 There are thus two alternatives: hybrid booting, and defining a new
10 protocol.
11
12         *** Hybrid booting ***
13
14 Hybrid booting uses a standard MBR, and has bootable ("active")
15 partitions present, as partitions, in the GPT PMBR sector.  This means
16 the PMBR, instead of containing only one "protective" partition (type
17 EE), may contain up to three partitions: a protective partition (EE)
18 *before* the active partition, the active partition, and a protective
19 partition (EE) *after* the active partition.  The active partition is
20 limited to the first 2^32 sectors (2 TB) of the disk.
21
22 All partitions, including the active partition, should have GPT
23 partition entries.  Thus, changing which partition is active does NOT
24 change the GPT partition table.
25
26 This is the only known way to boot Microsoft operating systems from a
27 GPT disk with BIOS firmware.
28
29
30         *** New protocol ***
31
32 This defines an alternative (experimental) booting protocol for GPT
33 partitions with BIOS firmware.  It maintains backwards compatibility
34 to the extent possible.  It is implemented by the file mbr/gptmbr.bin.
35
36    -> The PMBR
37
38 The PMBR (the first 512-byte sector of the disk) is divided up as
39 follows:
40
41         Offset  Size    Contents
42         ---------------------------------------------------------
43           0     424     PMBR boot code
44         424      16     GUID of the boot partition
45         440       4     MBR-compatible disk ID
46         444       2     Magic number: 1D 9A
47         446      16     PMBR protective entry
48         462      48     PMBR null entries
49         510       2     Boot signature: 55 AA
50
51 To change the bootable partition, verify that the magic number is
52 present (to avoid corrupting software not compatible with this
53 specification) and enter the GUID of the boot partition at offset
54 424.  It might be wise to verify that the data already there is a
55 valid partition GUID already, or at least warn the user if that is not
56 the case.
57
58     -> The handover protocol
59
60 The PMBR boot code loads the first sector of the bootable partition,
61 and passes in DL=<disk number>, ES:DI=<pointer to $PnP>, sets EAX to
62 0x54504721 ("!GPT") and points DS:SI to a structure of the following
63 form:
64
65         Offset  Size    Contents
66         ---------------------------------------------------------
67           0       1     0x80 (this is a bootable partition)
68           1       3     CHS of partition (using INT 13h geometry)
69           4       1     0xEE (partition type: EFI data partition)
70           5       3     CHS of partition end
71           8       4     Partition start LBA
72          12       4     Partition end LBA
73          16     varies  GPT partition entry
74
75 The CHS information is optional; gptmbr.bin currently does *NOT*
76 calculate them, and just leaves them as zero.
77
78 Bytes 0-15 matches the standard MBR handover (DS:SI points to the
79 partition entry), except that the information is provided
80 synthetically.  The MBR-compatible fields are directly usable if they
81 are < 2 TB, otherwise these fields should contain 0xFFFFFFFF and the
82 OS will need to understand the GPT partition entry which follows the
83 MBR one.  The "!GPT" magic number in EAX and the 0xEE partition type
84 also informs the OS that the GPT partition information is present.
85
86 Currently, this is compatible with Syslinux as long as the Syslinux
87 partition is < 2 TB; this probably will be improved in a future
88 version.