How-To Software Technical

How To: Install CWM Recovery on AT&T Galaxy S4 – SGH-i337

Sometime ago I had rooted my Galaxy S4 (SGH-i337) to enabled WiFi Tethering because I wasn’t done testing the stock image from Samsung / AT&T. Now its time for me to prepare to install CyanogenMod; Before I can do so I need to install ClockworkMod Recovery (CWM) which is a replacement recovery option for Android devices, made by Koushik “Koush” Dutta. More info here.

While the boot-loader on AT&T’s Galaxy S4 is locked  there is a way to install the custom recover using the LOKI method created by one of the XDA Developers which bypasses the boot-loader check to enable the custom recover options and allow you to install ROM’s.

So a few things we need to start and I’ll provide steps that worked for me.

Phone must have been rooted before starting this process (as you will need to move files around in system directories that you can only access as root

You need to download the loki_flash form:  or from Github:

You will need to download the recover.lok for Galaxy S4 from:

Once downloaded use any file explorer that is able to be run as superuser – Example: Root Explorer (File Manager) and locate the two files you have just downloaded.

Select and copy the files loki_flash and recovery.lok to the following directory: /data/local/tmp

If not already installed download the Android Terminal Emulator and once at the command line type “su” without the quotes to elevate to superuser.

Once elevated in the terminal change directory by typing: cd /data/local/tmp | verify you are in the right location by typing “ls” without the quotes and you should see the files recovery.lok and loki_flash

In this directory (/data/local/tmp) type chmod 775 *

Now you will need to run the loki script by typing he following: ./loki_flash recovery recovery.lok | once this is run you will receive a successful message, you can then (when ready) type: reboot recovery in the Android Terminal.

Yeah, I made mistakes along the way. In the end it worked out.

Congratulations you now have ClockworkMod Recovery (CWM) and better yes the power to backup/restore ROMs and install custom ROMs such as CyanogenMod

To get back into recovery you have two methods:

  1. Access the Android Terminal Emulator and “su” into superuser and type: reboot recovery
  2. Power off your phone and power on again holding the volume up, center button and power button. Once you see a logo on the screen release the power button and continue to hold volume up, and the center button. Welcome back to the CWM Recovery Menu

20 replies on “How To: Install CWM Recovery on AT&T Galaxy S4 – SGH-i337”

Hi nice tutorial,
when I try to move the loki files to the data directory they dont seem to appear(even though it says “file copied to \data\local\tmp\”) and they dont show up in the emulator. Do I need special permission to add files to the data directory or is there another way of copying the files there?

Its very possible that your phone had already been patched against this as were many from the provider of your service.

Please have a look ever at: Max Lee aka @zedomax is a good guy, knows his stuff and provides lots of into on these phones.

I wish I had more info, but I can point you in a solid and trusted direction… Best of luck to you friend.

Ummm i have the device entitled but i cant do chomod 775 * so i do chmod 755 * also when i do ./loki_flash recovery recovery.lok it says the version of loki doesnt match my device

In the terminal i get as far as the part where i am supposed to enter “chomod 775 *” no quotes of course and it wont work…ive tried spaces no spaces some spaces…it just says not found…what am i doing wrong?

Hey there!

So every time I try typing in, “/data/local/tmp” to get to the files, my phone always says, “can’t execute: Is a directory 126”

What does that mean? Am I doing something wrong?

I have a SGH-I337 running 4.4.4

Any advice would be fantastic! Thanks!

hello sir i am Raghav Bhagwat from India,i have a samsung sgh i337(s4),i dont know how to install custom rom but i flashed wrong firmware from system recovery that rom installation faild.i do restart it showing samsung and a unlocked padlock,custom and not booting.then i flashed so much firmware and custom recovery in Odin that showing fail many many times.So my phone soft bricked,please help me what can i do.Also sorry for my english.And tell me then how can i install cwm recovery through system recovery.(no OS in phone.s4 at&t i337)

Any idea if this Loki method has any constraints for the GS4 to carry only specific builds? Mine is FNI1 and wanted to check before hand to stay SoftBrick-Immune.

Appreciate for sharing this.

Hello, I tried this this method on my at&t 1337 S4 running Lollipop 5.0 and when I try to run the loki script is gives me a message saying “error: only position independent executables (PIE) are supported.” What is the problem here?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.