[AT&T Samsung Galaxy S 4 Android Development] C13v3r0n3:
Things you will need:

Cygwin- http://www.cygwin.com/setup.exe

ADB- http://developer.android.com/sdk/index.html

Loki Patch source- https://github.com/djrbliss/loki

These are the steps i took to compile and use loki_patch.

I will assume you have the android sdk setup and ready, I will assume your SDK is under c:/AndroidSDK(this is how mine is setup)

Pulling aboot.img using adb:

You can copy cmd.exe into the folder where adb is located and run it from there so you do not have to navigate to the folder manually, or just run cmd.exe and navigate to the adb folder, for me it is c:\AndroidSDK\sdk\platform-tools.

Once you are in your adb file path and your phone is connected and in debug mode follow these instructions to pull aboot.img from your phone.

Original instructions from djrbliss here https://github.com/djrbliss/loki

dan@pc:~$ 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

dan@pc:~$ adb pull /data/local/tmp/aboot.img

3293 KB/s (2097152 bytes in 0.621s)

Now you should have the file aboot.img in the platform-tools folder(where the adb.exe file is located)

Copy this file to your desktop so you know where it is.

Installing gcc with Cygwin:

Original Instructions came from here http://www.eecg.utoronto.ca/~aamodt/ece242/cygwin.html

Step 0: Download and run the cygwin installer.

Step 1: Select “Install from Internet”

Step 2: Install to default location

Step 3: Use default local package directory (click next)

Step 4: Use whatever internet connection settings (click next)

Step 5: Select a mirror (use the one already selected, click next)

Step 6 (a): In the “Select Packages” expand “Devel”:

Step 6 (b): Select gcc, gdb, and make

Step 7: click next and follow the rest of the installation instructions.

Ok, now that gcc is installed we can compile the loki_patch source to make the executable.

Go here https://github.com/djrbliss/loki

You should see a file called loki_patch.c, click this link and it will open and you can see all the code.

Select the code from top to bottom and right click, copy.

Now right click on your desktop and select new> text file.

Open this text file and paste the code into it, go to file and save as loki_patch.c (make sure you have your file extensions turned on so you can save this as a c source and not a txt file).

We should now have a file called loki_patch.c on the desktop, keep it there for now.

Open up windows explorer and navigate to the following:

c:\cygwin\home\<username>\

(You will see a few files and a kitchen folder)

Create a new folder in here called compile.

Now, let's go back to the desktop and copy loki_patch.c and aboot.img and paste those into the compile folder you just created.

Go ahead and run cygwin.

Now we need to change directories, so let's type the following:

cd compile

We should now be in the compile folder.

Lets compile this code so we can use it, type the following command:

gcc loki_patch.c -o loki_patch

We should now have a file in the compile folder called loki_patch.exe( windows added this .exe, the file extension can be left alone or deleted)

Now you need a boot.img file to patch, grab one from a rom or kernal and copy this into the compile folder.

Once all the files are in the compile folder run the following command to patch the boot.img file:

./loki_patch boot aboot.img boot.img boot.lok

We should now have a boot.lok file in the compile folder, hope this helps and i hope i didnt leave anything out, i will try and update this with screen shots later.