中国男款西装品牌:Android应用.三星i9000系列(3).无需刷机轻松获取Root权限

来源:百度文库 编辑:偶看新闻 时间:2024/05/06 12:37:10
Android应用.三星i9000系列(3).无需刷机轻松获取Root权限分类: 手机应用与开发2011-04-08 16:4711883人阅读评论(22)收藏举报

Android应用.三星i9000系列指南(3).无需刷机轻松获取Root权限

草木瓜 20110403

一、前言

从购机到现在,也刚几天,平常忙于工作,没怎么捣鼓手机。晚上偶尔想打开
wifi玩玩,忽然发现连不上了。wifi始终停留在获取ip地址这个阶段。以前都是
好好的,没任何问题。这时我想起原来一个朋友的摩托罗拉ME811连接wifi也出现
过这样的问题。
显然,这应该是Anriod系统本身的问题。上网google一下,发现很多网友都出
现了类似问题,解决方法有二:一是使用静态IP,二是删除/data/misc/dhcp一
些文件。笔者试了静态IP,貌似还是不行,只得尝试第二种方式。而第二种方式
看似“简单”,然必须要先获取Root权限!


二、有关Root权限

我们知道Android是基于Linux的,这个操作系统的最高权限用户就是root!打个
很简单比方,没有root的感觉就像买了个别墅却只给了车库的钥匙!大部分人都
不会答应,所以获取最高权限是必须的!

三、获取Root权限

i9000发布已有一年,操作系统都是开源的,估计早就被研究透了,抱着这样的
思想毫不犹豫地google一下。发现网上信息还是比较凌乱,很多内容也不靠谱。简
单整理了一下,主要有如下几种方式:

1.使用z4root软件
2.使用Android Recovery System更新update.zip
3.使用SuperOneClick
4.刷写已支持root的ROM

下面是简要过程:

1.z4root

这里我们下载了z4root(使用版本:z4root1.3.0),进行了一键root操作,具
体细节见:

《使用z4root 里程碑2获取Root完全教程》
http://tech.sina.com.cn/mobile/n/2010-12-24/06381611116.shtml

虽然上面说得是MOTO里程碑2,对三星i9000也是完全一样的!选择Permanent
Root后,会重启手机。之后用root explorer(使用版本:rootexplorer_2.14.2)
浏览文件,发现/data目录还是为空。其实判断root权限是否获取成功,也只需要
关注/data目录是否为空。/data显示为空即说明root权限获取失败!

之后又换了z4root版本(z4root1.2.1),还是如此!只能说明一点,虽然z4root
对很多三星i9000都是可用的,但z4root对本机却行不通!

本机软件版本信息:
型号:GT-I9000
Android版本:2.2
基带版本:I9000ZSJPE
内核版本:2.6.32.9 root@SE-S506 #3
版本号:FROYO.ZSJPD

2.使用Android Recovery System更新update.zip

z4root行不通,只能尝试更新update.zip,具体过程可参看:

《三星Galaxy s i9000获取root权限详细教程》的第二种方法
http://android.sj.91.com/content/2010-07-14/20100714181645219.shtml

依此方法,复制update.zip到SD卡,关机状态下按下三键:音量键上(左侧),
HOME键和开机键(右侧),手机会进入Recovery模式。

本机Android Recovery System是3e版本,菜单是蓝色的,提示是黄色的。
通过音量键选择apply sdcard:update.zip,按HOME键确认,提示:
signature verification failed

显然root再次失败!要解决这个签名认证失败的问题,似乎还要通过刷内核
把Android Recovery System降为2e版本才可以。


3.使用SuperOneClick

两次碰壁只得准备再尝试SuperOneClick,一开始并不知道SuperOneClick具体
什么原理。只是按以前网友方法操作:

《i9000 2.2 JPD/JPE 简易root教程》
http://www.angeeks.com/thread-550165-1-1.html

注意:上文中 <运行压缩包里的“SuperOneClick.exe”选择“shell root”> 应改
为选择“root”!

运行SuperOneClick.exe,点击图形化界面上的root按钮,完整提示如下:

Killing ADB Server...
OK
Starting ADB Server...
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
OK
Waiting for device...
OK
Pushing rageagainstthecage...
337 KB/s (0 bytes in 5392.000s)
OK
chmod rageagainstthecage...
OK
Running rageagainstthecage...
OK
***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***
Killing ADB Server...
OK
Starting ADB Server...
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
OK
Waiting for device...
OK
Running rageagainstthecage...
ROOTED
Getting mount path...
/dev/block/stl6
OK
Remounting system with read-write access...
OK
Pushing su...
failed to copy su to '/system/bin/su': No space left on device
OK
chmod su...
Unable to chmod /system/bin/su: No such file or directory
OK
Pushing Superuser.apk...
204 KB/s (0 bytes in 196521.000s)
OK
Remounting system with read-only access...
OK
Running a SU test...

注意,此时提示No space left on device,很显然/system目录已满。使用
超级终端(Better Terminal Emulator Pro v3.37),在命令行下输入df(
顺便说一下,默认的中文键盘输入法与超级终端兼容性很差,经常出现无法
输入的情况,如出现这个问题,可以切换到Swype,三星键盘或者或搜狗输入法):
$ df
df
/dev: 155672K total, 0K used, 155672K available (block size 4096)
/mnt/.lfs: Function not implemented
/mnt/asec: 155672K total, 0K used, 155672K available (block size 4096)
/system: 282432K total, 282432K used, 0K available (block size 4096)
...

system没有可用空间,su无法复制,所以root获取肯定失败!


