From ed1310d24382ced22fc71f6f2d050966529ef4f1 Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Sun, 26 Feb 2023 22:38:32 -0500 Subject: [PATCH] README.md: Add section about extracting the entire OTA Signed-off-by: Andrew Gunnerson --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 25af20f..90a1616 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,7 @@ and flash the `clearotacerts/dist/clearotacerts-.zip` file in Magisk. T avbroot can replace the boot image with a prepatched image instead of applying the Magisk root patch itself. This is useful for using a boot image patched by the Magisk app or for KernelSU. To use a prepatched boot image, pass in `--prepatched ` instead of `--magisk `. When using `--prepatched`, avbroot will skip applying the Magisk root patch, but will still apply the OTA certificate patch. -For KernelSU, also pass in `--boot-partition @gki_kernel`. avbroot defaults to Magisk's semantics where the boot image containing the GKI ramdisk is needed, whereas KernelSU requires the boot image containing the GKI kernel. This only affects devices launching with Android 13, where the GKI kernel and ramdisk are in different partitions (`boot` vs. `init_boot`), but it is safe and recommended to always use this option for KernelSU. +For KernelSU, also pass in `--boot-partition @gki_kernel` for both the `patch` and `extract` commands. avbroot defaults to Magisk's semantics where the boot image containing the GKI ramdisk is needed, whereas KernelSU requires the boot image containing the GKI kernel. This only affects devices launching with Android 13, where the GKI kernel and ramdisk are in different partitions (`boot` vs. `init_boot`), but it is safe and recommended to always use this option for KernelSU. Note that avbroot will validate that the prepatched image is compatible with the original. If, for example, the header fields do not match or a boot image section is missing, then the patching process will abort. This check is not foolproof, but should help protect against accidental use of the wrong boot image. @@ -223,6 +223,18 @@ ValueError: vbmeta flags disable AVB: 0x3 To forcibly enable AVB (by clearing the flags), pass in `--clear-vbmeta-flags`. +### Extracting the entire OTA + +To extract all images contained within the OTA's `payload.bin`, run: + +```bash +python avbroot.py \ + extract \ + --input /path/to/ota.zip \ + --directory extracted \ + --all +``` + ## Implementation Details * avbroot relies on AOSP's avbtool and OTA utilities. These are collections of applications that aren't meant to be used as libraries, but avbroot shoehorns them in anyway. These tools are not called via CLI because avbroot requires more control over the operations being performed than what is provided via the CLI interfaces. This "integration" is incredibly hacky and will likely require changes whenever the submodules are updated to point to newer AOSP commits.