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