[AT&T Samsung Galaxy S 4 General] xBeerdroiDx:
►►AT&T SGH-I337 USERS: DO NOT USE THIS FIRST GUIDE IF YOU ARE ON MF3 / MK2 FIRMWARE.◄◄

Please instead refer to Post #2 for MF3 & MK2 rooting and Safestrap Recovery installation processes.

This thread exists to keep all the necessary guides and material in one common place for the new users looking for the opportunity to do this right the first time. As always: Know what you're doing. Know what device model you have. Know your limits.

If followed correctly, this 5-step guide can be a useful tool. These steps are listed in the order in which they should be completed. The intent is to seamlessly root, backup and flash, leaving as little room for error as possible. This process will erase and/or reset everything on your device. All steps are assuming you have backed up your contacts, texts, pictures, videos, etc. I do not take credit for any of this material or information. This is all the work of great people that I have simply brought together. Cheers!​

**WARNING!** All information and attached links are for the I337 & I337M ONLY! No one here is responsible for anything that may happen to your device. Proceed at your own risk.​

>>>>>>Before you begin, make sure your S4 has USB Debugging Mode switched on<<<<<<​

Step 1: Read. Read. Succeed.

Your journey down the Android path of rooting and modding can be smooth, fun and educational, based on your attempt at learning everything you can before you begin. This is entirely up to you, the user. There is some excellent material here on XDA that I highly recommend reading over as part of step 1. Don't skip this information!

[GUIDE][INFO] The beginner's info thread (aka. the noob helper): This awesome guide by [MENTION=4316424]Rastabolino[/MENTION] is intended to be an all-in-one resource for the new user, covering all the basic material and XDA ground rules that everyone on this site should know.

Frequently Asked Questions: Need I say more? Just about every question asked on this forum is covered in this great little post by [MENTION=2978831]ronnie498[/MENTION]. This a short list of frequently asked questions on this device forum and the answers often given as a response. It should serve as a starting point for gathering knowledge and finding solutions to many common problems.

Step 2: Rooting Your Device

For those of you who want to get most out of your Galaxy S4, you will certainly want to root it. Rooting your I337 or I337M provides you as the user many, many benefits. That's why you're here right now reading this. You want it all.

Please note that there is always the chance of error during these processes. Bad or faulty USB cables, USB ports, bad/old device drivers on the computer, an active virus scanner. These are a few of the issues that can cause your device to fail to connect or prohibit a successful root/flash. Use good and original OEM USB cables. Uninstall any drivers you may have installed for Samsung Mobile Devices and disable your virus scanner.