四、柳暗花明

三种获取Root的方法都已经全部尝试,全部失败,似乎只有刷机一条路,然而
就软件版本来看并无刷机的必要性!本来最靠谱SuperOneClick都由于/system
目录无空间也告失败。/system默认是只读的,要想remount成可读写,还需要
root权限,这不是限入矛盾中了?

查看SuperOneClick文件目录,发现存在如下文件:

F:/Own/Phone/Samsung/Tools/SuperOneClick 的目录

2010/10/16 22:04 577,335 adb.exe
2010/10/18 11:27 339,885 adblinux
2010/10/18 11:26 171,656 adbmac
2010/10/16 22:04 96,256 AdbWinApi.dll
2010/10/16 22:04 60,928 AdbWinUsbApi.dll
2010/10/16 23:29 1,062,992 busybox
2010/10/16 22:04 5,392 rageagainstthecage
2010/10/16 22:04 24,120 sqlite3
2010/10/16 22:04 26,264 su
2010/11/04 21:21 379,392 SuperOneClick.exe
2010/10/16 22:04 196,521 Superuser.apk

su与rageagainstthecage是需要复制到手机上运行的,而adb.exe是核心!
这里不仅提供的Windows版本的,而且还有adblinux(linux版本),
adbmac(mac版本)。再查看豌豆荚目录,发现同样有adb.exe这样的文件。
终于意识到问题的关键了!

命令行(开始运行cmd.exe)下直接找到adb所在目录并运行:

C:/Users/Administrator>D:
D:/>cd D:/GreenSoft/wandoujia
D:/GreenSoft/wandoujia>adb

Android Debug Bridge version 1.0.26
...(由于内容过多,省略若干内容)

devices - list all connected devices
connect : - connect to a device via TCP/IP
disconnect : - disconnect from a TCP/IP device

device commands:
adb push - copy file/dir to device
adb pull [] - copy file/dir from device
adb sync [ ] - copy host->device only if changed
(see 'adb help all')
adb shell - run remote shell interactively
adb shell - run remote shell command
adb emu - run emulator console command
adb logcat [ ] - View device log
...
adb install [-l] [-r] [-s] - ...
adb uninstall [-k] - ...
adb bugreport - return all information from the device
that should be included in a bug report.

adb help - show this help message
adb version - show version num
...
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints:
adb status-window - continuously print device status for a specified device
adb remount - remounts the /system partition on the device read-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip - restarts the adbd daemon listening on TCP on the specified port
...

功能实在非常全面,仔细看还有什么adb root,adb remount。不过放心,这些
肯定都被限制死了,不能用!否则国外牛人也不至于费这么多劲去搞个破解程序!
SuperOneClick其实还是利用adb这个调试接口。我们仔细查看上面SuperOneClick
失败的日志,发现有如下内容:

Running rageagainstthecage...
ROOTED

这说明已经拿到了Root权限,只是复制su的过程中出错了。而rageagainstthecage是
关键的提取权限程序。拿到root后,紧接着SuperOneClick就对/system进行remount:

Remounting system with read-write access...
OK

再次强调一遍,执行完rageagainstthecage,通过查看日志能够确定成功获取了root
权限!在当时尝试z4root时,我怀疑也是因为这个磁盘空间满的问题导致了root失败。

五、获取Root权限完整的步骤,写在最后

我们在《三、获取Root权限 3.使用SuperOneClick》之后(不要重启手机或者拔掉
USB连接,否则还需要重新运行SuperOneClick点root按钮),紧接着从命令行进入
adb shell。提示如下信息:

F:/Own/Phone/Samsung/Tools/SuperOneClick>adb shell
#

这个“#”非常关键,表明当前已经是root权限了!如果是“$”说明SuperOneClick执行
不成功(也就是说rageagainstthecage执行没有成功),再次运行SuperOneClick.exe
点击root。直到输入adb shell出现#号!

执行如下命令:

1) 修改 /system 为可读写
# mount -o remount rw /system
2) 进入自带的应用目录
# cd /system/app
3) 删除三星自带的天气时钟,这样/system就有一些剩余空间,当然删之前也可以
先复制一份到SD卡上(命令:cp /system/app/SamsungWidget_WeatherClock.apk /mnt/sdcard/.)
# rm SamsungWidget_WeatherClock.apk

做完以上三步后,再次运行SuperOneClick.exe点击root,成功!
然后重启手机,手机应用会多一个授权管理(专门管理需要使用root权限的应用,其实
是SuperOneClick里的Superuser.apk,完全可以手工安装)。

然后手机上运行root explorer,会提示是否对当前应用授予root权限!如果授予的
话,root explorer就会以最高权限方式运行,所有目录内容都可以看到了!宁外授
权管理里也可以看到root explorer被授予root权限。


另附上root成功的完整SuperOneClick日志:

Killing ADB Server...
OK
Starting ADB Server...
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
OK
Waiting for device...
OK
Pushing rageagainstthecage...
337 KB/s (0 bytes in 5392.000s)
OK
chmod rageagainstthecage...
OK
Running rageagainstthecage...
OK
***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***
Killing ADB Server...
OK
Starting ADB Server...
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
OK
Waiting for device...
OK
Running rageagainstthecage...
ROOTED
Getting mount path...
/dev/block/stl6
OK
Remounting system with read-write access...
OK
Pushing su...
96 KB/s (0 bytes in 26264.000s)
OK
chmod su...
OK
Pushing Superuser.apk...
204 KB/s (0 bytes in 196521.000s)
OK
Remounting system with read-only access...
OK
Running a SU test...