Activities/Android/UpcyclingWorkshops/FlashingOnePlusPhones

Documentation for flashing OnePlus phones.

Flashing OnePlus Phones

Stock OS

Instructions of creating a factory image from an OxygenOS OTA package are taken from Create Fastboot-flashable Factory Image for Any OnePlus Phone.

postmarketOS

Following the instructions on OnePlus 6 (oneplus-enchilada) - postmarketOS.

Prerequisites

Computer with

1. Android SDK Platform-Tools installed

2. basic CLI utilties, i.e. curl, unzip, sha256sum, git

Stock OS

Additionally, python version >=3.6 needs to be installed

Obtain factory image

Stock OS

The operating system to be installed is proprietary software from OnePlus.

Download OxygenOS OTA package

From their download site: https://www.oneplus.com/de/support/softwareupgrade

1. OnePlus 6T

Install payload dumper tool

Download payload dumper:

   1     git clone https://github.com/vm03/payload_dumper.git

Create a virtual environment and install payload_dumper dependencies:

   1     python -m venv .venv
   2     source .venv/bin/activate
   3     pip install -r requirements.txt

Extract payload.bin using payload,,dumper,,

1. OnePlus 6T

postmarketOS

OnePlus 6T

From the download page: https://images.postmarketos.org/bpo/v22.06/oneplus-fajita/

Download boot image:

   1     curl -LO "https://images.postmarketos.org/bpo/v22.06/oneplus-fajita/phosh/20221019-0253/20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita-boot.img.xz"

Verify digest:

   1     curl -LO "https://images.postmarketos.org/bpo/v22.06/oneplus-fajita/phosh/20221019-0253/20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita-boot.img.xz.sha256"
   2     sha256sum -c "20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita-boot.img.xz.sha256"

And the system image:

   1     curl -LO "https://images.postmarketos.org/bpo/v22.06/oneplus-fajita/phosh/20221019-0253/20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita.img.xz"

Verify digest:

   1     curl -LO "https://images.postmarketos.org/bpo/v22.06/oneplus-fajita/phosh/20221019-0253/20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita.img.xz.sha256"
   2     sha256sum -c "20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita.img.xz.sha256"

Decompress images:

   1     unxz "20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita-boot.img.xz"
   2     unxz "20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita.img.xz"

Enable OEM unlocking

If not already unlocked, OEM unlocking must be enabled from within the OS.

For that, Developer options must be enabled:

SettingsAbout Phone → tap Build Number 7 times

Now, OEM unlocking can be enabled from within the Developer Options:

SettingsSystemAdvancedDeveloper OptionsOEM unlocking

Reboot into bootloader

OnePlus 6T

1. Unplug from USB and power off the phone.

2. Hold “Power” and both “Volume Up” and “Volume Down”.

Unlock bootloader

If necessary, unlock the bootloader:

   1     fastboot oem unlock

Needs to be confirmed on the device.

If the bootloader has been unlocked, the device needs to be rebooted into the bootloader, see section Reboot into bootloader

Flash factory image

Check if your device can be found:

   1     fastboot devices

Stock OS

Encountered problems flashing multiple partition images. The OnePlus 6T would display the OnePlus logo and “Fastboot Mode” underneath it and not be responsive anymore.

OnePlus 6T

Partitions to flash are in the output folder:

   1     ls -l

Flash partition images using fastboot:

   1     # fastboot flash abl abl.img
   2     # fastboot flash aop aop.img
   3     # fastboot flash bluetooth bluetooth.img
   4     fastboot flash boot boot.img
   5     # fastboot flash cmnlib cmnlib.img
   6     # fastboot flash cmnlib64 cmnlib64.img
   7     # fastboot flash devcfg devcfg.img
   8     # fastboot flash dsp dsp.img
   9     fastboot flash dtbo dtbo.img
  10     fastboot flash fw_4j1ed fw_4j1ed.img
  11     fastboot flash fw_4u1ea fw_4u1ea.img
  12     # fastboot flash hyp hyp.img
  13     # fastboot flash india india.img
  14     # fastboot flash keymaster keymaster.img
  15     fastboot flash LOGO LOGO.img
  16     fastboot flash modem modem.img
  17     fastboot flash oem_stanvbk oem_stanvbk.img
  18     # fastboot flash qupfw qupfw.img
  19     # fastboot flash reserve reserve.img
  20     # fastboot flash storsec storsec.img
  21     fastboot flash system system.img
  22     # fastboot flash tz tz.img
  23     fastboot flash vbmeta vbmeta.img
  24     fastboot flash vendor vendor.img
  25     # fastboot flash xbl xbl.img
  26     # fastboot flash xbl_config xbl_config.img
  27 

Partition images that couldn’t be flashed (“FAILED (remote: ‘Flashing is not allowed for Critical Partitions’)”) are commented out.

postmarketOS

OnePlus 6T

   1     fastboot erase dtbo
   2     fastboot flash boot "20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita-boot.img"
   3     fastboot flash userdata "20221019-0253-postmarketOS-v22.06-phosh-18-oneplus-fajita.img"

Reboot into the system by selecting the green “Start” menu option and selecting with “Power” button.

Login with the default username user and password 147147.

Lock bootloader

Bootloader needs to stay unlocked when postmarketOS is flashed, otherwise the device is not booting into the system anymore.

Execute:

   1     fastboot oem lock

Needs to be confirmed on the device.

Activities/Android/UpcyclingWorkshops/FlashingOnePlusPhones (last edited 2022-11-14 17:29:25 by maxsc)