[Nexus 5 Android Development] nathanchance:
Installing Cataclysm

Hey guys, [MENTION=5372360]magnamentis[/MENTION] has been mentioning my Nexus 6 guide in here a couple times and so I decided to just modify it for the Nexus 5 and post it. I know many of you already know how to do this and it may seem unnecessary but there are always new people coming in and methods may change. I just want to consolidate it all into one post. I will keep this as up to date as possible, please let me know if there are any issues. Special thanks to [MENTION=3913401]atl4ntis[/MENTION] for the wonderful ROM.

PLEASE READ THE PROCESS ALL THE WAY THROUGH SO YOU UNDERSTAND EXACTLY WHAT YOU ARE DOING. If you have questions, either PM me or post here. I'd rather you not bootloop your phone :)

Getting all the way up to date:

If you are on the latest stable (or beta) version:

YOU MUST BE ON AT LEAST THE LATEST STABLE VERSION TO DO THIS PROCESS! If you are not on the latest stable or beta, following your applicable process below this one will get you onto the latest stable then the beta.

1. Download the latest Mod zip, your custom kernel (optional), and SuperSU (if you want root, see below) onto your phone (make sure the kernel is up to date for the latest Android version of Cataclysm).

2. Boot into TWRP and make a backup (optional but HIGHLY recommended).

3. Flash Cataclysm zip.

4. Flash SuperSU (optional; read note below on root to see if this is necessary).

5. Flash your custom kernel (optional).

6. Reboot and profit.

If you are on a Cataclysm build date on/after October 11th (but not the latest stable) OR stock Android (but not the latest):

1. Download the latest stable zip (and the latest beta zip, if applicable), your custom kernel (optional), and SuperSU (if you want root, see below) onto your phone (make sure the kernel is up to date for the latest Android version of Cataclysm).

2. Make sure you have the latest bootloader and radio using the process below.

3. Boot into TWRP and make a backup (optional but HIGHLY recommended).

4. Flash Cataclysm zip(s).

5. Flash SuperSU (optional; read note below on root to see if this is necessary).

6. Flash your custom kernel (optional).

6. Wipe cache and dalvik cache (optional).

7. Reboot and profit.

If you are on a Cataclysm build date on/before September 27th OR on a custom ROM (clean install):

1. Download the latest stable zip (and the latest beta zip, if applicable), your custom kernel (optional), and SuperSU (if you want root, see below) onto your phone (make sure the kernel is up to date for the latest Android version of Cataclysm).

2. Back up any important data via Titanium Backup or your tool of choice.

3. Make sure you have the latest bootloader and radio using the process below.

4. Boot into TWRP and make a backup (optional but HIGHLY recommended).

5. Wipe system, data, cache, and dalvik cache in Wipe > Advanced Wipe (MANDATORY).

6. Flash Cataclysm zip(s).

7. Flash SuperSU (optional; read note below on choosing root).

8. Flash your custom kernel (optional).

9. Reboot and profit.

If you are on the latest stock Android:

1. Download the latest Mod zip (no need for full stable), your custom kernel (optional), and SuperSU (if you want root, see below) onto your phone (make sure the kernel is up to date for the latest Android version of Cataclysm).

2. Make sure you have the latest bootloader and radio using the process below.

3. Boot into TWRP and make a backup (optional but HIGHLY recommended).

4. Flash Cataclysm zip.

5. Flash SuperSU (optional; read note below on choosing root).

6. Flash your custom kernel (optional).

6. Reboot and profit.

How to update bootloader and radio:

1. Boot into the bootloader.

2. Download the latest factory image for your device.

3. Compare the versions of the current bootloader/radio to your bootloader/radio (name of the file). If they are the same, you are good. If not, continue on.

4. Make sure you have fastboot set up (Windows/Linux and Mac).

5. Navigate to the folder with your files in them and type whichever commands you need into your terminal, one at a time:

fastboot flash bootloader [i]name_of_bootloader.img[/i]
fastboot reboot-bootloader
fastboot flash radio [i]name_of_radio.img[/i]

6. Continue on.

How to root:

There is a lot of information here with rooting on Marshmallow. I will try to keep all of this up to date but you should always be checking Chainfire's thread here to verify and get more info as he is 100x smarter than I am.

I built this like a flow chart; you can read it all or read as you need. Please note, I have tested this as much as I can and provide this so you have a one stop shop but if you have problems, please direct your questions and posts either to me via PM or to the SuperSU Beta thread so Chainfire can see the posts and you can be properly helped.

