[Verizon Galaxy S 5 General] painiac:
Custom Recovery Environment

Due to the locked bootloader, the custom recovery environments such as TWRP (TeamWin Recovery Project) and ClockworkMod Recovery (CWM) cannot be used. However, hashcode created SafeStrap Recovery (a heavily modified TWRP recovery environment) that is safe to use on the S5.

A custom recovery is optional, but it's a powerful tool and safety net, allowing you to flash files (except Odin files), install ROMs, selectively wipe partitions, and create/restore full system backups (known as NANDroid Backups), among other things.

SafeStrap was originally conceived to allow ROMs to be installed in different "ROM Slots", allowing the stock OS to be untouched and easily swapped between. Unfortunately, hashcode abandoned SafeStrap development before the slots were ever made to work reliably. If you are still using the KitKat 4.4x version of SafeStrap, only flash ROMs to the "Stock" slot and pretend the other slots do not even exist.

hashcode's original SafeStrap thread - Use this if you are still on 4.4.x

If you are on Lollipop 5.x, hashcode's version of SafeStrap is functional, but requires a workaround so it is a bit of a hassle. SafeStrap will not function with a 5.0 kernel, so you most first either use Odin or the NI2Flasher.apk to flash an older 4.4.x kernel, then boot into SafeStrap. You must then flash your appropriate 5.0 kernel with Odin or from within SafeStrap BEFORE rebooting, or your phone will not be able to boot. Fortunately, jrkruse has modified SafeStrap Recovery to work smoothly on 5.0: it automates the process of the necessary kernel flashes ( and has several other small improvements, such as removing the non-functioning ROM slots).

jrkruse's updated SafeStrap for Lollipop - Use this if you are on 5.x

FlashFire: If you don't want to use SafeStrap for some reason, an alternative is Chainfire's "FlashFire" app. It is fully capable of doing most anything SafeStrap can do, without you having to boot into a custom recovery environment. The only real downside is that Flashfire is an app, so if your phone won't start up then you can't use it to restore a backup. You can selectively use both FlashFire and SafeStrap depending on the circumcstances.

Fixing a Bricked Phone

"Bricked" means a phone will not start and can no longer be used; in other words, it's as good as a brick. Fortunately, in almost every case the phone is not totally ("hard") bricked, but is only "soft" bricked and can be repaired fairly easily. If you are unable to load your operating system but you are seeing any kind of logo or splash screen, relax: you are only soft bricked, and the phone can be fixed bexcause you can still boot the phone into Download Mode and Recovery Mode.

If you've just flashed a file (such as a custom ROM) and the phone won't start, don't panic.

1) The first thing to try is to wait: if you've just flashed a deodexed ROM, it can take up to ten minutes to load and boot, and all you'll see is the splash screen. Let the phone sit for 10-15 minutes to see if it's just busy.

2) If the phone still won't boot, unplug the phone and pull out the battery, then re-insert it and try again.

3) If the phone STILL won't boot, pull the battery again, then reinsert it. Enter Recovery Mode by holding the Home + Volume UP + Power buttons at the same time until the phone says "Recovery Booting" at the top of the screen. From there, select "clear cache" and then reboot.

4) If the phone STILL won't boot, repeat step 3, but select "factory reset", then reboot. CAUTION: In case you're not clear on what "factory reset" means, you will lose all apps you have installed and all settings you have configured.

If you've flashed a kernel and the phone won't boot, you may have used a non-compatible kernel version. Flashing the same kernel version as your phone's firmware version will allow the phone to boot. After you boot into Recovery mode, you will see the firmware version listed at the top of the screen.

If all else fails, you can always boot into Download Mode by holding the Home + Volume DOWN + Power buttons, then use Odin to flash a Stock Restore image file. This will restore the phone to its factory state. CAUTION: To be clear: all of your apps and settings, and everything on the phone's internal storage will be deleted (but anything on your external SD card will not be affected).

Unbrick Image

: If you are unable to get into Download Mode, there is one thing you can try. There was a method developed (I believe) for the Galaxy S3 that also works on the S5.

1) First, you must obtain an Unbrick Image that has been created with the Unbrick Image Creator on a phone with the same version of firmware and bootloader as the one you're trying to restore. Use the forum search function to find the image you'll need (unless someone is willing to provide a permanent repository of unbrick images).

2) Rename that file to "unbrick_IMG.img", and use Win32DiskImager to flash that image file to a "16gb Class 10" MicroSD card.

3) Insert the Unbrick MicroSD card into the phone, and power it off by unplugging it and removing the battery.

4) Re-insert the battery, then boot into download mode by holding the Home + Volume DOWN + Power buttons.

5) Now connect with Odin and flash a factory restore image.

JTAG: If your phone is truly bricked, you have one last possible recourse. There is a hardware tool called a JTAG that may be able to help you. It's a fairly expensive piece of hardware, but some repair places offer a one-time JTAG repair for a modest fee.

ROOTING 4.4.x and 5.x

As of mid-January 2016, root has now been achieved on every firmware version from NCG all the way to PB1.

Root access is simply a configuration within the operating system that allows one write access to protected system files. This is HUGELY powerful, allowing one to modify or delete system apps or alter how they function. If you are not very computer literate, you may want to pass on rooting until you've learned more. If you don't know what you are doing, it's possible to do some damage to your phone's configuration (possibly rendering it unusable to you, at least until you learn how to repair it). It can be dangerous to play outside the boundaries of User Space. Here there be monsters...

