[ONE General] Heisenberg:
[SIZE=+3]Heisenberg's How-To Guide For Beginners[/SIZE]

[SIZE=+2]OnePlus One[/SIZE]

​

[SIZE=+1]See Also:

[INDEX] OnePlus One

[FAQ] OnePlus One Frequently Asked Questions[/size]

[SIZE=+1]Intro[/SIZE]

This thread will serve as a location for basic how-to guides for the OnePlus One (Bacon). I'm going to start off with a couple of the more obvious ones and go from there. If anyone has any suggestions for additions please feel free to let me know.

[size=+1]Prerequisites[/size]:

You'll need a working adb/fastboot environment on your PC to get through some of these guides. Go here to download the Android SDK, which will give you most updated version of adb and fastboot. Scroll to the bottom of the page and find Other Download Options>SDK Tools Only, and grab the right version for your OS. While it's downloading create a folder in C:\ called SDK (C:\SDK). Once you've downloaded the zip you can extract it into your C:\SDK folder. Navigate to C:\SDK\android-sdk-windows and open SDK Manager.exe. In SDK Manager you need to install the following packages:

Tools> Android SDK Tools, Android SDK Platform-tools

Extras> Android Support Library

Once you have installed those, inside C:\SDK you should see some new folders, one of them will be called platform-tools, within that folder you should see fastboot.exe and adb.exe. I'll refer to this as your fastboot folder/directory or working folder/directory during this guide. To make sure adb is correctly installed, open a command prompt from within your fastboot folder (hold shift + right click, select open command prompt here) and issue this command:

adb version

If it returns a version number for Android Debug Bridge then you're good to go.

You'll find universal adb/fastboot drivers here, download it and follow the installer, then reboot your PC.

You can test adb by connecting your device to your PC while booted into Android (making sure that adb/usb debugging is enabled in Settings>Developer Options) with the screen unlocked and issuing this command:

adb devices

It should return your device serial number, if so, adb is working.

You can test fastboot by connecting your device to your PC while booted into fastboot mode (power + volume up) and issuing this command:

fastboot devices

It should return your device serial number, if so, fastboot is working.

By attempting any of the processes listed this thread you accept full responsibility for your actions. I will not be held responsible if your device stops working, catches on fire, or turns into a hipster and claims to have been modified before it was cool. Make sure you read a section and fully understand it

before

attempting it.

​

[SIZE=+1]Index[/SIZE]

How To Unlock Your Bootloader

How To Install A Custom Recovery On Your Device

How To Make A Nandroid Backup With TWRP Recovery

How To Root Your Stock Rom

How To Install A ROM with TWRP Recovery

How To Install A Custom Kernel With TWRP Recovery

How To Flash The Stock Kernel With Fastboot

How To Flash The Cyanogen OS Fastboot Images

How To Update Modem/Firmware When Switching From KitKat To Lollipop (and vice versa)

How To Make Sure You Can Pretty Much Always Recover From An Accidentally Wiped System

How To Backup & Restore Your EFS Partition

​

[SIZE=+1]1. How To Unlock Your Bootloader[/SIZE]

Power off your phone then boot into fastboot mode (power + volume up).

Connect your phone to your PC via usb cable.

Open a command prompt from within your fastboot folder (navigate to where you have fastboot.exe located on your PC, shift + right click anywhere within that folder, select open command prompt here).

Check your fastboot connection by issuing this command:

fastboot devices

It should return your device serial number, if not you need to make sure your drivers are installed correctly.​

Once you've confirmed your fastboot connection issue this command:

fastboot oem unlock

The device will now go through the automated unlocking process, just let it do its thing and it'll boot up into Android.​

Go back to fastboot mode and issue this command to ensure that it worked:

fastboot oem device-info

It should have a couple of lines there, both with the flag set to true.​

You can now reboot your phone using this command:

fastboot reboot

It's now safe to disconnect your usb cable.

Please note: this will erase all user data from your device, it is best to do this before you really start using the device and installing apps or putting data on the internal storage.

​

[SIZE=+1]2. How To Install A Custom Recovery On Your Device[/SIZE]

Prerequisites: unlocked bootloader.

You first need to go into Settings/Developer Options and uncheck the "Update recovery with system updates" option (to enable Developer Options go into Settings/About Phone and click 'build number' about seven or eight times).