AT&T/I337 Users: [ROOT[RECOVERY] Loki + TWRP + Motochopper CASUAL

The thread linked here is the work of [MENTION=3682533]AdamOutler[/MENTION], aptly named "CASUAL". Casual uses the exploit by [MENTION=4229979]djrbliss[/MENTION] and will guide you through the process. You will need to download and execute the CASUAL application then follow the onscreen instructions. After it is complete, you will have root access and Team Win's latest TWRP custom recovery installed.

Canadian/I337M Users: [SGH-I337M] CF-Auto-Root [CANADIAN MODELS ONLY]

The thread linked here is the work of [MENTION=631273]Chainfire[/MENTION] and will successfully provide root access on to your Galaxy S4. CF-Root is the root for "rooting beginners" and those who want to keep as close to stock as possible. CF-Root is meant to be used in combination with stock Samsung firmwares, and be the quickest and easiest way for your first root.

I337 & I337M Users: [Video Guide] How To Root Galaxy S4 I337 / I337m Easy & User Friendly

Additionally, here is great video guide by [MENTION=2470902]TheSmokingAndroid[/MENTION] which demonstrates the utilization of [MENTION=4229979]djrbliss[/MENTION]' Motochopper tool. This thread provides another easy rooting option for both the AT&T & Canadian S4 variants and will have you on your way in no time.

**

If you want to have root access only you can stop here

.**​

STEP 3: Installing A Custom Recovery

For those of you that did not have the option of installing a custom recovery during your root & unlock process, follow this next step to get one installed.

A recovery image is the system level software for your Android that lets you perform several maintenance and recovery tasks. The stock recovery image is quite limited in what it allows you to do and therefore, flashing a custom recovery image is required to gain full control of your device’s administration. A custom recovery image allows you to perform the following tasks:

- Wipe your phone’s data (Factory reset) and cache

- Make, restore and manage backups of your phone’s operating system and software

- Mount, unmount and format your phone’s internal as well as external storage partitions

- Install a custom ROM or application from a zip file to your phone

- Wipe Dalvik cache and battery statistics

- Make logs for error reporting and debugging

The 2 most common custom recoveries are listed here. Take your pick and download from the Play Store or check out some of the other custom recovery options in the Android Development section.

**ClockworkMod (CWM)**

1. Open Rom Manager and tap on Flash ClockworkMod Recovery option in the app.

2. You’ll be asked to select your device, select your device name.

3. As soon as you select the model, it should begin installing the recovery.

4. When it has done installing the recovery, you will get a message for the same on your screen.

*NOTE: I do not recommend Rom Manager as a tool to do anything

but just install and update ClockworkMod Recovery

Do not flash ROMs from Rom Manager.

**Team Win Recovery Project (TWRP)**

1. Once the download is complete launch Goo Manager.

2. On the top right of the screen there is the “options” menu.

3. Tap on options.

4. Then, click or choose the “Install OpenRecovery Script” option.

5. Select “yes” on the prompts that will follow. Now, the app will download and install TWRP Recovery on your S4

*NOTE: I do not recommend GooManager as a tool to do anything

but just install and update TWRP Recovery

Do not flash ROMs from Goo Manager.

Step 4: Making a Nandroid & EFS Backup

Making a nandroid will allow you to try out new ROMs while still keeping a safe backup in the event you experience issues during or after a custom OS or kernel installation. Be sure your device is fully charged before proceeding to the backup and flashing procedures.

If you are not already booted into recovery then do so now.

1. Power off your device.

2. Press and hold Volume Up + Home + Power buttons at the same time.

3. Release the power button when the device vibrates and you see the blue script in the top left corner

4. You are now in custom recovery.

5. In

CWM

go to Backup and Restore and select Backup. In

TWRP

select Backup. Name and select the options you want. Swipe to backup.

6. In

TWRP

, after the nandroid is finished, select "Name" and create a name for your EFS backup. Deselect everything except for EFS then swipe to backup.

7. After backup is finished, select reboot system now or stay in recovery to continue with this guide.

*NOTE: Be sure to save a copy of these backups to your computer and/or micro sd card. Having a recent backup saved to your computer and micro SD card can be useful if something happens to your phones internal memory.

Step 5A: Wiping Your Device

When flashing any ROM, it is always important to follow the proper wipe procedures in order for everything to function properly. There are various levels of wiping based on what sort of transition you may be making. In this guide, I will list the procedures for a full wipe, presuming that you are coming from the stock firmware and changing your OS completely. This is all assuming you have made the appropriate backups. ALWAYS perform the appropriate wipe before flashing a new ROM or update!

1. If you are not already in recovery, boot in now (Vol Up + Home + Power. Release the power button at vibrate and when you see the blue script in the top left corner).

In CWM:

2. Select Wipe data/factory reset

3. Select Wipe Cache

4. Select Advanced and Wipe Dalvik Cache

5. Select Mounts and Storage and format /system

6. If you are transitioning from 4.1 to 4.2 or 4.2 to 4.1, you must also format /data. You will lose all personal data so back it up first.

In TWRP:

2. Select Wipe

3. Select Factory Reset and wipe

4. Select System and wipe

5. If you are transitioning from 4.1 to 4.2 or 4.2 to 4.1, you must also select Data and wipe. You will lose all personal data so back it up first.

Step 5B: Flashing a Custom ROM

AT&T Users: First, check out this link by attn1. It will help provide some understanding of why we need a patch. Understand that with this device, any boot image or custom ROM you flash requires this patch. Pay attention to the thread you are browsing in to note if the developer has posted in the title or OP that the ROM or kernel has been Loki'd already. If the ROM or kernel you desire has been Loki'd, you may proceed with the download and flash in a custom recovery via the steps below. If the ROM or kernel has

not

been patched yet, download the loki-doki zip located in the link and flash it as directed. See the instructions below.

Once you have selected a ROM for your specific S4 model:

1. Download the ROM - If you are downloading a stock/TouchWiz-based ROM, Google Apps (gapps) will be included. If you are downloading an AOSP-based ROM, be sure to download the appropriate gapps as well.

2. From your PC, place the ROM/gapps on your internal or external SD card. Remember where they are.

3. Boot into custom recovery (Vol Up + Home + Power. Release the power button at vibrate and when you see the blue script in the top left corner).

4. Perform the wipe listed above if you have not already.

5. From the main recovery screen:

>>CWM - Choose the "install .zip from SD Card" or "install .zip from external SD card" option (depending on where you placed the files) then navigate to the ROM file, select it and confirm.

>>TWRP - Choose Install and locate the desired ROM on your internal or external SD.

►►► AT&T users, if you are flashing a custom ROM or kernel that has not been patched, repeat step 5 and flash the loki-doki.zip now ◄◄◄

6. If you need to flash gapps, repeat step 5 and select the gapps package.

7. Reboot system. It will take several minutes to load so be patient and don't worry. Once the phone is booted, let it sit for 5 minutes, reboot and enjoy!