OnePlus 9 & 9 Pro (oneplus-lemonade & oneplus-lemonadep)

Contributors
robbbbbb, aissa, paweier

How to enter flash mode
TLDR:

1. Enable Developer Options: Settings -> About Phone -> Click on "Build number" 9 times 2. OEM unlocking: System -> Developer options -> Enable "OEM unlocking" 3. Unlock the bootloader: Unplug and turnoff the device -> Hold volume up&down with power simultaneously -> fastboot logo should appear 4. Finally: open terminal -> fastboot oem unlock

Non-TLDR: Unlocking and rooting the phone

Installation
BACKUP YOUR DEVICE FIRST especially (but not limited to) the dtbo, super, and boot partitions (Backing partitions with ADB).

You can try pulling original super.img to restore to Android later:

adb pull /dev/block/by-name/super super.img

Install and init pmbootstrap first (installation guide) sudo apt install python3-pip pip3 install pmbootstrap pmbootstrap init

(Optional) Clone the downstream codebase, and rebase with master:

cd /path/to/your/pmaports (for example: /home/administrator/.local/var/pmbootstrap/cache_git/pmaports) git remote add downstream https://gitlab.com/Robbbbbb/pmaports.git git fetch downstream && git checkout oneplus-lemonade git rebase master

(Optional) Update the checksums when the package is changed: pmbootstrap checksum linux-oneplus-lemonade

Compile the kernel for aarch64 and flash rootfs to the super partition:

pmbootstrap build device-oneplus-lemonade pmbootstrap install pmbootstrap flasher flash_rootfs pmbootstrap flasher flash_dtbo pmbootstrap flasher flash_kernel pmbootstrap flasher boot

SSH into the device (Full instructions): ssh user@172.16.42.1