Note that although we have root access, the Bootloader is still locked and is extremely likely to remain so indefinitely. The bootloader is booby-trapped with a hardware "qfuse": attempts to alter the bootloader result in a hard-bricked phone, which effectively dissuades developers from messing with it. Fewer and fewer developers care about this phone, anyway, and have moved on to brands that are less hostile to power users.

Root Kitkat 4.4.2 or 4.4.4 (uses TowelRoot after temporarily downgrading kernel to NCG)

Update from rooted 4.4.x to 5.0 and Keep Root

Root Lollipop 5.0 (uses KingRoot)

Busybox: Android is a gutted variant of the Linux operating system, stripped down to only those functions needed to run a smartphone. Busybox adds back in a lot of the linux/unix functions and commands that were removed. You'll need this once you root if you want to be able to do anything really useful.

Custom ROMs

With a rooted phone, it is possible to install a customized version of the operating system, which is known as a "ROM". These range from rooted Stock ROM, mildly to heavily debloated versions of the Stock ROM, to more heavily customized and themed ROMs.

Unfortunately, because the bootloader on the Verizon S5 is locked, it is only possible to choose from a small selection of TouchWiz-based ROMS. Cyanogenmod (and all the various AOSP-based ROMs) require a different kernel: if you try to use a non-TouchWiz based kernel, the locked bootloader will not allow it to boot.

Only install ROMS found in the Verizon Galaxy S5 Android Development section of the forum.

The Verizon "Developer Edition" S5 comes with an unlocked bootloader, so on that device you CAN run non-TouchWiz ROMs.

As of March 2016 an unlock method for one of the two possible bootloaders has been discovered and exploited, essentially allowing you to turn your phone into a Dev Edition. To determine if your model is unlockable, you need to check the eMMC version. Do this by using a file explorer to browse to /sys/block/mmcblk0/device/cid. The CID file will contain a string of characters: if the first two digits are 15, your phone has the Samsung chip that is unlockable. If the first two digits are 11, your phone has the Toshiba chip and is NOT unlockable.

Odexed vs De-Odexed: You will also see in a ROM's description if it is "odexed" or "de-odexed". This is referring to how all of the applications on the phone are packaged.

An ODEXED application is one where parts of it have been "optimized" in a separate file (with the file extension .odex). This makes the application take up a little less storage apace and also load a little more quickly. However, because the parts of the app are packaged separately, it makes it harder to alter that application on-the-fly (such as theming or modifying the way it behaves).

A DEODEXED application is one where this optimization has been undone. This is necessary for theming or other modifications, and the space and speed difference is probably not really noticeable. If you plan to do any theming or on running Xposed framework, you should install the DEODEXED version of your chosen ROM.

The basic procedure for installing a custom ROM:

1) Boot into SafeStrap Recovery

2) Make a NANDroid backup of your current system, saved to the MicroSD card. If something goes wrong, you can easily restore to where you are now.

3) Wipe cache, dalvik cache, and system partitions.

4) Install your chosen ROM (which will be a .zip file)

5) Install any optional modification zips included and compatible with that particular ROM

6) Wipe cache

7) Reboot

jrkruse goes into much more detail for installing Lollipop ROMS here

Always do a full system wipe from SafeStrap before installing a ROM, or you will have many problems with conflicting settings and system files. Wiping first is known as a "clean flash". The only exception is if you are updating to a newer version of the same ROM, in which case it may be successful to do a "dirty flash", where settings files are unlikely to have changed enough to cause conflicts.

Likewise, never restore "system" apps with Titanium Backup or anything else unless you're on exactly the same version of the OS, because this is almost certain to try to configure those system apps in ways they can no longer function. Doing so will introduce strange problems that can be very difficult to troubleshoot.

If something goes catastrophically wrong, you can always get back to a factory state with Odin, root, install SafeStrap, and restore your NANDroid backup (provided you saved it to the external SDcard like I instructed you, rather than wiping it into oblivion with a ROM flash).

Debloating

Once rooted, you can remove a lot of the bloatware from your phone. It is possible to just uninstall or delete unwanted bloatware, but this can cause problems if you unknowingly remove something that was required for something else to work.

The safest option is to use Titanium Backup to "freeze" the undesirable apps. Then run your phone normally for a few days to make sure everything is functional. Once you're sure an app is safe to delete, you can then do so, or you can just leave it frozen. If it turns out you need to re-enable a frozen app, just "defrost" it in Titanium Backup.

Disabling KNOX

If you choose to use a Stock ROM after rooting, you will want to disable a few things: Knox, security update notifications, and the Verizon Over-the-Air updater.

Use Titanium Backup to freeze the following system apps:

com.sec.enterprise.knox.attestation

com.sec.knox.eventsmanager

KLMS Agent

KNOX

Knox Notification Manager

KNOX Store

Security policy updates SPD_v2_1402_4_1 (Security update notification)

SDM 1.0 (Verizon OTA update)

Xposed Framework and Modules

I won't go into a lot of detail here at this point. Just a few notes. I'll probably flesh this out more later and list my favorite modules.

In order for Xposed to function, you must be using a DEODEXED version of your ROM.

Xposed is awesome, and you should look into using it. I've been using the GravityBox module, and it allows me to get most of the little features I've previously enjoyed in custom ROMs.

Xposed installer for Lollipop

The specific Xposed framework you need to use for S5 Lollipop

Xposed bootloop: If you install an incompatible Xposed module, the worst case is a bootloop. You fix that by getting into Safestrap, choosing file explorer, and creating a file called "disabled" in /data/data/de.robv.android.xposed.installer/conf/

Alternately, there's a flashable zip file somewhere that puts the "disabled" file where it needs to be.

Then you reboot, get into Xposed and turn off the offending module. Then use a file explorer to go delete that "disabled" file and reboot.