IF YOU CARE ABOUT ANDROID PAY:

To use Android Pay, you must either be unrooted or running systemless root. Choose to download and install that root using the sections below. Otherwise, choose system root.

Why so much info on rooting??

Currently, there are two methods of rooting: system root and systemless root. Here is what you need to know before you choose which one to install:

System root

: This is the OG root. This is what you are used to. It is stable and it works without issues. Choose this if you don't know much about rooting and don't care about Android Pay.

Systemless root

: This is the new root on the block. This root does not modify the system partition, which allows it to pass the checks for Android Pay (at the moment, subject to change at any time). It also allows of OTAs from Google but that is irrelevant here. Some apps MAY NOT work with this. Either let the developer know so they can fix it or switch to system root.

How do I know which one I have currently?

Go into SuperSU > Settings > System > Install SuperSU into /system. If it says SuperSU is already a system app, you have system root. If it says not currently possible with systemless root, you have systemless root.

What do I download?

If you chose system root (compatible with December 14th build and later): Download SuperSU 2.52.

If you chose systemless root: Download the newest version of SuperSU 2.64 and up.

A note about SuperSU 2.64 and up:

Starting with SuperSU 2.64, system root is prioritized during installation. This means if rooting via /system modification is possible (and it will be with December 14th and newer), it will do that instead of systemless root. This is nice because it means the installation process should be more universal (instead of having two separate zips). However, you have to explicitly choose systemless root by typing some terminal commands, documented below.

How to install?

System root: Just flash it as a normal zip in your process.

Systemless root:

1. Navigate to TWRP > Advanced > Terminal Command.

2. Select the current folder (should be root or /) using the button in the righthand corner.

3. Type these two commands, one at a time:

echo SYSTEMLESS=true>>/data/.supersu
echo BINDSYSTEMXBIN=false>>/data/.supersu

The first command forces systemless root, the second prevents /su/xbin_bind from existing (which must be removed for Android Pay to work).

4. Flash SuperSU 2.64+.

When to flash SuperSU?

System root: When you first flash Cataclysm. It is not necessary after that (make sure you install the backup script when prompted).

Systemless root: Whenever there is a Cataclysm update. You should not need to reflash SuperSU for the majority of kernel updates (but check with your developer if you are unsure).

How to switch between system and systemless root:

Going from system to systemless:

1. Flash UnSU (removes SuperSU from /system, special thanks to [MENTION=4544860]osm0sis[/MENTION])

2. Navigate to TWRP > Advanced > Terminal Command.

3. Select the current folder (should be root or /) using the button in the righthand corner.

4. Type these two commands, one at a time:

echo SYSTEMLESS=true>>/data/.supersu
echo BINDSYSTEMXBIN=false>>/data/.supersu

The first command forces systemless root, the second prevents /su/xbin_bind from existing (which must be removed for Android Pay to work).

5. Flash SuperSU 2.64+.

6. Reboot and profit.

Going from systemless to system:

1. Delete /data/.supersu

2. Uninstall SuperSU (Settings > Full unroot; if you get force closes or reboot, just ignore them and boot into recovery)

3. Boot into TWRP.

4. Dirty flash Cataclysm (Mod if possible, Stable if not).

5. Flash the system SuperSU from above.

6. Flash your custom kernel (optional).

7. Reboot and profit.

Problems with Layers? (systemless only)

NOTE: I tested this on SuperSU 2.65+. It may work on other versions; however, if it does, update to SuperSU 2.65 then test.

Layers has an issue with Busybox not being in /system/xbin. This should be fixed in a future update to the Layers Manager that does not require Busybox. If Busybox is installed in /system/xbin, Android Pay will not work. People recommend installing Busybox to /su/bin; however, Layers does not seem to recognize this if you use Stericson's version from the Play Store (as it does not properly uninstall from /system/xbin). I tested this process below and Layers works fine with Android Pay.

1. Make sure you are on a systemless version, preferably SuperSU 2.65 if possible.

2. Download and flash this special Busybox installer in TWRP (special thanks to [MENTION=4544860]osm0sis[/MENTION]).

3. Reboot and profit.

This installer will remove a previous version of Busybox from /system and install it to /su/xbin (then /su/bin if it can't do that) so that the binaries in /system/bin can function properly. This should allow Layers to work with systemless root.