Info 2 [GUIDE][RECOVERY+LOKI][D800] How to flash CWM 6.0.4.4 the right way with loki_tool

The following guide should work for all loki-locked bootloaders, but I can only confirm that it worked on my D800. The problem I was having, was that loki_flash has been replaced with loki_tools, and there arent any guides out for loki_tools.
The right way to flash CWM requires you to generate your own recovery.lok from the aboot.img, and recovery.img (CWM) which you need to use loki_tools for.

PREREQUISITES
  1. Device must be rooted
  2. Device must be in Developer Mode
  3. USB Debugging turned ON
  4. Debugging RSA Signature must be accepted
  5. Download CWM HERE
  6. Download loki_tool HERE
  7. Download ADB HERE

STEP 1 (Getting Files)

  • Follow this GUIDE to install ADB and FASTBOOT, once its complete, you will have adb installed to C:\adb
  • Download CWM, rename the file to 'recovery.img' (so its easier to work with) and move it to C:\adb
  • Download loki_tool and extract the file 'loki_tool' from the bin folder and place it in C:\adb

STEP 2 (Preparing for the Procedure)

  • Plug in your phone to the computer
  • In Windows Explorer, navigate to C:\
  • Shift+Right Click on the 'adb' folder, select 'Open command window here'
  • Type "adb devices" you should see:
Code:
Select Code
C:\adb>adb devices
List of devices attached
<devid>        device
If not, go back and turn on Develper Mode, USB Debugging, and accept the RSA Signature

STEP 3 (Flashing process)

(note: I copied everything from the cmd prompt and edited it as a text file before thinking to post my procedure here, thats why it looks different)

In ADB type the following commands each step is commented out with what it does (someone could make it into a bat, but I'm too lazy.

Code:
Select Code
// Sending recovery.img to device
C:\adb>adb push recovery.img /data/local/tmp/recovery.img
---------------
3456 KB/s (10510336 bytes in 2.969s)
---------------

// Sending loki_tool to device
C:\adb>adb push loki_tool /data/local/tmp/loki_tool
---------------
2777 KB/s (379248 bytes in 0.133s)
---------------

// entering Android Linux environment
C:\adb>adb shell

// sudo
shell@android:/ $ su

// generating aboot.img
root@android:/ # dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img
---------------
2048+0 records in
2048+0 records out
1048576 bytes transferred in 0.072 secs (14563555 bytes/sec)
---------------

// changing permissions on aboot.img
root@android:/ # chmod 644 /data/local/tmp/aboot.img

// exiting Android Linux environment
root@android:/ # exit
shell@android:/ $ exit

// saving aboot.img locally in case you need it again.
C:\adb>adb pull /data/local/tmp/aboot.img
---------------
2992 KB/s (1048576 bytes in 0.342s)
---------------

// entering Android Linux environment
C:\adb>adb shell

// changing directory
shell@android:/ $ cd /data/local/tmp

// ls should list the following 3 files, if not, you are missing them and need to push them, or generate another aboot.img
shell@android:/data/local/tmp $ ls
---------------
aboot.img
loki_tool
recovery.img
---------------

// changing the permissions of the files so loki_tool can use them
shell@android:/data/local/tmp $ chmod 755 /data/local/tmp/loki_tool
shell@android:/data/local/tmp $ chmod 755 /data/local/tmp/recovery.img

// executing loki_tool to generate the recovery.lok file
shell@android:/data/local/tmp $ ./loki_tool patch recovery aboot.img recovery.img recovery.lok
---------------
Loki tool v2.1
[+] Detected target AT&T LG G2 build D80010o
[+] Original kernel address: 00008000
[+] Original ramdisk address: 05000000
[+] Writing device tree.
[+] Output file written to recovery.lok
---------------

// exiting Android Linux environment
shell@android:/data/local/tmp $ exit

// Saving recovery.lok locally in case you need it again
C:\adb>adb pull /data/local/tmp/recovery.lok
---------------
2939 KB/s (10512384 bytes in 3.493s)
---------------

// entering Android Linux environment
C:\adb>adb shell

// sudo
shell@android:/ $ su

// changing directory
root@android:/ $ cd /data/local/tmp

// flashing recovery.lok with loki_tool
root@android:/data/local/tmp # /data/local/tmp/loki_tool flash recovery /data/local/tmp/recovery.lok
---------------
Loki tool v2.1
[+] Loki validation passed, flashing image.
[+] Loki flashing complete!
---------------

// exiting Android Linux environment
root@android:/data/local/tmp # exit
shell@android:/ $ exit

// reboot device into recovery
C:\adb>adb reboot recovery
---------------------------------
At this point your device should reboot into CWM, Congrats!