1. Download our Official Android App: Forums for Android!

Root [HOWTO] / [GUIDE] Compile Loki_patch and execute credits to C13v3r0n3

Discussion in 'Android Devices' started by JJ_Azevedo, Jul 17, 2013.

  1. JJ_Azevedo

    JJ_Azevedo Android Enthusiast
    Thread Starter
    Rank:
    None
    Points:
    53
    Posts:
    270
    Joined:
    Apr 3, 2012

    Apr 3, 2012
    270
    42
    53
    Male
    California
    Okay first off this is not my guide i take no credit i just found this guide to help more devs make kernels and roms.


    Credits to C13v3r0n3 for this awesome guide and djrbliss for the amazing loki patch


    Heres the guide


    Things you will need:
    Cygwin- http://www.cygwin.com/setup.exe
    ADB- Android SDK | Android Developers
    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.
     

    Advertisement

  2. sammyz

    sammyz LG Whiz Kid
    Rank:
     #49
    Points:
    423
    Posts:
    8,840
    Joined:
    Jun 3, 2011

    Jun 3, 2011
    8,840
    2,500
    423
    Male
    Video Production
    Sunrise, Fl
    For that last command, make a recovery.lok by using
    Code (Text):
    1. ./loki_patch recovery aboot.img recovery.img recovery.lok
     
  3. roachdogg28

    roachdogg28 Member
    Rank:
    None
    Points:
    16
    Posts:
    82
    Joined:
    Mar 3, 2012

    Mar 3, 2012
    82
    5
    16
    I get how to use the loki patcher, and ive made a few boot.lok's, but can we use this and try to dirty port recoveries without destroying a phone?

    Im so tired of the 2ndinit, can we make a permanent solution like actual unlocked phones have?

    I thought i remembered seeing some made a loki recovery, it just wiped everything every time someone booted?
     
  4. roachdogg28

    roachdogg28 Member
    Rank:
    None
    Points:
    16
    Posts:
    82
    Joined:
    Mar 3, 2012

    Mar 3, 2012
    82
    5
    16
    wtf, i tried this anyway. Made a recovery.lok image from the cwm 6.x.x for the optimus l9, and flashed as per the readme, but absolutely nothing happened... booo, not even a brick!:D It said passed validation and flashing complete, but absolutely nothing changed.

    correction: i think i might be missing the factory reset operation during boot. the key sequence doesnt trigger it, but that may be due to the loki kerel.
     
  5. roachdogg28

    roachdogg28 Member
    Rank:
    None
    Points:
    16
    Posts:
    82
    Joined:
    Mar 3, 2012

    Mar 3, 2012
    82
    5
    16
    Anyone? I think it would really help us to have a proper recovery.
     
  6. Xt51

    Xt51 Android Enthusiast
    Rank:
    None
    Points:
    68
    Posts:
    465
    Joined:
    Dec 17, 2012

    Dec 17, 2012
    465
    101
    68
    Male
    Student
    Florida






    Missing the factory reset is bcus of that..maybe...here try this.
    Turn on your phone and hold the power button and volume down at the same time. It takes a while so just keep holding it
    Factory reset should come up. Just keep clicking yes(with power button) and it should take you to the CWM screen.

    Remember make a backup of everything first!
     
  7. roachdogg28

    roachdogg28 Member
    Rank:
    None
    Points:
    16
    Posts:
    82
    Joined:
    Mar 3, 2012

    Mar 3, 2012
    82
    5
    16
    Thanks for the response, that definitely did something. Unfortunately, my recovery didn't start up and it just wiped my data like i expected it would. I might try a couple different recoveries before i give up.
     
  8. GameTheory

    GameTheory Android Expert
    Rank:
     #26
    Points:
    743
    Posts:
    4,235
    Joined:
    Jul 23, 2012

Tags:

Share This Page

Loading...