Flash Android Roms
By Fenguoerbian
March 16, 2025
Flash Android roms
Background about A/B-slot
For A/B-slot phones, there are actually TWO sets of system partitions (boot, system, …) on the devices, hence the name ‘A/B-slot’.
This is to reduce downtime and provide robustness when updating the system. When you’re booting up and using the system in slot-A (boot_a, system_a, …), the system update will be applied on slot-B (boot_b, system_b, …). And the phone will automatically boot from slot-B when you reboot the machine. This pattern has at least two advantages:
-
If the system update fails, you still have the working system in slot-A. Reboot the phone will still be using slot-A.
-
You will not experience the system update downtime those single-slot phones have to experience. When they do system update, they have to reboot the phone and wait for the update to finish (that android robot lying down image) and if the update fails the phone might end up in a bricked state. For A/B-slot phones, the system update is always applied on the non-using slot so the users do not have to experience this downtime.
O2OS / H2OS
Before flash any custom rom to the device. Make sure to update the stock OS to the latest version (Android 11, check the android version, not the vender version)
Oneplus provide a local update in system settings. If that don’t work, you can boot to TWRP recovery mode and flash the required zip file.
LineageOS (and Gapps)
Please follow the instructions at LineageOS’s website and here about Gapps.
Note: It’s recommended to use Lineage Recovery to install/update the LineageOS. If you want you can later flash the TWRP recovery.
Some key steps after getting into recovery mode to flash the LineageOS:
-
Format data, this is “Factory Reset, then Format data / factory reset” in Lineage Recovery and “Wipe, Format data” in TWRP recovery.
-
Return to the main menu, and sideload the LineageOS
.zip
file but DO NOT REBOOT yet!-
Using Lineage Recovery, on the device, select “Apply Update”, then “Apply from ADB” to begin sideload
Using TWRP recovery, on the device, select “Advance”, then “ADB sideload”
-
On the host machine (the computer), sideload the package using:
adb -d sideload lineageos_filename.zip.
Note: you might need
sudo
for this to run.Note: the image is being flashed to the slot you’re not using!
Also, in some cases, even if the process succeeds the output will stop at 47% and report adb: failed to read command: Success
-
If you want to install add-on apps, such as GApps, REBOOT to RECOVERY, not LineageOS!
Note:
adb -d sideload
command will check the type ofzip
file. If it is system image, then flash to THE OTHER slot. If it is apps, then flash to the CURRENT slot. That’s why we have to reboot to recovery before flashing the GApps package.Note: GApps have to be installed before LineageOS’s first boot. So here we REBOOT to RECOVERY so that the working slot is being switched, but the android will not be booted. Please read the first section in this post to learn more about A/B-slot phones.
-
-
Skip this step if you don’t intend to install add-on apps (such as Gapps):
-
side load ADB again with
adb -d sideload addon_filename.zip
-
-
If you want you can flash back TWRP recovery later for its functionalily (e.g. to support postmarket OS dual boot? Actually Lineage recovery also supports this.)