Saturday, 2 June 2012

How to manually root almost any Android device


Yesterday, we talked about rooting your Android device and all the advantages root gives you. If that made you want to root, there are a couple ways you can go about it.
The easiest method is to use a one-click application solution like unrEVOked, but it only supports certain devices. SuperOneClick is a similar application that supports almost any device, but I cannot always get it to work with my computer.
In my experience, I have found that the most reliable root method is to simply run the commands yourself. It may be a little more difficult than the one-click solutions, but it is practically guaranteed to work.
Even so, you should still read through the directions before you begin, and if you are not comfortable with any of the steps, then you should probably not attempt to root. This is a fairly advanced tutorial, so make sure you're prepared for some bumps, even though there shouldn't be any.
Rooting gives you valuable experience with ADB, knowledge of root methods, and in general a better ability to solve problems with your device as well. Still, you do not need to do this if one-click solutions have worked for you, or if you do not feel comfortable with the process. If you do want to learn more about Android by manually rooting your device, just keep in mind that you root at your own risk, and any damage to your device is your fault.
Prerequisites
There are a few things that you need to have before you start rooting. Obviously, you will need an Android device with Android 1.5 or higher and a USB cable to connect it to your computer. You will also need to have some files from thisSuperOneClick .zip and the Android SDK/ADB up and running on your computer. If you are unfamiliar with ADB, our sister site GoodAndEvo has an awesome ADB tutorial that should get you up to speed.
First, we need to move some files around to make running commands a bit easier.
Unzip the SuperOneClick .zip and pull out the su-v3, busybox, Superuser.apk, psneuter, and GingerBreak files. Rename su-v3 to su, and place the files in your ADB Platform-tools directory, which is contained in the Android SDK folder on your computer.
If you are on Windows, you will also need to have proper drivers for your phone installed. These can usually be found by going either to the manufacturer website or searching for the name of your phone and the word "drivers." Once you find drivers, download and install them like any other application.
Rooting your device
Now that you have ADB setup and the proper exploit files, you are finally ready to root. Still, before you start running commands, you need to put your phone in USB debugging mode (settings > applications > development > enable USB debugging) and connect it to your computer.
With that out of the way, you can finally open command prompt to run some commands.
To open the command prompt in Windows, just click on Start, then Run, and type cmd.exe. In Linux, open whichever terminal emulator suits you. Once you have a command prompt, you need to enter your platform-tools folder, also called a directory. You can use the "cd" or change directory command to accomplish this. If your sdk folder is called "android-sdk" the command should look like this: cd android-sdk_r11-windows/platform-tools.
This command will leave you with a shell prompt in the platform-tools directory. From here, you can run the commands that will actually root your phone. Be sure to run these commands exactly as they are written. The commands with an "$" or "#" will only run after the "adb shell" command.
First, here are the commands that run the psneuter exploit and gain a root shell.
adb devices
adb push psneuter /data/local/tmp
adb shell
$ cd /data/local/tmp
$ chmod 777 psneuter
$ ./psneuter
At this point, the exploit will run and close the shell. You will need to run these commands to restart the ADB server.
adb kill-server
adb devices
Now comes the moment of truth. Use the
adb shell
command to open a shell. If you see a "#" sign, you have root access, so go ahead and continue to the next part of this tutorial. If not, you can go back and try the previous steps again, or ask for help in the comments.
We now need to make this root permanent. From the root shell you just opened, type the following commands.
# mount -o remount,rw -t rfs /dev/block/st19 /system
# exit
adb push busybox /system/bin
adb push su /system/bin
adb install Superuser.apk
adb shell
# chmod 4755 /system/bin/busybox
# chmod 4755 /system/bin/su
# mount -o remount,ro -t rfs /dev/block/st19 /system
# exit
adb reboot
At this point, your device should reboot. You can check for the Superuser icon in the app drawer, and then try a root only app like Titanium Backup. If that works, congratulations. You have successfully rooted your Android device. Prepare to enjoy all the benefits of root.
If you are having trouble with this tutorial or want to offer others a tip, please leave a comment and I will do my best to respond.

No comments:

Post a Comment