141

Like a Boss: How To Root Your OnePlus One

  1. acurrie Eclair Jul 16, 2014

    acurrie, Jul 16, 2014 :
    Another Howard Forums re-post for your enjoyment... :)

    [​IMG]

    Just like a Nexus device from Google, a big benefit to owning a OnePlus One is the device’s unlockable bootloader. In fact, taking full control of your OPO is just as easy as on a Nexus—no shady exploits required, you just need a few tools installed on your computer.

    Today I’ll walk you through what I think are the best practices for rooting your OPO. This will be skewed towards the Linux user, but the same basic procedure applies to Mac and Windows PCs as well.

    Why Root?

    As I wrote yesterday the OnePlus One has CyanogenMod’s excellent Privacy Guard out of the box, so why would you need root as well? I can think of at least three reasons:
    1. Banish ads from your OPO with AdAway;
    2. Migrate game saves and other app data from another device with TitaniumBackup;
    3. Go down the deep, dark rabbit hole of customization otherwise known as the Xposed Framework.
    I myself have rooted every single Android device I’ve ever owned; I wouldn’t have it any other way. And now that I’ve convinced you, let’s get started. :D

    What You’ll Need

    Your desktop computer will need to support two protocols to fully communicate with your OPO: adb, or the Android debug bridge and fastboot. On Mac and Windows this means downloading and installing the Android Software Development Kit, available from Google here. If you’re an Ubuntu/Linux Mint user like me it’s even easier; all you have to do is launch your built-in software manager and install the following packages:
    • android-tools-adb
    • android-tools-fastboot
    Whether you use Linux or not you’ll need one additional download, a custom recovery image for your OPO. I prefer TWRP, which you can find here.

    Prepping Your Device

    Now we will activate adb on your OPO. To do this we’ll first enable developer options. In the main settings panel, scroll down to the bottom where you’ll see “About Phone”. Tap through and scroll down to “Build Number”, the second last entry. Tap that seven times and congrats, you’re now an Android developer! Go back to the main settings pane where you’ll now see “Developer options” near the bottom.

    In developer options check “Android debugging” (adb) and, while we’re at it, “Advanced reboot” near the top of that list. The second step isn’t entirely necessary, but gives you an easy way to boot into either the recovery or bootloader on your device.

    Terminal Time

    So from this point onwards commands and such will be specifically for Linux computers, but again the basic procedure is the same on all desktop computers. For instructions specific to your OS, Google is your friend… and probably XDA.

    On your computer, navigate to the folder where you downloaded TWRP and open a terminal window there. In Linux Mint it’s as easy as right-clicking on the folder and selecting “Open Terminal Here”.

    Now you could boot your OPO into fastboot mode by using the advanced reboot menu (hold down your power button to see what I mean), but this is about best practices—so let’s instead verify that your phone and computer can talk to each other via adb. Connect the two with a USB cable and in your open terminal window type the following:

    Code:
    sudo adb devices
    I use the sudo (“super do”) command because I was too lazy to bother with special permissions for adb or fastboot on my computer. If you’ve installed adb correctly, you should see “list of devices attached” with a numbered entry below it. Congrats!

    To put your OPO into fastboot mode, type the following Into that same open terminal:

    Code:
    sudo adb reboot bootloader
    Confirm that your computer and phone can talk to each other via fastboot with this terminal command:

    Code:
    sudo fastboot devices
    And when you’re ready, unlocking the bootloader on your OPO is as simple as typing this:

    Code:
    sudo fastboot oem unlock
    Remember again that this will wipe your device!

    One difference between the bootloader on the OnePlus One and a Nexus device is that a Nexus will show you the unlock state on your phone’s screen. The OPO, as I remember, will simply reboot back into its OS. If it doesn’t, it’s probably not a bad idea to reboot it manually:

    Code:
    sudo fastboot reboot
    At this point you can re-enter to your Google and/or Cynaogen deets, or skip through the prompts and do it later. And I already told you twice that your OPO would be wiped, so don’t complain!

    So your OPO’s bootloader is unlocked but you don’t yet have root. You’ll now need Chainfire’s SuperSU binary, which you can get right here. You can download it to your computer and then transfer it to your phone, or simply use your OPO’s browser and download it directly onto your device.

    Roadblock

    To flash the supersu.zip we’ll now need that TWRP custom recovery. There are two ways to proceed. Ordinarily I would put the device back in fastboot mode and flash the custom recovery, then use that recovery to flash the super user zip. Unfortunately, there are two issues with going this route:
    1. Over the air system updates from Cyanogen probably won’t work. You would have to use your custom recovery to manually flash the new system image as it become available.
    2. Cyanogen may not offer updated factory images at all. As GizChina reports, there are users in Europe and Asia who are buying up Chinese versions of the OPO and flashing CM on it. I personally don’t see any problem with this, but for whatever reason CM has obfuscated the factory images on their web site. You can still get the latest image if you follow GizChina’s instructions, and I highly recommend that you do.
    Fastboot FTW!

    Thanks to this thread on the OnePlus forums, I learned something new and fairly amazing about fastboot, which I will now share with you. Let’s go back to your terminal window, opened at the directory you’ve saved your TWRP recovery to. Put your OPO back in fastboot mode (try it from the power button menu if you like) and connect it to your computer. Type this command:

    Code:
    sudo fastboot boot recovery.img
    … replacing “recovery. img” with the actual file name of your TWRP recovery. In less than a minute your OPO will boot into TWRP—from your computer!!! You can now flash your supersu.zip by using TWRP’s install command, without having to actually flash TWRP on your device.

    The advantage of not flashing TWRP is that the OPO’s default recovery stays in place, to be used when system updates become available. And best of all, after the update you’ll still have root!

    I prefer this more hands-on procedure to the one-click toolkits available on XDA, as it allows for a better understanding of how adb, fastboot and the various partitions of an Android system work. You may want to corroborate what I’ve written here with another how-to guide for your computer OS of choice. And fear not: once you get the hang of this it will be second nature to take control of an Android device and truly make it your own.

    Good luck!
     

    #1
  2. theacer Ice Cream Sandwich Jul 16, 2014


    #2
  3. benbeck08 Jelly Bean Jul 16, 2014

    benbeck08, Jul 16, 2014 :
    Wow. Well written. +1 OP
     

    #3
  4. zoulsaggitario Froyo Jul 16, 2014

    zoulsaggitario, Jul 16, 2014 :
    ahhhh...Looks tricky... but what is the success rate? any possibility of full brick the phone after steps taken?
     

    #4
  5. pawv Jelly Bean Jul 16, 2014


    #5
    Jorge48197 and tbarcellona like this.
  6. JAIGON Ice Cream Sandwich Jul 16, 2014

    JAIGON, Jul 16, 2014 :
    There´s a thousand of these guides but hey, thanks for the time you spent on it
     

    #6
    Jorge48197 likes this.
  7. dbahn25 Honeycomb Jul 16, 2014

    dbahn25, Jul 16, 2014 :
    @acurrie do OTA updates only work with stock recovery, not with TWRP?
    great tutorial btw, thanks a lot (and i appreciate that you use linux :D)
     

    #7
    l0pher likes this.
  8. acurrie Eclair Jul 16, 2014

    acurrie, Jul 16, 2014 :
    My understanding of OTA updates is that the phone will boot into recovery to flash the update. Pretty sure TWRP would break that...
     

    #8
    EmmaWATTson likes this.
  9. Deactivated User Jul 16, 2014


    #9
    acurrie likes this.
  10. arwaldon4 Gingerbread Jul 16, 2014

    arwaldon4, Jul 16, 2014 :
    I honestly thought that since this was running CM11, that root wouldve been available out the box. #needstogostudy
     

    #10
    trulydread and acurrie like this.
  11. Deactivated User Jul 16, 2014


    #11
    acurrie and arwaldon4 like this.
  12. rajitha Honeycomb Jul 16, 2014


    #12
    acurrie and arwaldon4 like this.
  13. Jevoly Marshmallow Community Expert Jul 16, 2014


    #13
    acurrie likes this.
  14. arwaldon4 Gingerbread Jul 16, 2014

    arwaldon4, Jul 16, 2014 :
    Big up on this awesomely thorough guide!
     

    #14
    acurrie likes this.
  15. firestan Honeycomb Jul 16, 2014


    #15
    acurrie likes this.
  16. Mr2DamnGood Gingerbread Jul 16, 2014

    Mr2DamnGood, Jul 16, 2014 :
    It makes me sad sometimes when I think about how much time, money, and resoruces can be saved if more people used linux.
     
    Last edited: Jul 23, 2014

    #16
    csol, netspionage, hosios and 4 others like this.
  17. dbahn25 Honeycomb Jul 16, 2014

    dbahn25, Jul 16, 2014 :
    and microsoft would be introduced to its limits :D
     

    #17
  18. logikk Honeycomb Jul 17, 2014


    #18
    acurrie likes this.
  19. androidphone Eclair Jul 18, 2014


    #19
    acurrie likes this.
  20. dbahn25 Honeycomb Jul 20, 2014

    dbahn25, Jul 20, 2014 :
    @acurrie i've got one more question:
    what happens if the usb connection breaks while the phone is in the TWRP recovery which is not installed on the device? will that brick the phone? (like samsung phones when flashing with odin)
     

    #20