Update My Oneplus 7pro to LineageOS 22.1

2025-04-04
Forward links: related:Android under:Blog Backward links:

Sometimes I'm surprised by my own laziness. For example, my phone, which is Oneplus 7 Pro, has been stalled in the last update of LineageOS 17 since 2021. Below is how I updated it to the latest official LineageOS at the time of writing.

Backup my files

This is the most important step for any potentially critical change. Since all my Apps are FOSS and I don't really care about keeping their internal data, I simply use syncthing to back up my TODO notes, photos and other several files to my computer.

Update firmware

We need Android 12 firmware to use the latest LineageOS. This step is described in the wiki.

First download the OTA update from XDA. For example, I'm using GM1910, so I download from GM21AA build variant. Note that GM1917_11_H.41 is Android 12 despite the name.

Then, unzip the downloaded zip, and one of the file is named payload.bin. We need payload-dumper-go to extract out the things we need. If we use Arch (btw), it's on AUR. Anyway, after installing this tool, simply

payload-dumper-go payload.bin

Extracted things are under the directory extracted_SOMEDATE_SOMETIME, under the directory we invoke the above command.

Note that for the following steps, we have to be in fastbootd mode (not simply fastboot!), otherwise we'll get error like

fastboot flash --slot all abl abl.img
# fastboot: error: Could not check if partition abl has slot all
fastboot flash abl abl.img
# Sending 'abl' (220 KB)                             OKAY [  0.019s]
# Writing 'abl'                                      FAILED (remote: 'Flashing is not allowed for Critical Partitions
# ')
# fastboot: error: Command failed

The way entering it is by first go to fastboot mode, then

fastboot reboot fastboot

If anything failed, we can try to install LineageOS's Recovery by following this and this. For example my phone boot back into the system, and installing LOS's Recovery fixed it for me. It seems that some recoveries simply does not have fastbootd mode. At the time of writing, this is just

fastboot flash dtbo dtbo.img
fastboot flash vbmeta vbmeta.img
fastboot flash boot boot.img

Now that fastbootd is working, simply

fastboot flash --slot=all abl abl.img
fastboot flash --slot=all aop aop.img
fastboot flash --slot=all bluetooth bluetooth.img
fastboot flash --slot=all cmnlib64 cmnlib64.img
fastboot flash --slot=all cmnlib cmnlib.img
fastboot flash --slot=all devcfg devcfg.img
fastboot flash --slot=all dsp dsp.img
fastboot flash --slot=all hyp hyp.img
fastboot flash --slot=all keymaster keymaster.img
fastboot flash --slot=all LOGO LOGO.img
fastboot flash --slot=all modem modem.img
fastboot flash --slot=all oem_stanvbk oem_stanvbk.img
fastboot flash --slot=all qupfw qupfw.img
fastboot flash --slot=all storsec storsec.img
fastboot flash --slot=all tz tz.img
fastboot flash --slot=all xbl_config xbl_config.img
fastboot flash --slot=all xbl xbl.img

Then reboot to Bootloader.

Install Recovery (Again)

After update the firmware, I believe that I need to install the LOS recovery again. Same as before, simply follow this and this.

fastboot flash dtbo dtbo.img
fastboot flash vbmeta vbmeta.img
fastboot flash boot boot.img

Now select "Recovery Mode" with volume keys and the power key.

Install LineageOS from Recovery

Finally the main part.

We are already in the Recovery, so perform Factory Reset as the guide says. Note that after the reset we have to go to the main menu ourselves (by pressing volume keys and the power key to select the back arrow at the top). This is not a bug so no worries.

Finally, select "Apply Update", "Apply from ADB". When being in this "ADB Sideload" page,

adb -d sideload lineage-22.1-*-nightly-guacamole-signed.zip

My ADB progress on computer stoped at 47%, but it does not fail as the TIP shows. On the phone, the Recovery went to Add-On Installation page, so I'd assume that I succeeded.

I don't need add-ons as I'm not using Google (and are there any other add-ons now? IIRC there used to be ROOT add-on), so I simply picked "no" on the add-on page. When I did this, the ADB log on my computer prints "Total Xfer: 1.00x" and quit with 0. Good!

Finally reboot to the new system. After around 2 minutes, I'm in LOS 22.1.

Reference