281
Guide [Full Guide] Setting drivers up, unlocking bootloader, flashing recovery, roms, kernels & rooting

  1. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :
    This thread won't be updated anymore (Still working just fine as of December 22nd 2015) and I won't be checking the comments anymore. I'm busy in real life and answering the same questions over and over is getting boring. Go read through the last few pages and chances are that you'll find what you're looking for.

    For Windows 7, 8 and 10 .


    FOR THE ONEPLUS ONE ONLY!

    The goal of this guide is to cover everything from start to finish and going from having absolutely nothing installed on your computer and phone to having everything installed on your computer and phone in the shortest most no bull**** way possible.

    Note: I am not responsible if you fail to follow instructions and brick your device. Don't attempt to do this if you tend to skip lines or start at step 8 instead of step 1.

    Index:
    The Good:

    0. Installing proper fastboot and adb drivers.
    1. Backing up your Apps, App data & Internal Storage.
    2. Unlocking the bootloader.
    3. Flashing a custom recovery.
    4. Making important backups.
    5. Flashing a ROM.
    6. Flashing a Kernel.
    7. Rooting
    The Bad:
    1. Recovering from no OS installed and no ROM or Backup present on the phone.
    2. Recovering from no OS installed and no access to TWRP, fastboot does work.

    3. Recovering from no OS installed and no access to fastboot, TWRP does work.
    The Ugly:
    1. Recovering from no OS Installed, no fastboot, no TWRP, black screen and no signs of life.
    (yes, it's possible to recover from this, most of the time.)
    How to maintain your device after rooting/flashing:
    1. Custom kernels, root and OTA updates.
    2. Switching from one ROM to another or completely wiping your device clean without losing data. (Titanium Backup tutorial)
    3. Keeping your ROM running smoothly, and what to do after rooting.
     
    Last edited: Dec 22, 2015

    #1
  2. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :
    Lets begin.

    Remove encryption from your phone before proceeding if your bootloader is already unlocked. Otherwise you can ignore this.

    Make sure your phone is unplugged from your computer, I will tell you when to plug it in.

    0. Installing proper fastboot and adb drivers.
    Things you'll need to download:
    15 second adb/fastboot installer
    Android SDK Slim Thank you @GotItBro for pointing this out to me; Android SDK Slim is not necessary if you use the 15 second adb/fastboot installer to install your drivers. It automatically places a fastboot/adb folder on your C drive (C:\adb).

    Use this to remove any existing android drivers that may cause you problems. http://www.nirsoft.net/utils/usb_devices_view.html

    Download version 1.4.2 of the adb/fastboot installer and run it, press Y and enter when it prompts you and then continue with the driver installation.

    Whenever you need to use a command window you go into the C:\adb\ folder and right click an empty place inside that folder while holding Shift like demonstrated here:

    [​IMG]

    Pick your phone up and go to Settings > About Phone and tap on Build Number 7 million times until you've enabled Developer Options, then go back to the main settings menu and go to Developer Options that magically appeared right above About Phone.

    Enable Android Debugging / USB Debugging and plug your phone into the computer via USB. If you're lucky Windows will know what you just plugged in and install the drivers automatically, if you're not lucky Windows will be clueless and A- do nothing, or B- Install the wrong drivers from another phone that you may own/have owned

    Open Device Manager and look for your phone (which should currently be turned on like normal), it will show up under Portable Devices as A0001 but since we've enabled the debugging it should also show up under Other Devices as One, A0001, ADB Interface or Android.

    Before you go uninstalling the wrong driver in fastboot mode, try if it works. Fastboot usually isn't picky with which driver you're using. Type fastboot devices to test if it works. It should return your serial number.

    Scenario A-
    Okay now I realize that these gifs go really fast but if you stare at them for a while you'll see.

    [​IMG]
    [​IMG]
    Scenario B-
    After you uninstall the driver from your system you unplug your phone and plug it back in - then go back to Scenario A-

    [​IMG]

    ADB Drivers are now properly installed, you may need to repeat this process once you boot your phone into TWRP later in this guide, don't worry about it for now.

    Unplug your phone and put it in Fastboot mode by turning it off and then turning it back on by holding Power + Volume UP, you will see Fastboot Mode on your screen. Now plug your phone back into your computer and repeat the process above except now you install the Android Bootloader Interface, and not the Android ADB Interface.

    If you've done this all correctly your phone will show up as;
    Android ADB Interface while it's turned on normally
    Android Bootloader Interface while it's in Fastboot mode

    1. Backing up some of your stuff.

    I previously had Helium in this part of the guide, but Helium only works on KitKat, currently there is no way to back app data up without root. Use http://www.sync-droid.com/ to back call logs, sms, contacts, photos, videos, etc up.

    2. Unlocking the bootloader.
    Unplug your phone and put it in Fastboot mode by turning it off and then turning it back on by holding Power + Volume UP, you will see Fastboot Mode on your screen. Now plug your phone back into your computer and open a command window in your fastboot/adb folder (C:\adb\)

    type fastboot devices to verify that you have a working connection with your phone and then type fastboot oem unlock to unlock your bootloader
    This will delete all the data off your phone and perform a complete factory reset.

    When your phone restarts just go ahead and put it in fastboot mode again to verify that it was properly unlocked by typing fastboot oem device-info and making sure it says 'unlocked: true'

    You can now reboot your phone with the fastboot reboot command.

    Important note: re-locking your bootloader can cause serious problems, don't ever re-lock your bootloader without contacting me first. I've warned you.
     
    Last edited: Jul 14, 2015

    #2
    dalfaand, bhenne, bord and 147 others like this.
  3. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :
    3. Flashing a custom recovery.
    Things you'll have to download:
    The latest TWRP image
    Make sure you download the latest version, which is currently 2.8.7.0.

    Plug your phone in, at this point I am assuming you have your adb and fastboot drivers set up properly so I am going to stop telling you to unplug your phone and plug it back in, we will reboot it using adb and fastboot commands from now on.

    If your phone is in fastboot mode type fastboot reboot to reboot it, once it's booted up tap Build Number 7 times in About Phone and go to Developer Options to disable Update Cyanogen Recovery. Make sure this box is unticked and type adb reboot bootloader to reboot into fastboot mode.

    Once you are in fastboot mode type fastboot flash recovery and press spacebar, then drag the twrp_2.x.x.x.img into the command window, press enter to flash.


    Now enter your recovery by typing fastboot boot and press spacebar, then drag the twrp_2.x.x.x.img into the same command window right after flashing. Once you're in TWRP check Device Manager to see if your computer properly recognizes your phone. It should show up as Android ADB Interface or Android Composite ADB Interface. If it does, move onto the next part of this guide, if it doesn't, repeat part 0 (installing drivers) while your phone is in TWRP.

    4. Making important backups.

    Boot your phone into TWRP if it isn't already and tap on Backup, select Boot, System and Data, then Swipe to backup. Wait until it's done and tap Reboot System.

    There is now a roughly 2-3GB backup folder on your phone in the TWRP folder, you should always keep one of these either on your phone if you can afford losing the space or copy it to your computer to restore if anything ever goes wrong. This backup contains your ROM, Apps, App Data and Kernel. It does not include internal storage (pictures, videos, music, downloads etc) because the backup would simply become way too big, back your internal storage up by just connecting your phone to your computer and dragging the folders from your phone to your computer whenever you feel necessary.


    Thank you @bombadier for making this flashable backup script! You can flash this zip in TWRP and it will make the EFS backup automatically. If you use this script you can skip the part below.


    For the next part you will need root access, so if you don't have that yet you can go ahead and skip to part 7 of this guide, 'Rooting', and come back here once you've successfully rooted your ROM.

    This part is basically just part 10 of @timmaaa's guide rewritten.

    What you'll need to download:
    A Terminal App

    Open the app, type su and press enter, you'll be prompted with a SuperSU window asking you to grant the terminal app root access, press on Grant.

    Type (or copy/paste) these 2 commands into the terminal.
    dd if=/dev/block/mmcblk0p10 of=/sdcard/modemst1.bin bs=512 press enter
    &
    dd if=/dev/block/mmcblk0p11 of=/sdcard/modemst2.bin bs=512 press enter.

    If you did this correctly you will now have 2 files on your phone's internal storage called modemst1.bin and modemst2.bin, copy them to your computer and to the cloud and another cloud and a usb stick that you hide in your bum at all times. Do not lose these files.

    Note: it sometimes takes a while before these files show up in Windows Explorer, you can use a file manager on your phone to upload these files to your preferred cloud storage.

    If you ever end up with a missing or corrupted EFS partition you can restore it by flashing these 2 files in fastboot with the following commands;
    fastboot flash modemst1 modemst1.bin
    &
    fastboot flash modemst2 modemst2.bin

    If this ever saves you please thank timmaaa.

    5. Flashing a ROM. (optional)

    Okay, now that you've made all the necessary backups you can start playing with your phone. You have backups, but that does not mean you can be careless, there are serious risks you take when you do things or flash things without knowing what they are or do. Always do your research, always make backups, and always be careful.

    Important note: Never wipe your Internal Storage unless you know what that means and does.

    What you'll need to download:
    A flashable zip of your choice. (For this guide I'll be using CM12 nightlies as an example but this will work for almost every ROM out there unless specified otherwise in the ROM's installing instructions.)
    A GApps package of your choice, I recommend PA GApps (5.0.x & 5.1)

    Note 1: Official ROMs like CM11S, COS12 and OxygenOS come with GApps pre-installed and you don't have to flash a GApps package in that case.
    Here is where you should download the official ROMs from, this is a reliable source.

    Note 2: For some weird reason the OxygenOS zip file that you download from Oneplus is not flashable, they decided it would be a good idea to put a zip file inside of a zip file. Make sure you pull the flashable zip and the md5 file out of the zip you downloaded before proceeding.

    Note 3: If the ROM you're downloading provides an md5 file you should download it, or if it provides an md5 checksum like the CM12 nightlies do (look under the download link: "md5sum: a90a7fffb09d9758f69842f85f325fee") you should visit the place you downloaded your ROM from on your phone and copy the md5sum.

    Once you've downloaded your ROM and the md5 file you copy them them to your phone and download MD5 Checker from the Play Store. Open the app, load your ROM in the 1st slot and load the md5 file in the second slot. If the ROM you chose provided an md5sum instead you paste it in the second slot. Both lines should turn green, if they don't that means you have a corrupt zip file and you should re-download your ROM.

    When you've verified the integrity of the zip you downloaded and are ready to flash it. Here is the procedure;

    1. Boot your phone into TWRP
    2. Make a backup just in case, you can delete it when your device has booted successfully with the new ROM.
    3. Go to Wipe > Advanced Wipe and select Dalvik Cache, System, Data and Cache > Swipe to wipe. Be very careful that you do not select Internal Storage.
    4. Go back to the main menu of TWRP.
    5. Go to Install and find the zip files you downloaded.
    6. Select the ROM.zip > Add more zips > GApps.zip > Swipe to flash.
    7. Wait for the flash to finish and press Wipe Cache & Dalvik.
    8. Press Back and press Reboot System.

    A- It booted successfully, woohoo! You can delete the backup you made now.

    B- If It's been 10 minutes and it's still on the boot animation. Go back into TWRP and restore your backup, then check what you did wrong and try again.

    6. Flashing a Kernel. (optional)

    Things you'll need to download:
    A kernel of your choice. Franco.Kernel - Tyr Kernel - AK Kernel - Boeffla Kernel are a few good examples.


    Flashing a custom kernel is really really simple.

    1. Make absolutely 110% sure that you're downloading the correct version.
    2. Boot into TWRP
    3. Backup the Boot partition (Boot = Kernel) in case you want to go back to the stock kernel or if the kernel you flashed doesn't work.
    4. Flash kernel.zip
    5. Wipe Cache & Dalvik
    6. Reboot

    Note that you'll have to re-flash your custom kernel every time you update your ROM.
     
    Last edited: Aug 8, 2015

    #3
    dalfaand, bhenne, bord and 118 others like this.
  4. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :
    7. Rooting.
    Things you'll need to download: (on your phone)
    SuperSU (The flashable ZIP)

    Note that must custom ROMs are pre-rooted and you don't even have to root them manually, please check if your ROM is already rooted before proceeding. Spoiler alert, CM12S(COS12), OxygenOS and ColorOS are not pre-rooted

    Okay here we go.


    1. Boot into TWRP.
    2. Flash(install) SuperSU.zip.
    3. Reboot.

    Boom, you're done.

    1. Recovering from no OS installed and no ROM or Backup present on the phone.
    Aaaahhhh! I accidentally wiped everything and now I'm stuck in TWRP! What ever will I do?? Is my phone BRICKED??!??

    Well no but I hope you listened to me earlier and made a backup of your internal storage, bye bye data otherwise :(

    Being stuck in TWRP isn't a big deal at all, there are multiple ways to get files onto your phone so you can flash them, I am aware of adb sideload but I will not be covering it here because I find adb push and mtp better options.

    If you have a USB OTG cable or a Micro USB stick you can use that to put a ROM on your phone as well.

    Okay now if you have drivers properly installed this will be the easiest thing ever because you can just see your phone in My Computer like normal and drag stuff onto it, if you don't then you can use ADB. Go open a command window in your adb/fastboot folder (C:\adb\) and type adb devices to see if you have a working connection with your phone, scroll up and follow part 0 of this guide if your phone isn't recognized by ADB on the TWRP home screen.

    Once adb devices recognizes your phone you can use adb push C:\Users\Dax\Downloads\rom.zip /sdcard/ to copy things to your phone. You want to replace that file path in the code with the path of your file which you can get by just typing adb push, pressing space and dragging&dropping the file you want to copy into the command window, pressing space again and typing /sdcard/ and pressing enter.

    It will look like nothing is happening but something is actually happening, just wait for it to finish.
    2. Recovering from no OS installed and no access to TWRP, fastboot does work.

    No big deal, boot your phone into fastboot mode and connect it to your computer. Verify that you have a connection with the fastboot devices command, which should return your serial number, if it doesn't do that follow the driver installation part of this guide again.

    Okay, the fastboot devices command returned your serial number and so you've verified that it is working, great. Download the latest fastboot images from here, it will be a .zip file. Unlike flashable zips you have to unzip this one and place all the 13-or-so files in your adb folder, the folder that contains fastboot.exe and adb.exe. Once you have the fastboot connection set and all of the .img, .bin, .mbn and whatever other files in your adb folder you want to input all these commands into your command window;

    fastboot flash oppostanvbk static_nvbk.bin
    fastboot flash modem NON-HLOS.bin
    fastboot flash sbl1 sbl1.mbn
    fastboot flash dbi sdi.mbn
    fastboot flash aboot emmc_appsboot.mbn
    fastboot flash rpm rpm.mbn
    fastboot flash tz tz.mbn
    fastboot flash LOGO logo.bin
    fastboot flash boot boot.img
    fastboot flash cache cache.img
    fastboot flash recovery recovery.img
    (replace this with the TWRP img file if you want TWRP as your recovery)
    fastboot flash system system.img
    fastboot flash userdata userdata_64G.img
    (replace this with fastboot flash userdata userdata.img if you have the 16GB OPO or skip it entirely if you don't want to wipe your internal storage)
    fastboot reboot
    3. Recovering from no OS installed and no access to fastboot, TWRP does work.

    Download and flash the latest official COS12 flashable zip, this should restore fastboot and with that you can reflash your phone completely to clean it up.
    1. Recovering from no OS Installed, no fastboot, no TWRP, black screen and no signs of life.
    Follow the instructions in this thread to the letter, watch the video and do as he says.
    http://forum.xda-developers.com/oneplus-one/general/tool-oneplusrecovery-tool-v1-0-restore-t2991851

    If this tool can't fix it I'm pretty sure you're out of luck. :/
     
    Last edited: Sep 20, 2017

    #4
    aris, dalfaand, bhenne and 103 others like this.
  5. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :

    1. Custom kernels, root and OTA updates.

    Whenever you do an OTA update, you'll lose your custom kernel. And if you're using a ROM that isn't pre-rooted like CyanogenOS you'll lose root access too after updating, preventing this is really simple, just don't do OTA updates automatically, do them manually. How?

    Download the latest version of your ROM, not the incremental update file.
    Download the latest version of the kernel you're
    using.
    Boot to recovery (TWRP) and make a backup, just in case. Then go to install, then select the latest version of your ROM, add more zips, select the latest version of your kernel, add more zips, and add SuperSU.
    Swipe to flash, clear cache and dalvik, back, and reboot.

    Done. Now you're updated to the latest version of the ROM, kernel, and you didn't lose root.
    2. Switching from one ROM to another or completely wiping your device clean without losing data. (Titanium Backup tutorial)
    https://docs.google.com/file/d/0B1_Sv7SgqeYhTDFLUlJBSVQyTlE/edit?usp=docslist_api
    ^Titanium Backup Pro (cracked)^ I use that apk and it works.

    Open Titanium Backup, Grant it root access and close all the information popups.
    Press Menu on the top right, then go to Batch actions and press Backup all user apps. Do not backup/restore system apps or system data.
    Let the backup finish and wipe / flash your new ROM

    Install Titanium Backup and go to Batch actions again, then press Restore all apps with data.

    When you want to flash another ROM you just go back into TiBu and go to Batch actions and run Backup new user apps and newer versions if you've installed any new apps, and then run redo backups for modified data.


    3. Keeping your ROM running as good as possible/what to do after rooting.
    Woohoooo! You're rooted! ummm.. Now what?

    Good question.

    I'll start by explaining how I maintain my device to keep it running smoothly, and then I'll go into the root apps I use and recommend.

    Maintenance:
    Two major parts of this were covered just a second ago; Updating and using Titanium Backup. If you want your ROM to stay problem free (unless the ROM is just, you know, not problem free..) you really should not be updating OTA, by doing this you're just overwriting one ROM install with another, files get deleted and left behind, the process is just messy and it causes lots of problems so I recommend just doing a clean flash every 2 or so weeks, or more frequent if you want that. Now, I'm not saying you can't OTA update at all, if you're careful about it there's pretty much nothing that can go wrong. Just make a backup in TWRP before updating and go for it.

    Every few months I copy my internal storage like photos and music to my computer, and do a complete reset of my phone like I explain in the orange part #2 of this guide, I recommend you do this too to avoid little long term issues.

    Now to the fun part, root apps;

    I don't actually use a ton of them, but there are a few must haves.
    1. Greenify (free/cost) is an app that automatically hibernates select apps when your screen goes off, preventing them from draining your battery. The free version of Greenify isn't very good, so I recommend buying it. Greenify works best with Xposed installed, but that's a whole other story. Once you open Greenify, you press the little + sign and you'll see a list of all your apps. Go ahead and scroll down, press the arrow to expand the list, and scroll back up. Tap and hold the first app you want to Greenify, and then go down the list selecting all the apps you want to hibernate. But, keep in mind, these apps will not work in the background anymore, and so you won't get notifications from them. Do not Greenify any app that you rely on, your text messaging app, for example.

    2. Amplify (cost) is sort of similar to Greenify, but very different at the same time. To understand what Amplify does you must first understand what wakelocks are. That article covers Wakelock Detector and Greenify, but I find the Greenify guide lacking so I wrote my own.
    Amplify gives you total control over every specific wakelock on your device, it lets you limit them to whatever you want. A great place to get started with Amplify is this guide. It's somewhat outdated, but the principles haven't changed.
    3. Wakelock Detector (free) guide here.
    4. Mobile Radio Pwn (free) is an app that turns your mobile radio off while connected to WiFi, a bug in Android Lollipop makes it so that your mobile radio never turns off unless you do it manually, nobody likes manually, so this app automates it. Yes, MRP is free, but my friend put a lot of effort into it so I would appreciate it if you supported him and bought it :) Here's his thread, I linked to the exact post you want to be reading, so don't scroll :p
    5. Titanium Backup (cost) I've already explained this one, Titanium Backup is awesome.
    6. Viper4Android (free) is the best sound mod on Android, period. It's extremely powerful and can make your music sound a lot better. To install V4A all you need to do is download the app, open it, and let it install the Super Audio Quality driver. Note that your selinux has to be set to permissive or V4A will not work at all.
    Yes it has a ton of settings, especially on expert mode, but if you put some time into playing with all the settings you'll love it.

     
    Last edited: Aug 16, 2015

    #5
    dalfaand, bhenne, MakaG and 63 others like this.
  6. Android the Greek Jelly Bean Apr 6, 2015


    #6
    cdisxm, A-Josh87, Gegetp and 9 others like this.
  7. EpicSwirly Apr 6, 2015

    EpicSwirly, Apr 6, 2015 :
    It's about damn time someone made a guide like this. lol
     

    #7
  8. !1+1! Honeycomb Apr 6, 2015


    #8
  9. pablofg1978 Spanish POC Assistant Head Moderator Apr 6, 2015


    #9
  10. S0bek Ice Cream Sandwich Apr 6, 2015

    S0bek, Apr 6, 2015 :
    Great job ! Even the most idiots like me will be able to understand your guide now aha :D
     

    #10
    Jaxsky, A.S, SoniaB and 1 other person like this.
  11. EpicSwirly Apr 6, 2015


    #11
  12. DaxNagtegaal Lollipop Apr 6, 2015


    #12
    raiashu92, TForesto, pitnr and 21 others like this.
  13. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :
    Only took a few seconds.
     
    Last edited: May 9, 2019

    #13
  14. S0bek Ice Cream Sandwich Apr 6, 2015


    #14
  15. jclp Honeycomb Apr 6, 2015


    #15
    Paritosh20 and DaxNagtegaal like this.
  16. Android the Greek Jelly Bean Apr 6, 2015


    #16
    iTrollz and DaxNagtegaal like this.
  17. GIRdaRobot Eclair Apr 6, 2015

    GIRdaRobot, Apr 6, 2015 :
    Thank you. I tried to switch to nitghly cm. I'm currently on oxygen and when I did everything I got a failed ? Why is that
     

    #17
    DaxNagtegaal likes this.
  18. d1beats Jelly Bean Apr 6, 2015


    #18
    DaxNagtegaal likes this.
  19. DaxNagtegaal Lollipop Apr 6, 2015

    DaxNagtegaal, Apr 6, 2015 :
    PM me when you have time, I'll add it and of course credit you.

    PM me
     

    #19
    Tobikage and CountryBoyCRO like this.
  20. Android the Greek Jelly Bean Apr 6, 2015

    Android the Greek, Apr 6, 2015 :
    Add a list of not to dos

    1. Locking the boot loader
    2. Wiper internal storage
     

    #20
    Sykora, BiffTirkle and DaxNagtegaal like this.