How to install CyanogenMod in the OnePlus X phone


We are going to install CyanogenMod 12.1 in an OnePlus X mobile phone.

My OnePlus X phone is the model: E1003

Before messing up with the operating system of the phone I recommend you to perform a backup of your important data.


Connect via ADB


First we are going to connect the phone with your computer via ADB (Install ADB in Debian).

in your phone enable Developer options:
Settings -> About Phone -> Buid Number (tap 7 times)

then Settings -> Developer Options appears enabled.

Enable USB debugging:
Settings -> Developer Options -> USB debugging


In your computer we will see the device:
$ lsusb
Bus 002 Device 005: ID 2a70:9011

$ adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
5c6c3c16 unauthorized


In the phone, allow that RSA key to always accept that computer.

$ adb devices
List of devices attached
5c6c3c16 device


We can enter into the phone:
$ adb shell
shell@OnePlus:/ $


Unlock the bootloader


In order to flash something you need to unlock once the bootloader. This operation will reset your phone to factory reset.

So to enable bootloader unlocking, go into Developer Options and enable bootloader unlocking:
Setup -> Developer options -> Enable oem unlocking

Reboot in fastboot mode
$ adb reboot bootloader

Check if your device was detected:
$ fastboot devices
5c6c3c16 fastboot

Unlock the bootloader:
$ fastboot oem unlock
...
OKAY [ 0.010s]
finished. total time: 0.010s


The device will unlock the bootloader, erase all user data and reboot itself into Android. You will have to set up everything from scratch.


Install TWRP


TWRP images for oneplus X:
https://twrp.me/devices/oneplusx.html
https://dl.twrp.me/onyx/

I download twrp-3.0.2-0-onyx.img

In fastboot mode: (Combination of Hardware buttons)

$ fastboot flash recovery twrp-3.0.2-0-onyx.img
Accept in the phone.

target reported max download size of 1073741824 bytes
sending 'recovery' (14758 KB)...
OKAY [ 0.614s]
writing 'recovery'...
OKAY [ 0.279s]
finished. total time: 0.893s



Reboot in recovery mode (Volume down and press power button until it boots in recovery mode)
NOTE: If you reboot in standard mode the system will delete the recovery partition and you will have to start again TWRP installation.


IMPORTANT: Backup original ROM using TWRP
If this installation fails you will easily could restore original ROM from this backup using TWRP.


Get Cyanogenmod 12.2 ROM


Cyanogenmod 12.2 oneplus X stable installation thread:
http://forum.xda-developers.com/oneplus-x/orig-development/rom-cyanogenmod-12-1-oneplus-x-t3254072

Cyanogenmod ROM:
http://forum.xda-developers.com/devdb/project/dl/?id=17258
I download MA-12.1-20160308-onyx.zip


Also if you want Google apps:
https://wiki.cyanogenmod.org/w/Google_Apps

Google apps for Cyanogenmod 5.1:
http://opengapps.org/?api=5.1&variant=nano
I download open_gapps-arm-5.1-nano-20160409.zip


I upload ROM images to the SD card I installed in the phone:
$ adb push MA-12.1-20160308-onyx.zip /storage/sdcard1
3988 KB/s (277242066 bytes in 67.880s)

$ adb push open_gapps-arm-5.1-nano-20160409.zip /storage/sdcard1
3829 KB/s (101394640 bytes in 25.858s)


FACTORY RESET


Perform a factory reset using TWRP, so you install CyanogenMod in a clean environment.


Install CyanogenMod


From the SD card, using TWRP install CyanogenMod zip image and Google tools.


Reboot your phone and enjoy!


REFERENCE


http://forum.xda-developers.com/oneplus-x/general/discussion-how-to-root-oneplus-x-t3242830

http://forum.xda-developers.com/oneplus-x/orig-development/rom-cyanogenmod-12-1-oneplus-x-t3254072