[HOW TO] [MDK] LOKI ANY recovery.img FILE - Verizon Samsung Galaxy S 4

THIS IS MY FIRST THREAD IN A DEVELOPMENT SECTION - forgive me if I do something wrong, or if the subject has already been discussed.
It took me a while to figure this out, and I hope it helps others.
I SHALL DESCRIBE HOW TO LOKI ANY recovery.img FOR USE ON VERIZON SAMSUNG GALAXY S4 MDK PHONE.
Clockworkmod posts new recovery img files for our phone here:
http://www.clockworkmod.com/rommanager
However these recovery image files are not LOKI patched yet.
First one must create an aboot.img file from the phone.
This is something which must be run on the rooted phone.
It is basically two lines:
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img
chmod 644 /data/local/tmp/aboot.im
Then once the aboot.img file has been created, it needs to be copied up to your Ubuntu-Linux PC.
One needs the "loki_patch-lilnux-x86_64" executable file available from the github:
https://github.com/djrbliss/loki
Then the command to read a recovery.img file and create a loki version is:
./loki_patch-linux-x86_64 recovery aboot.img recovery.img recovery_loki.img
The following is a shell file for performing the above work with ample comments about the procedure:
# run_getAboot.sh
# Purpose: create a aboot.img file on the Verizon S4 phone
# to then be copied back to the linux PC
# so a kernel or recovery can be loki patched.
#
# This shell file must be:
# Copied to the Verizon S4 into folder /data/local/tmp
# for example from linux pc : adb push run_getAboot.sh /data/local/tmp
# Give it executable priviledges - I did this using ES File Explorer
# Run it from "Terminal Emulator"
# su
# ./run_getAboot.sh
#
#
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img
chmod 644 /data/local/tmp/aboot.im
#
# After this, the aboot.img file should be copied back to the linux pc
# for example from linux pc: adb pull /data/local/tmp/aboot.img aboot.img
# One then gets the loki_patch-linux-x86_64 file from the loki-doki github
# The github is located here: https://github.com/djrbliss/loki
# look under the "bin" folder.
# Now a recovery can be loki-doki modified.
# We now have the aboot.img created from the Verizon S4 phone,
# and we have a recovery.img which needs to be loki modified.
# The following command will create the recovery_loki.img file:
# ./loki_patch-linux-x86_64 recovery aboot.img recovery.img recovery_loki.img
#
# The recovery_loki.img file can be installed on the Verizon S4 phone.
#
Now, I also wanted to make a ZIP file which a custom recovery can run to LOKI and install a non-loki recovery.img file.
The LOKI operation will be performed while the ZIP file is being installed.
I used the following loki-doki.zip file as an example found here:
http://rootzwiki.com/topic/41841-lo...tom-boot-image-on-att-and-verizon-galaxy-s-4/
I added CWM touch version 6.0.4.4 recovery.img file, and modified the script to LOKI the recovery.img file rather than the currently installed kernel/boot.
Here is my completed sample zip file: https://db.tt/xLi6c4dd
When a new version of a recovery becomes available, one just renames it recovery.img and replaces the recovery.img file which is in the zip file. Then one can flash to the new version of the recovery.
The script in this zip file will only work on I337UCUAMDB, I337UCUAMDL, and I545VRUAMDK bootloaders.
Credits to: attn1 at rootzwiki for the ZIP file which I modified.
and of course to drjbliss's LOKI github https://github.com/djrbliss/loki

Rom Manager app also does it. GooManager only does TWRP

loonie01 said:
Rom Manager app also does it. GooManager only does TWRP
Click to expand...
Click to collapse
Last time I checked, Rom Manager will not LOKI and install the touch version for free - even though the unLoki'd img file is available for free from the website.

Yeah not for free
Sent from my SCH-I545 using Tapatalk

