• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Buffer Usage in GBL
2
3This doc discusses how GBL (EFI bootloader) gets and uses buffers for various
4functionalities.
5
6## OS Load Buffer
7
8GBL needs a sufficiently large and contiguous buffer for loading, fixing up and
9assembling various OS images such as boot, init_boot, vendor_boot, dtb, dtbo,
10misc etc. This buffer can either be from EFI memory allocation or memory space
11reserved by the platform. At run time, GBL performs the following for
12requesting an OS load buffer.
13
141. Via
15[GBL_EFI_IMAGE_LOADING_PROTOCOL.GetBuffer()](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md#gbl_efi_image_loading_protocolgetbuffer)
16
17   If [GBL_EFI_IMAGE_LOADING_PROTOCOL](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md) is
18   implemented, GBL will make a call to
19   `GBL_EFI_IMAGE_LOADING_PROTOCOL.GetBuffer()` with input image type set to
20   [GBL_IMAGE_TYPE_OS_LOAD](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md#related-definitions-1)
21   and input size set to 0 (size determined by vendor). Vendor returns the size
22   and address of the reserved memory if available or instructs GBL to
23   allocates a specific amount of memory via EFI memory allocation.
24
252. Via EFI Memory Allocation
26
27   If [GBL_EFI_IMAGE_LOADING_PROTOCOL](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md) is
28   not implemented GBL allocates a 256MB size buffer via EFI memory allocation.
29
30## Fastboot Download Buffer
31
32When booting to fastboot mode, GBL requires a buffer for download. The buffer
33is requested following the same process as the case of
34[OS Load Buffer](#os-load-buffer):
35
361. Via
37[GBL_EFI_IMAGE_LOADING_PROTOCOL.GetBuffer()](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md#gbl_efi_image_loading_protocolgetbuffer)
38
39   If [GBL_EFI_IMAGE_LOADING_PROTOCOL](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md) is
40   implemented, GBL will make a call to
41   `GBL_EFI_IMAGE_LOADING_PROTOCOL.GetBuffer()` with input image type set to
42   [GBL_IMAGE_TYPE_FASTBOOT](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md#related-definitions-1)
43   and input size set to 0 (size determined by vendor). Vendor returns the size
44   and address of the reserved memory if available or instructs GBL to
45   allocates a specific amount of memory via EFI memory allocation.
46
472. Via EFI Memory Allocation
48
49   If [GBL_EFI_IMAGE_LOADING_PROTOCOL](./GBL_EFI_IMAGE_LOADING_PROTOCOL.md) is
50   not implemented GBL allocates a 512MB size buffer via EFI memory allocation.
51
52## AARCH64 Kernel Decopmression
53
54GBL can detect and handle compressed kernel for aarch64. However, current
55implementation requires allocating a separate piece of memory for storing
56decompressed kernel temporarily. This buffer is allocated via EFI memory
57allocation.
58
59## AVB
60
61The AVB (Android Verified Boot) implementation in GBL requires allocating
62additional memory for constructing commandline argument strings and loading
63vbmeta images from disk and any other vendor required partitions for
64verification. The memory is allocated via EFI memory allocation.
65