Background and Preparation
By Fenguoerbian
March 16, 2025
This post is for some background knowledge and preparation for tinkering my OnePlus 6.
In the end, my OnePlus 6 would be dual-booting both Android 15 (LineageOS 22 on slot A) and PostmarketOS (on slot B).
Preparation
On the computer
You will need a computer with fastboot tools(SDK platform tools). This can be
obtained by installing the android-tools
package on Linux or by installing the
Android SDK Platform-Tools on Windows, Mac (or Linux).
On the phone
-
Boot to LATEST stock system (Andoid 11) on BOTH slots.
Note: OnePlus 6 is a ab-slot phone. You have to use the custom recovery mentioned later to manually change slot and update Android on each slot to the latest version. This is to guarantee that you have the latest firmware, which is packed in the stock OS in BOTH slots.
-
Learn how to enter flash mode/fastboot with key combo (or
adb
command)flash mode
/fastboot
on the phone will be used multiple times in later procedures. This mode has some quick access, like entering usual system, entering recovery mode, and run some commands etc. For OnePlus 6, there’s multiple ways to enter this mode:-
Key combo for Oneplus 6: Unplug from USB and hold
Power
andVolume Up
until you see a screen showing the word START and information about the device. -
Or the adb command
adb reboot bootloader
-
Or (on phones with OxygenOS or HydrogenOS) enable the
advanced reboot
option in the later section so that you can directly reboot tofastboot
mode or recovery mode instead of using the key combo.
-
-
Unlock bootloader
The bootloader needs to be unlocked so that different OS (be it Android ROMs or Linux such as PostmarketOS) can be installed on the phone. Because of this, the phone will state that the system might not be safe and some Android integrity checks (e.g. from Google Play service) might fail since they can not verify that your phone is at verified factory state.
To unlock your bootloader. For the T-Mobile version of the device in the US, refer to Google for guides on obtaining an unlock code. If your device is not carrier locked, the following is all that’s needed to unlock the bootloader:
-
Open Settings, go to “About” and tap on the “Build number” box ~10 times until the “You are now a developer” toast message appears.
-
Go back to the main settings page, go to “System” and then “Developer options” (it might be hidden behind a dropdown menu). Toggle the switch to “Enable OEM unlocking”.
-
Enable
Advanced reboot
at the same page, so that you can long-press power bottom and selectfastboot/bootloader
mode or recovery mode instead of using the key combo. -
Refer to “How to enter flash mode” above to get into fastboot mode, then re-attach your USB cable. Run the following command on your host:
fastboot devices # checking the device linked to your computer fastboot oem unlock # unlock bootloader
If you see < waiting for any device >, try running as
sudo
and restart your device into fastboot mode again by selecting “Restart Bootloader” on the device. -
Read the message displayed on your device screen. Once read, confirm the unlock if you’re willing to proceed. THIS WILL ERASE YOUR DEVICE’S INTERNAL STORAGE.
All done! You can now continue with this guide.
-
-
Install a custom recovery (after unlocking the bootloader)
-
TWRP recovery: this is a very popular recovery because it packs a lot of functionality. But its update pace is quite slow recently so it might not support recent Android. For me, it does not support installing LineageOS 22, which is Android 15, but does support OnePlus 6’s factory images, which are based on Android 11 at most.
-
Download the latest TWRP image file(.img) from the website.
-
Put the TWRP image to the root folder of the phone’s internal storage. For simplicity, you can rename it to
twrp.img
. -
Enter the flash mode (refer to previous notes) and connect to your computer via USB
-
Temporary boot the downloaded image using the following command:
fastboot boot twrp.img
Preferred Installation Method: Once booted, navigate to the Advanced > Flash Current TWRP option. This will install the TWRP image you just booted permanently to the device.
NOTE: You also need to use the “Fix Recovery Bootloop” option present in the same Advanced Tab. Use that option after you have installed the recovery ramdisk successfully to avoid boot loops happening from installing TWRP Permanently.
-
-
LineageOS recovery: this is a recovery recommended by Lineage community for installing LineageOS. It is simple, and packs only essential functionalities.
The instruction for LineageOS recovery on OnePlus 6 is here. In summary, the steps are:
-
Download the lates recovery, rename it to
boot.img
. -
Enter fastboot on your phone, and connect it to your computer. Use the following command to check the phone has been identified by the computer.
fastboot devices
-
Flash the recovery with fastboot commands from the computer:
fastboot flash boot boot.img
Note: Here
boot.img
is being flashed toboot
without any_a
/’_b’ indication, which means it should be flashed to BOTH theboot_a
andboot_b
partitions. -
Reboot to recovery to verify the installation.
-
-
-
Install Magisk:
To be added. I do not install
Magisk
on my phone.Note: seems like magisk can also detect/unpack/extract from a full stock image file to get the boot.img file that it needs to patch.