From a9acbf78ef33d01d36cedc36164cbe039732c269 Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Tue, 16 Jan 2024 00:17:09 -0500 Subject: [PATCH] README.md: Use fastboot flashall to flash partitions initially `fastboot flashall` is identical to the `fastboot update` command used by the Pixel factory images, except it reads from a directory instead of a zip file. It knows how to flip between the fastboot and fastbootd modes without user intervention. This is a bit slower than the old method of only flashing the partition images that were modified, but is much less accident-prone and is a well supported and tested feature of fastboot. Fixes: #252 Signed-off-by: Andrew Gunnerson --- README.md | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 8c910b8..d4f4976 100644 --- a/README.md +++ b/README.md @@ -132,37 +132,29 @@ If you lose your AVB or OTA signing key, you will no longer be able to sign new 1. Reboot into fastboot mode and unlock the bootloader if it isn't already unlocked. This will trigger a data wipe. -2. When setting things up for the first time, the device must already be running the correct OS. Flash the original unpatched OTA if needed. - -3. Extract the partition images from the patched OTA that are different from the original. +2. Extract all the partition images from the patched OTA. ```bash avbroot ota extract \ --input /path/to/ota.zip.patched \ - --directory extracted + --directory extracted \ + --all ``` -4. Flash the partition images that were extracted. - - This can be done by manually running `fastboot flash extracted/.img` for each image in the `extracted/` directory or by using the following script: +3. Flash the partition images that were extracted. ```bash - for image in extracted/*.img; do - partition=$(basename "${image}") - partition=${partition%.img} - - fastboot flash "${partition}" "${image}" - done + ANDROID_PRODUCT_OUT=extracted fastboot flashall ``` -5. Set up the custom AVB public key in the bootloader. +4. Set up the custom AVB public key in the bootloader. ```bash fastboot erase avb_custom_key fastboot flash avb_custom_key /path/to/avb_pkmd.bin ``` -6. **[Optional]** Before locking the bootloader, reboot into Android once to confirm that everything is properly signed. +5. **[Optional]** Before locking the bootloader, reboot into Android once to confirm that everything is properly signed. Install the Magisk or KernelSU app and run the following command: @@ -176,13 +168,13 @@ If you lose your AVB or OTA signing key, you will no longer be able to sign new init: [libfs_avb]Returning avb_handle with status: Success ``` -7. Reboot back into fastboot and lock the bootloader. This will trigger a data wipe again. +6. Reboot back into fastboot and lock the bootloader. This will trigger a data wipe again. Remember: **Do not uncheck `OEM unlocking`!** **WARNING**: If you are flashing CalyxOS, the setup wizard will [automatically turn off the `OEM unlocking` switch](https://github.com/CalyxOS/platform_packages_apps_SetupWizard/blob/7d2df25cedcbff83ddb608e628f9d97b38259c26/src/org/lineageos/setupwizard/SetupWizardApp.java#L135-L140). Make sure to manually reenable it again from Android's developer settings. Consider using the [`OEMUnlockOnBoot` module](https://github.com/chenxiaolong/OEMUnlockOnBoot) to automatically ensure OEM unlocking is enabled on every boot. -8. That's it! To install future OS, Magisk, or KernelSU updates, see the [next section](#updates). +7. That's it! To install future OS, Magisk, or KernelSU updates, see the [next section](#updates). ## Updates