This tutorial is for those of you with Loki’d unlocked bootloader on the AT&T SGH-i337 or Verizon SCH-i545, DO NOT FOLLOW THIS GUIDE IF YOU HAVE ANDROID 4.3 OR HIGHER ON AT&T OR VERIZON. If you already have CWM or TWRP recovery installed, that means you can follow this guide. If you have Safestrap recovery, that means your phone is on the locked bootloader so DO NOT FOLLOW THIS GUIDE!
If you want to install latest Lollipop AOSP ROMs like CM12 or CM12.1, you will need to upgrade your recovery to latest TWRP recovery, I recommend TWRP v2.8.4.0, which I have tested is very stable and also lets you automatically mount to your computer as MTP or connect your flash drives via USB flash drives.
To install, you will need a rooted AT&T or Verizon Galaxy S4, then download the following TWRP image files onto your phone:
Download TWRP v.2.8.4.0 for AT&T Galaxy S4 SGH-i337 – Link
Download TWRP v.2.8.4.0 for Verizon Galaxy S4 SCH-i545 – Link
Then use Terminal Emulator app and type:
su
For AT&T:
dd if=/sdcard/Download/twrp-2.8.4.0-jflteatt.img of=/dev/block/mmcblk0p21
For Verizon:
dd if=/sdcard/Download/twrp-2.8.4.0-jfltevzw.img of=/dev/block/mmcblk0p21
DO NOT USE FLASHIFY, IT WILL BRICK YOUR PHONE as recovery for Loki’d devices are different.
That’s it, try rebooting into recovery and you should have latest TWRP v2.8.4.0, now you can install any Lollipop custom ROMs or even older KitKat ROMs too.
Credits – TWRP