Disclaimer: By attempting ant of the processes listed below, you accept full responsibility for your actions. I will not be held responsible if your device stops working, catches fire, or turns into a hipster and claims to have been modified before it is cool. Make sure you read the whole article and fully understand it BEFORE attempting it.
If you are experienced in unlocking & flashing recovery & rooting, here are the resources you need.
Things you should download:
TWRP Recovery for OnePlus 3, OnePlus 3T, OnePlus 5 (Choose the correct one for your model)
SuperSU flashable ZIP (Same across all phones)
DM Verity and Forced Encryption Disabler (Same across all phones)
Let's start from scratch.
1. Unlock Bootloader (Skip if unlocked already)
First make sure you have installed
fastboot on your PC (or Mac). Ensure that your phone has at least 60% battery remaining, and that your PC is plugged in and won't shut down spontaneously during the process. The procedure doesn't take very long , but itâ€˜s best to have enough charge in case something goes wrong.
Backup (Optional): Unlocking the bootloader will completely wipe all data from the device. This includes apps, settings and even the contents of the internal sdcard (pictures, music, etc.). Copy all important files off the phone onto a PC or upload them to a cloud.
USB Debugging: On your phone go to Settings > About phone > Tap on Build number 7 times. This will enable Developer options. Now go back to Settings > Developer options > Enable USB debugging
Enable OEM Unlocking: On your phone go to Settings > Developer options. Then enable the OEM Unlocking option. Also,a free advice, make sure that from now on, OEM unlocking option is enabled before you reboot. Because sometimes it might get disabled itself. Yeah that's weird so be careful.
Enable Advanced Reboot: On your phone go to Settings > Developer options. Then enable the Advanced Reboot option.
Turn the phone off. Then boot it into fastboot mode by holding volume up + power or select reboot to bootloader if advanced reboot is activated via developer options. The phone will display "fastboot" text indicating that it has successfully entered fastboot mode.
Warning: By proceeding this step, you will lose ALL data on your phone, including apps, games, musics, photos and everything else! Make proper backup before proceeding. Your warranty may also void, depending on your local law restriction and EULA.
Plug the phone into your PC, then open a command prompt (or a terminal on Mac/Linux) and run
fastboot oem unlock
You would be greeted with a Unlock Bootloader Warning page, Hit the Vol button to select Yes and turn it Blue and Hit the Power Button to Execute the selection
Your device will reboot, showing you a Secure Boot Warning. Reboot into stock recovery and wipe all data. Once done, your phone will reboot into the OS. Continue to the next step to install Custom Recovery.
2. Install TWRP
Download TWRP (
.img) and SuperSU (
.zip) from the top of this article if you haven't had them yet. Place them on the phone internal memory or a USB stick as per convenience.
Enable USB debugging, OEM Unlocking and Advanced Reboot again as instructed in Section 1.
Reboot to fastboot mode again. Grab the command prompt and enter (replace
your-recovery.img with the actual file name of the image you downloaded)
fastboot flash recovery your-recovery.img
Hit enter and wait for completion, then boot into recovery. Do not use
fastboot reboot because it will boot into OS instead of recovery. Use volume keys instead.
You will reach the screen asking you if you want to allow system modifications.
By swiping right, you will trigger DM-Verity, and if you don't follow the next step you will be unable to boot!
If you are going to root your device and follow the rest of these steps, then it's safe to swipe right and enable modifications.
Select your preferred language, tap â€œNever show this screen on boot again,â€ and swipe to allow modification.
PS: Flash DM Verity and format data only if you want to stay unencrypted, else you may just skip and continue with flashing SuperSU.
Without leaving TWRP, transfer the
no-verity-opt-encrypt zip to your device over MTP and flash it or select it from internal as placed before, or use a USB stick (via OTG) and flash it (This will also allow you to use Format Data to completely disable your encryption if desired).
Go to â€œWipeâ€ section and tap â€œFormat Dataâ€, and type â€œyesâ€ (If you want to mount internal storage).
Navigate to Install ZIP and select the SuperSU zip file to root OnePlus 5.
Swipe to install SuperSU and reboot your device.
Bueno! Congratulations! Your OnePlus 5 now has an unlocked bootloader, has a custom recovery installed and is rooted. Enjoy!!
Credits: This post is mostly copied from the original post on XDA Developers Forum. I changed a few details so that it fits better on Android Enthusiasts Stack Exchange. Thanks to the original author (Funk Wizard on XDA)!
Original post: OnePlus 5: Unlock Bootloader | Flash TWRP | Root | Nandroid & EFS Backup & More !!