Root is one of those Android Power User things lets you do all kinds of cool things. Unfortunately it usually involves unlocking the bootloader and installing an SU hack. This can mean wiping your device in the process. If you've got a Galaxy Nexus, some attention to detail, and are willing to take the risk, you can root your smartphone without OEM unlocking it (and wiping it in the process).
This comes to us from Efrant, Bin4ry, and some other talented folks at XDA Developers.
Step-by-step:
-
Assume the risk that this could break things
-
Download the files from the XDA article to your computer and unzip them
-
Open a command prompt with administrative privileges in that same directory
-
Copy the root files to your device:
adb push su /data/local/tmp/su adb push Superuser.apk /data/local/tmp/Superuser.apk
-
Restore the fake "backup".
Note: do not click restore on your device. Just enter the command into the command prompt on your PC and press the enter key.
adb restore fakebackup.ab
-
Run the "exploit"
adb shell "while ! ln -s /data/local.prop /data/data/com.android.settings/a/file99; do :; done"
-
Now that the "exploit" is running, click restore on your device.
-
Once it finishes, reboot your device. Note: Don't use your phone yet, this exploit reboots your phone into emulator mode which will be laggy with a flickering screen (or no display at all). This is normal.
adb reboot
-
Once rebooted, open a shell
adb shell
Check: Once you do step 8, your should have a root shell (your prompt should be #, not $). If it's not #, start again from step 4.
-
Mount the system partition as r/w
mount -o remount,rw -t ext4 /dev/block/mmcblk0p1 /system
-
Copy su to /system
cat /data/local/tmp/su > /system/bin/su
-
Change permissions on su
chmod 06755 /system/bin/su
-
Symlink su to /xbin/su
ln -s /system/bin/su /system/xbin/su
-
Copy Superuser.apk to /system
cat /data/local/tmp/Superuser.apk > /system/app/Superuser.apk
-
Change permissions on Superuser.apk
chmod 0644 /system/app/Superuser.apk
-
Remove the file that the exploit created
rm /data/local.prop
-
Exit the ADB shell ( You may have to type exit twice to get back to your command prompt.)
exit
-
Type the following
adb shell "sync; sync; sync;"
-
Reboot
adb reboot
-
Fire up your Terminal Emulator and type "su" to see if you're asked to allow superuser permissions. If you are, you're all done!
Note: If you still do not have root access after doing these steps, redo them and add this step between 10 and 11:
-
Change the owner of su
chown 0.0 /system/bin/su
(Note: in this video I messed up somewhere with one of the Superuser.apk steps. I used adb to re-push it, then picked up at step 13 again. This was cut from the video for clarity and time, but if you have a good eye and see my mistake, that's what happened, and how I corrected it.)
Source: XDA