|
|
||
|---|---|---|
| .. | ||
| testdata | ||
| Android.bp | ||
| Android.mk | ||
| README.md | ||
| boot_signature_info.sh | ||
| certify_bootimg.py | ||
| certify_bootimg_test.py | ||
| generate_gki_certificate.py | ||
| retrofit_gki.sh | ||
| retrofit_gki_test.sh | ||
README.md
GKI boot image retrofitting tools for upgrading devices
Starting from Android T the GKI boot images consist of the generic boot.img
and init_boot.img. The boot.img contains the generic kernel, and
init_boot.img contains the generic ramdisk.
For upgrading devices whose vendor_boot partition is non-existent, this tool
(or spec) can be used to retrofit a set of Android T GKI boot, init_boot and
OEM vendor_boot partition images back into a single boot image containing the
GKI kernel plus generic and vendor ramdisks.
Retrofitting the boot images
-
Download the certified GKI
boot.img. -
Go to the build artifacts page of
aosp_arm64onaosp-masterbranch on https://ci.android.com/ and downloadgki_retrofitting_tools.zip. -
Unzip and make sure the tool is in
${PATH}.unzip gki_retrofitting_tools.zip export PATH="$(pwd)/gki_retrofitting_tools:${PATH}" # See tool usage: retrofit_gki --help -
Create the retrofitted image. The
--versionargument lets you choose the boot image header version of the retrofitted boot image. Only version 2 is supported at the moment.retrofit_gki --boot boot.img --init_boot init_boot.img \ --vendor_boot vendor_boot.img --version 2 -o boot.retrofitted.img
Spec of the retrofitted images
- The SOURCE
boot.imgmust be officially certified Android T (or later) GKI. - The DEST retrofitted boot image must not set the security patch level in its
header. This is because the SOURCE images might have different SPL value, thus
making the boot header SPL of the retrofitted image ill-defined. The SPL value
must be defined by the chained vbmeta image of the
bootpartition. - The
boot signatureof the DEST image is theboot signatureof the DESTboot.img. - The DEST retrofitted boot image must pass the
vts_gki_compliance_testtestcase.
Retrofit to boot image V2
- The
kernelof the DEST image must be from the SOURCEboot.img. - The
ramdiskof the DEST image must be from the SOURCEvendor_boot.imgandinit_boot.img. The DESTramdiskis the ramdisk concatenation of the vendor ramdisk and generic ramdisk. - The
recovery dtbo / acpiomust be empty. - The
dtbof the DEST image must be from the SOURCEvendor_boot.img. - The
boot_signaturesection must be appended to the end of the boot image, and its size is zero-padded to 16KiB.
+---------------------+
| boot header | 1 page
+---------------------+
| kernel | n pages
+---------------------+
| * vendor ramdisk |
| +generic ramdisk | m pages
+---------------------+
| second stage | o pages
+---------------------+
| recovery dtbo/acpio | 0 byte
+---------------------+
| dtb | q pages
+---------------------+
| * boot signature | 16384 (16K) bytes
+---------------------+