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 v188.8.131.52, 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.184.108.40.206 for AT&T Galaxy S4 SGH-i337 – Link
Download TWRP v.220.127.116.11 for Verizon Galaxy S4 SCH-i545 – Link
Then use Terminal Emulator app and type:
dd if=/sdcard/Download/twrp-18.104.22.168-jflteatt.img of=/dev/block/mmcblk0p21
dd if=/sdcard/Download/twrp-22.214.171.124-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 v126.96.36.199, now you can install any Lollipop custom ROMs or even older KitKat ROMs too.
Credits – TWRP