[Verizon Samsung Galaxy S 4] HowardZ:
Loki was developed by Dan Rosenberg.

Loki is open source available here:

https://github.com/djrbliss/loki

You need the following files:

loki_patch (written by Dan Rosenberg)

recovery.img (the TWRP or CWM recovery image file)

loki.sh (linux script file - I don't know who wrote this - I got it years ago)

Make a DOS-like bat file which will run in a Dos-like window.

In Microsoft windows right click the bottom right corner, then run, enter cmd.

This opens a Dos-like window.

The bat file contains this:

adb push loki.sh /data/local/tmp/

adb push loki_patch /data/local/tmp/

adb push recovery.img /data/local/tmp/

adb shell chmod 777 /data/local/tmp/lok*

adb shell su -c '/data/local/tmp/loki.sh'

The loki.sh file contains this:

# Bootloader Version I337UCUAMDB (AT&T)

# Bootloader Version I337UCUAMDL (AT&T)

# Bootloader Version I545VRUAMDK (Verizon)

cat /proc/cmdline|egrep -q '(bootloader=I337UCUAMDB)|(bootloader=I337UCUAMDL)|(bootloader=I545VRUAMDK)'

if [ $? = 0 ];

then

# first lets back up stock recovery

dd if=/dev/block/platform/msm_sdcc.1/by-name/recovery of=/sdcard/recovery-stock.img

# patch and install cwm

cd /data/local/tmp

chmod 777 loki_patch

dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=aboot.img

./loki_patch patch recovery aboot.img recovery.img recovery.lok

dd if=recovery.lok of=/dev/block/platform/msm_sdcc.1/by-name/recovery

fi

---------- Post added at 06:12 PM ---------- Previous post was at 06:04 PM ----------

If you are using a Linux machine, all the work can be done on the Linux computer.

First you need to get the aboot.img file off of a real S4 Verizon phone:

$ adb shell

shell@android:/ $ su

shell@android:/ # dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img

shell@android:/ # chmod 644 /data/local/tmp/aboot.img

shell@android:/ # exit

shell@android:/ $ exit

$ adb pull /data/local/tmp/aboot.img

Now that you have the aboot.img file on the linux computer, just type this:

$ loki_tool patch recovery aboot.img recovery.img recovery.lok

the input file is recovery.img

the output file is recovery.lok

And either way that you create the recovery.lok file, you need to get it loaded onto the S4 verizon phone.

It used to be possible to use the Official TWRP app to find the recovery.lok file on the sdcard, and flash it into the recovery partition.

Unfortunately one needs to do it manually

$ adb shell

shell@android:/ su

shell@android:/ dd if=/sdcard/recovery.lok of=/dev/block/mmcblk0p21

or

shell@android:/ dd if=/sdcard/recovery.lok of=/dev/block/platform/msm_sdcc.1/by-name/recovery

If you type any of this wrong - even one character you might BRICK the phone. More likely you will be dusting off ODIN and reloading all the factory firmware again.

Spending hours loading MDK firmware, rebooting, loading the Prelease Kernel, running the motochopper exploit to get root, loading the regular MDK stock Kernel, getting a LOKI'd TWRP recovery installed, downloading the latest LineageOS zip file.

HOURS OF WORK, because TWRP maintainers won't add to their automated build procedure LOKI, and I forget things and make mistakes trying to do it myself.

---------- Post added at 06:24 PM ---------- Previous post was at 06:12 PM ----------

Here it is on my dropbox:

https://www.dropbox.com/s/tgswc5oqaywzk4e/loki.zip?dl=1

Remember - I do not know who wrote this.

I am not the author.

I do understand what it is doing.