Download the recovery of your choice (my preferred recovery is TWRP, and we'll be using that for this guide, grab it here).

Make sure you check the md5 to verify its integrity.

Place the file in your fastboot folder (this is where fastboot.exe is located on your PC).

Put the phone in fastboot mode and connect it to your PC via usb cable.

Open a command prompt from within your fastboot folder (shift + right click, select open command prompt here), and enter the following commands:

fastboot flash recovery openrecovery-twrp-2.8.1.0-bacon.img

(The recovery filename in the command will change depending on which recovery you're flashing)

fastboot format cache

fastboot reboot

Let the device reboot, it's now safe to disconnect your usb cable.

Now you can use the advanced power menu (or the power + volume down button combo) to enter your custom recovery.

Please note, if you have taken the stock Lollipop update please read the following:

For some reason CM12S doesn't respect the on/off toggle for the "update CM recovery" option in Developer Options, it just replaces whatever custom recovery you've flashed with the CM recovery regardless of whether that option is unelected.

Flash your custom recovery again, but after flashing don't do a normal reboot. After the flash has succeeded disconnect the usb cable, then power down the phone by holding the power button down, once it's powered off use the power + volume down button combo to boot directly into recovery. This first forced reboot into recovery somehow subverts what was keeping it from staying flashed and all subsequent normal reboots into recovery will boot into the custom recovery of your choice.

​

[SIZE=+1]3. How To Make A Nandroid Backup With TWRP Recovery[/SIZE]

Prerequisites: unlocked bootloader, TWRP recovery.

A nandroid backup is a very important thing to have before installing any custom software on your device. It's basically a backup of your stock system that you can fall back on if anything goes wrong or if you just want your stock ROM back. You can also use the backup tool to create a backup of your favourite ROM set up exactly the way you like it. The backup you create can be easily restored using the restore tool in TWRP recovery.

All you need to do is enter TWRP recovery, select the backup option from the TWRP home screen, check the system/data/boot boxes, and swipe to backup. The process will take a few minutes.

​

[SIZE=+1]4. How To Root Your Stock Rom[/SIZE]

Prerequisites: unlocked bootloader, TWRP recovery.

First you need to download SuperSU.

Enter TWRP recovery via the advanced power menu (or power + volume down).

Select the install option from the TWRP home screen.

Navigate to where you have SuperSU stored on your sd card and select it.

Swipe to install.

Once you've installed SuperSU you'll have an option to wipe cache/dalvik and an option to reboot system. Wipe the cache/dalvik, hit the back button, and hit the reboot system button. That's it.

​

[SIZE=+1]5. How To Install A ROM with TWRP Recovery[/SIZE]

Prerequisites: unlocked bootloader, TWRP recovery.

Installing a ROM is a pretty straight forward and easy process. Before you install anything you should make a nandroid backup (instructions above).

Download a ROM and appropriate Gapps package and place on your device.

Boot into your custom recovery.

Perform a full wipe.

Select the wipe option from the TWRP home screen.

Select advanced wipe.

Check the system, data, cache, and dalvik cache options.

Swipe to wipe.

Install the ROM.

Select the install option from the TWRP home screen.

Navigate to where you have the ROM zip stored on your sd card and select it.

Swipe to install.

Most ROMs will run an installer script at this point but some ROMs have what is called an Aroma Installer which allow you to choose some install options before the script runs.​

You will also need to install the appropriate gapps package directly after installing the ROM.

Once you've installed all necessary zips you'll have an option to wipe cache/dalvik and an option to reboot system. Wipe the cache/dalvik, hit the back button, and hit the reboot system button.

​

[SIZE=+1]6. How To Install A Custom Kernel With TWRP Recovery[/SIZE]

Prerequisites: unlocked bootloader, TWRP recovery.

A custom kernel can open up a new level of control over your device, such as overclocking/underclocking, undervolting, changing governors, changing I/O schedulers, adjusting colour calibrations, adjusting sound calibrations, and many other options.

Download a kernel that is compatible with your current ROM.

Check the md5 to verify its integrity.

Enter TWRP recovery.

Select the install option from the TWRP home screen.

Navigate to the kernel and select it.

Swipe to install.

You'll have an option to wipe cache/dalvik and an option to reboot system. Wipe the cache/dalvik, hit the back button, and hit the reboot system button.

Once your phone has booted up you can use a kernel tuning app to change governors, I/O scheduler, clock speed, and other options. Some of the popular kernel apps are Trickster Mod, No Frills, Kernel Tuner, and many more.

​

[SIZE=+1]7. How To Flash The Stock Kernel (boot.img) With Fastboot[/SIZE]

Prerequisites: unlocked bootloader.

If you're running a custom kernel on Cyanogen OS you'll need to flash the stock kernel back in order to take an OTA update.

Download the appropriate set of stock images from this thread. Extract the zip and grab the "boot.img" file.

Put it in your fastboot folder (where you have fastboot.exe located) on your PC.

Boot into fastboot mode (power + volume up) and connect your phone to your PC via usb cable.

Open a command prompt from within your fastboot folder (shift + right click, select open command prompt here).

Issue this fastboot command:

fastboot flash boot boot.img

It'll take a few seconds to flash the boot.img, once it's finished you can manually reboot your phone or use the following command to reboot it:

fastboot reboot

It's now safe to disconnect your usb cable.

Now you have the stock kernel back on your device.

​

[SIZE=+1]8. How To Flash The Cyanogen OS Fastboot Images[/SIZE]

Prerequisites: unlocked bootloader.

Please note: This procedure requires an unlocked bootloader. This procedure will factory reset your device! All user data (settings, apps, data on internal storage) will be wiped!

Download the latest stock images to your PC from here. If you don't want the latest build you can find all stock images mirrored here thanks to [MENTION=2948558]Spannaa[/MENTION].

Reboot your device into Fastboot Mode (power + volume up) and connect your phone to your PC via usb cable.

Unzip the file you downloaded and put its contents into your fastboot folder (the same folder that you have adb.exe and fastboot.exe located in on your PC).

Open a command prompt from within your adb/fastboot folder (shift + right click, select open command prompt here).

Issue these fastboot commands:

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 oppostanvbk static_nvbk.bin
fastboot flash boot boot.img
fastboot flash cache cache.img
fastboot flash recovery recovery.img
fastboot flash system system.img
fastboot flash userdata userdata_64G.img

or fastboot flash userdata userdata.img if you have the 16gb model)

Please note: flashing the userdata will wipe your internal storage (your virtual sd card). It's possible to flash these images without that command if a full wipe isn't completely necessary in your situation.

Reboot your device with this command:

fastboot reboot

It's now safe to disconnect your usb cable.

​

[SIZE=+1]9. How To Update Modem/Firmware When Switching From KitKat To Lollipop (and vice versa)[/SIZE]

Prerequisites: unlocked bootloader.

To update from KitKat to Lollipop download the YOG4PAS1N0 firmware zip here:

cm-12.1-YOG4PAS1N0-bacon-firmwareonly-fastboot.zip

To revert from Lollipop to KitKat download the XNPH44s or XNPH05Q firmware zip here:

cm-11s-XNPH44S-bacon-firmwareonly-fastboot.zip

cm-11s-XNPH05Q-bacon-firmwareonly-fastboot.zip

Reboot your device into Fastboot Mode (power + volume up) and connect your phone to your PC via usb cable.

Unzip the file you downloaded and put its contents into your fastboot folder (the same folder that you have adb.exe and fastboot.exe located in on your PC).

Open a command prompt from within your adb/fastboot folder (shift + right click, select open command prompt here).

Issue these fastboot commands:

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 oppostanvbk static_nvbk.bin

Reboot your device with this command:

fastboot reboot

It is now safe to disconnect your usb cable.

​

[SIZE=+1]10. How To Make Sure You Can Pretty Much Always Recover From An Accidentally Wiped System[/SIZE]

Prerequisites: unlocked bootloader, TWRP recovery.

There may come a time when you accidentally wipe your OS while trying to perform a basic cache wipe in recovery. Don't laugh, it can happen to the best of us. The best way to insure yourself against being stuck in recovery is to keep a ROM zip or a TWRP/CWM backup (a nandroid backup) on your sd card at all times.

This solution seems like common sense but apparently there are quite a few people out there who don't store a ROM or backup on their phone. You might think it's easy to just mount the OTG storage and copy a ROM across to your phone from your PC (which is definitely an option), but there's always a chance that you won't be near your HDD or sd card at the time, or it won't recognise your phone properly. Basically you need to insure yourself against Murphy's law.

​

[SIZE=+1]11. How To Backup & Restore Your EFS Partition[/SIZE]

Prerequisites: unlocked bootloader, root.

All too often on this device I've seen folks who have a corrupted or missing EFS Partition. This results in your IMEI being lost and no cellular activity on the device at all. This can be a royal PITA to fix, and some folks haven't been able to fix it at all. You can take a precautionary measure to safeguard yourself against this by taking a couple of minutes to back up your modemst files.

Open up Terminal Emulator on your phone (if you don't have it you can download it here).

Once it's open you'll be greeted with a command line prompt, in which you can enter text commands, the first thing you need to do is enable root access by entering this line (press the enter key on your on-screen keyboard after each command to issue it):

su

If this is the first time you've used Terminal Emulator a Superuser or SuperSU popup will appear, make sure you grant root access.​

Now enter these two commands:

dd if=/dev/block/mmcblk0p10 of=/sdcard/modemst1.bin bs=512

dd if=/dev/block/mmcblk0p11 of=/sdcard/modemst2.bin bs=512

The result should look like this:

This will place two files (modemst1.bin & modemst2.bin) on the root of your internal storage, make sure you copy them to your PC immediately so that you have a backup there to use if you need to restore it in future.

If by chance you end up with a corrupt EFS partition all you need to do is flash the files back to your device using fastboot.

Boot into fastboot mode (power + volume up) and connect your phone to your PC via usb cable.

Make sure the two files are in your fastboot folder on your PC.

These fastboot commands will restore the files:

fastboot flash modemst1 modemst1.bin

fastboot flash modemst2 modemst2.bin

Reboot your device:

fastboot reboot

It's now safe to disconnect your usb cable.

Credit goes to [MENTION=5427631]Vonnegut[/MENTION] for originally posting this method in the TWRP thread.

​

Donate To Me