Vendor Boot Partitions

Android 11 introduces the concept of the Generic Kernel Image (GKI). To enable easily booting an arbitrary device with a GKI, all vendor-specific information is factored out of the boot partition and relocated into a new vendor boot partition. An ARM64 device launching with Android 11 on the 5.4 Linux kernel must support the vendor boot partition and the updated boot partition format to pass testing with the GKI.

Partition structure

The vendor boot partition is A/B’d with virtual A/B and protected by Android Verified Boot. The partition consists of a header, the vendor ramdisk, and the device tree blob (DTB).

Section Number of pages
Vendor boot header (n pages) n = (2108 + page_size - 1) / page_size
Vendor ramdisk (o pages) o = (vendor_ramdisk_size + page_size - 1) / page_size
DTB (p pages) p = (dtb_size + page_size - 1) / page_size

For details on the vendor ramdisk and the handling of kernel modules, see Kernel Module Support.

Vendor boot header

The contents of the vendor boot partition header consist primarily of data that’s been relocated there from the boot image header. It also contains information about the vendor ramdisk.

struct vendor_boot_img_hdr
    uint8_t magic[VENDOR_BOOT_MAGIC_SIZE];
    uint32_t header_version;
    uint32_t page_size;           /* flash page size we assume */

    uint32_t kernel_addr;         /* physical load addr */
    uint32_t ramdisk_addr;        /* physical load addr */

    uint32_t vendor_ramdisk_size; /* size in bytes */

    uint8_t cmdline[VENDOR_BOOT_ARGS_SIZE];

    uint32_t tags_addr;           /* physical addr for kernel tags */

    uint8_t name[VENDOR_BOOT_NAME_SIZE]; /* asciiz product name */
    uint32_t header_size;         /* size of vendor boot image header in
                                   * bytes */
    uint32_t dtb_size;            /* size of dtb image */
    uint64_t dtb_addr;            /* physical load address */


Bootloader support

Because the vendor boot partition contains information (such as flash page size, kernel, ramdisk load addresses, the DTB itself) that previously existed in the boot partition, the bootloader must access both the boot and vendor boot partitions to have enough data to complete booting.

The bootloader must load the generic ramdisk into memory immediately following the vendor ramdisk (the CPIO, Gzip, and lz4 formats support this type of concatenation). Do not page align the generic ramdisk image or introduce any other space between it and the end of the vendor ramdisk in memory. After the kernel decompresses, it extracts the concatenated file into an initramfs, which results in a file structure that's a generic ramdisk overlaid on the vendor ramdisk file structure.

Because the generic ramdisk and vendor ramdisk get concatenated, they must be in the same format. The GKI boot image uses an lz4-compressed generic ramdisk, so a device that is GKI compliant must use an lz4-compressed vendor ramdisk. The configuration for this is shown below.

Build support

To implement vendor boot support for a device:


  • Set BOARD_RAMDISK_USE_LZ4 to true if your device is GKI compliant, or if it otherwise uses an lz4-compressed generic ramdisk.

  • Set BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE to an appropriate size for your device, considering the kernel modules that must go on the vendor ramdisk.

  • Update AB_OTA_PARTITIONS to include vendor_boot and any vendor-specific lists of OTA partitions on the device.

  • Copy your device fstab into /first_stage_ramdisk in the vendor_boot partition rather than the boot partition. For example, $(LOCAL_PATH)/fstab.hardware:$(TARGET_COPY_OUT_VENDOR_RAMDISK)/first_stage_ramdisk/fstab.$(PRODUCT_PLATFORM).