HowardZ said:
THIS IS MY FIRST THREAD IN A DEVELOPMENT SECTION - forgive me if I do something wrong, or if the subject has already been discussed.
It took me a while to figure this out, and I hope it helps others.
I SHALL DESCRIBE HOW TO LOKI ANY recovery.img FOR USE ON VERIZON SAMSUNG GALAXY S4 MDK PHONE.
Clockworkmod posts new recovery img files for our phone here:
http://www.clockworkmod.com/rommanager
However these recovery image files are not LOKI patched yet.
First one must create an aboot.img file from the phone.
This is something which must be run on the rooted phone.
It is basically two lines:
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img
chmod 644 /data/local/tmp/aboot.im
Then once the aboot.img file has been created, it needs to be copied up to your Ubuntu-Linux PC.
One needs the "loki_patch-lilnux-x86_64" executable file available from the github:
https://github.com/djrbliss/loki
Then the command to read a recovery.img file and create a loki version is:
./loki_patch-linux-x86_64 recovery aboot.img recovery.img recovery_loki.img
The following is a shell file for performing the above work with ample comments about the procedure:
# run_getAboot.sh
# Purpose: create a aboot.img file on the Verizon S4 phone
# to then be copied back to the linux PC
# so a kernel or recovery can be loki patched.
#
# This shell file must be:
# Copied to the Verizon S4 into folder /data/local/tmp
# for example from linux pc : adb push run_getAboot.sh /data/local/tmp
# Give it executable priviledges - I did this using ES File Explorer
# Run it from "Terminal Emulator"
# su
# ./run_getAboot.sh
#
#
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img
chmod 644 /data/local/tmp/aboot.im
#
# After this, the aboot.img file should be copied back to the linux pc
# for example from linux pc: adb pull /data/local/tmp/aboot.img aboot.img
# One then gets the loki_patch-linux-x86_64 file from the loki-doki github
# The github is located here: https://github.com/djrbliss/loki
# look under the "bin" folder.
# Now a recovery can be loki-doki modified.
# We now have the aboot.img created from the Verizon S4 phone,
# and we have a recovery.img which needs to be loki modified.
# The following command will create the recovery_loki.img file:
# ./loki_patch-linux-x86_64 recovery aboot.img recovery.img recovery_loki.img
#
# The recovery_loki.img file can be installed on the Verizon S4 phone.
#
Now, I also wanted to make a ZIP file which a custom recovery can run to LOKI and install a non-loki recovery.img file.
The LOKI operation will be performed while the ZIP file is being installed.
I used the following loki-doki.zip file as an example found here:
http://rootzwiki.com/topic/41841-lo...tom-boot-image-on-att-and-verizon-galaxy-s-4/
I added CWM touch version 6.0.4.4 recovery.img file, and modified the script to LOKI the recovery.img file rather than the currently installed kernel/boot.
Here is my completed sample zip file: https://db.tt/xLi6c4dd
When a new version of a recovery becomes available, one just renames it recovery.img and replaces the recovery.img file which is in the zip file. Then one can flash to the new version of the recovery.
The script in this zip file will only work on I337UCUAMDB, I337UCUAMDL, and I545VRUAMDK bootloaders.
Credits to: attn1 at rootzwiki for the ZIP file which I modified.
and of course to drjbliss's LOKI github https://github.com/djrbliss/loki
Click to expand...
Click to collapse
Thanks for this. Came in handy today.

Related

Checksum proof that RUU OTA = 2.1 Leak v3

