当前位置: > Ubuntu >

How to root an Android device under Ubuntu

时间:2016-05-08 22:16来源:linux.it.net.cn 作者:IT

I have found a lot of tutorials on this subject, but none really supported Android x86 devices, so I decided to write my own here which will support both ARM and x86. If you have an android phone or tablet, you have an ARM CPU, and if you have a virtual android device (or have android installed on your computer), you have an x86 CPU. Notice that you are on your own with rooting. I can try to help, but I cannot guarantee that it will work 100% (it might even break your device). Good luck!

Prerequisites:

  • Superuser (download the appropriate version, either ARM or x86): http://androidsu.com/superuser/
  • Psneuter: x86 version: http://ompldr.org/iaGRpOA, ARM version: http://ompldr.org/iaGRpOQ
  • An android device (obviously)

First, open up your android device and navigate to Settings -> Applications -> Development, and make sure USB Debugging is on. Next, connect your android device to your computer (if it isn’t already), but make sure you do NOT mount it. If it’s a virtual device, you don’t have to worry about it. Connect your android device with ADB, and type these commands in the terminal (of your computer, not the android device, replacing “path/to/directory/X/is/located” with the actual directory where X is located):

 

[plain] view plain copy
 
  1. cd path/to/directory/psneuter/is/located  
  2. adb push ./psneuter /data/local/tmp/  
  3. cd path/to/directory/superuser/is/located  
  4. mkdir superuser  
  5. cd superuser  
  6. unzip ../Superuser-*.zip  
  7. adb push ./system/app/Superuser.apk /data/local/tmp/Superuser.apk  
  8. adb push ./system/bin/su /data/local/tmp/su  



We just uploaded everything we need to the android device (under a temporary directory). Now it’s time to root it! If you are using Android x86, press ALT+F1 and type the commands there instead of on the host machine. If you are not using it, first type this in the host machine’s terminal (it will simply engage a shell with your phone/tablet):
[plain] view plain copy
 
  1. adb shell  


Enter these commands:
[plain] view plain copy
 
  1. cd /data/local/tmp  
  2. chmod 755 psneuter  
  3. ./psneuter  


On the host machine (yes, this is both for x86 and non-x86), connect to the android device using ADB, and type these commands:
[plain] view plain copy
 
  1. adb shell  
  2. busybox ash  
  3. mount -o remount,rw /dev/block/mtdblock0 /system  
  4. cp /data/local/tmp/su /system/bin/su  
  5. chmod 6755 /system/bin/su  
  6. cp /data/local/tmp/Superuser.apk /system/app/Superuser.apk  
  7. chmod 777 /system/app/Superuser.apk  
  8. reboot  


Your android device should now be rooted!

 

 
(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容