1# Partitions in GBL 2 3This document describes how GBL defines and handles partitions on mass storage 4devices. 5 6## Definition of Partition 7 8In GBL, all EFI devices that implement either the `EFI_BLOCK_IO_PROTOCOL` or 9`EFI_BLOCK_IO2_PROTOCOL` protocols are considered storage devices that may 10contain necessary data for GBL to access. For each of this device, GBL supports 11two schemes of partition: 12 131. Entire raw storage as a partition. 14 15 This scheme treats the entire storage device as a single partition. For 16 storage devices intended to be used according to this scheme, the device 17 need to provide an instance of device path that ends with the GBL 18 "Vendor-Defined Media Device Path" defined as follows. 19 20 | Mnemonic | Bytes Offset | Bytes Length | Description | 21 | ----------- | ----------- | ----------- | ----------- | 22 | Type | 0 | 1 | Type 4-Media Device Path. | 23 | Sub-Type | 1 | 1 | Sub-Type 3 - Vendor. | 24 | Length | 2 | 2 | Length of this structure in bytes. Length is 92 bytes. | 25 | Vendor GUID | 4 | 16 | The `GBL_VENDOR_MEDIA_DEVICE_PATH_GUID` GUID defined below. | 26 | Vendor Defined Data | 20 | 72 | Null-terminated ASCII partition name. | 27 28 ```c 29 // {a09773e3-0xf027-0x4f33-adb3-bd8dcf4b3854} 30 #define GBL_VENDOR_MEDIA_DEVICE_PATH_GUID \ 31 { \ 32 0xa09773e3, 0xf027, 0x4f33, { \ 33 0xad, 0xb3, 0xbd, 0x8d, 0xcf, 0x4b, 0x38, 0x54 \ 34 } \ 35 } 36 ``` 37 38 The partition will be identified using the null-terminated ASCII name from 39 the device path in the context of booting and fastboot. 40 41 422. UEFI GUID Partition Table (GPT) 43 44 For all other storage devices that doesn't have an instance of GBL 45 vendor-defined media device path, GBL considers them to be using the GPT 46 partition scheme defined in the UEFI spec. Each partition will be identified 47 using its corresponding GPT partition name in the context of booting and 48 fastboot. 49 50GBL fastboot implementation introduces a special syntax 51`<part>/<storage id>/<offset>/<size>` for specifying arbitrary subranges of a 52partition on one of the potentially multiple storage devices. Thus the 53partition name cannot contain character `'/'`. The name `gpt` is reserved for 54flashing GPT partition table and thus should not be used as partition name. 55See this [doc](./gbl_fastboot.md) for more details. 56