I have currently been testing the method of rooting leaked 2.1 phones. There was a little discussion running in that thread (and other threads, I've found) that poses the question whether or not the RUU is the same as 2.1 Leak v3.
The RUU I'm using is referenced here: http://forum.xda-developers.com/showthread.php?t=695667 -- which can be found here: http://shipped-roms.com/shipped/Des...WWE_2.36.605.1_release_signed_with_driver.exe
Leak 2.1 v3 I'm using is referenced here: http://androidforums.com/htc-droid-eris/69688-htc-droid-eris-os-2-1v3-download.html -- which can be found here: http://www.mediafire.com/?qymwuzug5gl
So, the process that I've been using to root these phones involves flashing the RUU OTA onto the phone. With some help from user bftb0, I have taken the time to do the analysis.
How did I get system.img and boot.img off of the RUU OTA, you might ask? Well, after I flashed the RUU OTA onto the phone, I went through the Incredible/Slide root method to root the phone I'm working with (without changing any phone settings within Sense). After getting adb to recognize the device in recovery, I took the steps necessary to flash Amon_RA's recovery. I then took a Nandroid backup of my phone, and extracted the system.img and boot.img files off of the SD card where the Nandroid backup was stored.
Then, I used unyaffs to unpack system.img into 2 separate directories, and used split_bootimg.pl to unpack boot.img
so, for split_bootimg.pl I did this, starting at the directory where each respective boot.img file is
Code:
$ mkdir unpak
$ cd unpak
$ split_bootimg.pl ../boot.img
... [output] ...
$ mkdir ramdisk
$ cd ramdisk
$ gunzip -c ../boot.img-ramdisk.gz | cpio -i
The test after it's unpacked
Code:
#!/bin/bash
mydir=`pwd`
for tree in leakv3 RUU ; do
cd $tree
touch ./md5sigs
find . -type f -print | while read fnam ; do md5sum $fnam >> ./md5sigs ; done
cd $mydir
done
cat leakv3/md5sigs RUU/md5sigs | sort | uniq -u
Code:
$ ./md5test.sh
6951ac78e8f9ae5e6c4c4cb50803fed9 ./bin/su
9512ebf90efee5ea996ec59456cf4b03 ./md5sigs
c6212fa45ab99c3a5d731bca06184023 ./md5sigs
This output should be expected; we should expect the su executable to be in one and not the other if I've rooted it, and the md5sigs that the script creates are not going to have the same md5sums
Pastebins for both the leak v3 list of md5sums, and RUU list of md5sums
Leak v3 md5sigs pastebin: http://pastebin.com/PGZDbC1r
RUU OTA md5sigs pastebin: http://pastebin.com/qz5z0Vdr
Conclusion: They are identical

[Q] Flashing Custom Recover Image Error

C:\Users\Ryan>cd
C:\Users\Ryan
C:\Users\Ryan>cd\AndroidSDK\tools
C:\AndroidSDK\tools>adb devices
List of devices attached
HT02TL900527 device
C:\AndroidSDK\tools>adb shell flash_image recovery /sdcard/recov1.img
error opening /sdcard/recov1.img: No such file or directory
I keep getting this error, but the file is in the root. Any help much appreciated
Flash it via Better Terminal Emulator
Code:
$ su
# flash_image recovery /sdcard/recovery-RA-hero-v1.7.0.1.img
Its for latest recovery .. if you flashing old one then change name .Also if you flashing the new recovery then Update.zip file is available flash it via recovery menu for more info see here: - [Recovery ROM] [15-August-2010] RA-hero-v1.7.0.1

[Q] Cannot install custom recovery on LG G2 (D802)

I have successfully rooted my LG G2 (D802).
But I can't seem to install a custom recovery (CWM, TWRP).
I tried following these steps:
Download openrecovery-twrp-2.6.3.2-g2d802.img
Save it in the IORoot folder (v25) as "recovery.img"
Download loki_flash file from Github bin folder, place in IORoot folder.
In the IORoot folder, hold shift, right click, and open terminal and type in the following lines one at a time:
Code:
adb push loki_tool /data/local/tmp/loki_tool
adb push recovery.img /data/local/tmp/recovery.img
adb shell
su
cd /data/local/tmp
chmod 777 loki_tool
./loki_tool flash recovery /data/local/tmp/recovery.img
exit
exit
adb reboot recovery
But it gave the following error:
Code:
Loki tool v2.1
[-] Loki aboot version does not match device.
1|[email protected]:/data/local/tmp # exit
1|[email protected]:/ $
So I tried another method. I installed the "freegee" app from google play, but when it opens, it says "Your devices specific software version of D80220d is not currently supported".
What do I need to do to load a custom recovery?
Going to my phone's settings > About phone shows the following:
Model number: LG-D802
Android version 4.4.2
Kernel version 3.4.0
Build number: KOT49I.D80220d
Software version: D80220d-EUR-XX
All I had to do was install AutoRec.
http://forum.xda-developers.com/showthread.php?t=2715496

[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​
Device must be rooted
Device must be in Developer Mode
USB Debugging turned ON
Debugging RSA Signature must be accepted
Download CWM HERE
Download loki_tool HERE
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:
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:
// 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
[email protected]:/ $ su
// generating aboot.img
[email protected]:/ # 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
[email protected]:/ # chmod 644 /data/local/tmp/aboot.img
// exiting Android Linux environment
[email protected]:/ # exit
[email protected]:/ $ 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
[email protected]:/ $ 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
[email protected]:/data/local/tmp $ ls
---------------
aboot.img
loki_tool
recovery.img
---------------
// changing the permissions of the files so loki_tool can use them
[email protected]:/data/local/tmp $ chmod 755 /data/local/tmp/loki_tool
[email protected]:/data/local/tmp $ chmod 755 /data/local/tmp/recovery.img
// executing loki_tool to generate the recovery.lok file
[email protected]:/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
[email protected]:/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
[email protected]:/ $ su
// changing directory
[email protected]:/ $ cd /data/local/tmp
// flashing recovery.lok with loki_tool
[email protected]:/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
[email protected]:/data/local/tmp # exit
[email protected]:/ $ exit
// reboot device into recovery
C:\adb>adb reboot recovery
---------------------------------
At this point your device should reboot into CWM, Congrats!
I know it's been 7 years, but this helped me get Magisk working on a locked bootloader. Thanks!
Platypus Enthusiast said:
I know it's been 7 years, but this helped me get Magisk working on a locked bootloader. Thanks!
Click to expand...
Click to collapse
I'm getting a "
Platypus Enthusiast said:
I know it's been 7 years, but this helped me get Magisk working on a locked bootloader. Thanks!
Click to expand...
Click to collapse
I keep getting "failed to find function to patch" error. Any thoughts?
Jackspsychosis said:
I'm getting a "
I keep getting "failed to find function to patch" error. Any thoughts?
Click to expand...
Click to collapse
I can do it for you if you like. I just need the aboot.img and the boot.img (or recovery.img) you're trying to patch.
Could I use this method to put a recovery on my lg g2 d802 (lollipop) on which it seems not to be any recovery (no command, when I press power+vol. down buttons) ?
TapaSte said:
Could I use this method to put a recovery on my lg g2 d802 (lollipop) on which it seems not to be any recovery (no command, when I press power+vol. down buttons) ?
Click to expand...
Click to collapse
I'm not sure if this is a good source, but maybe this might work:
Recovery Mode LG D802 G2, how to - HardReset.info
The Recovery mode it is the hidden feature which will enable a lot of useful operation.
www.hardreset.info
Platypus Enthusiast said:
I'm not sure if this is a good source, but maybe this might work:
Recovery Mode LG D802 G2, how to - HardReset.info
The Recovery mode it is the hidden feature which will enable a lot of useful operation.
www.hardreset.info
Click to expand...
Click to collapse
Like said, I've not recovery and if I press volume down + power I get "no command" screen.

Checking file permissions in ramdisk during device boot

Hi, I'd like to ask a general question about device boot. I've made some changes in init.rc and I packed again boot.img. While debugging, I would need to check permissions of some files in ramdisk root directory in order to see if they are accessible for reading and/or execution.
How could I get this info by adb during device boot before that /system partition is mounted? Any ideas?
Solved
I've found a way to perform this task. It's possible to use busybox ls command inside a shell script (placing busybox binary and shell script into ramdisk root directory of boot.img) and run the script by busybox ash command from init.rc, redirecting the output to a logfile. The command inside shell script should look like as the following:
Code:
/busybox ls -l / >> /path/to/my/logfile.txt 2>&1
(That way, stderr and stdout will be redirected to a log file, that can be pulled down by adb pull command)

Categories

Resources