Skip to content

Commit

Permalink
README.md: Use fastboot flashall to flash partitions initially
Browse files Browse the repository at this point in the history
`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 <[email protected]>
  • Loading branch information
chenxiaolong committed Jan 16, 2024
1 parent 275b18b commit a9acbf7
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <partition> extracted/<partition>.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:

Expand All @@ -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

Expand Down

0 comments on commit a9acbf7

Please sign in to comment.