用新浪微博连接

QQ登录

只需一步,快速开始

搜索
查看: 144|回复: 3

[教程] 简单又实用!G1获取ROOT权限 [复制链接]

Rank: 9Rank: 9Rank: 9

帖子
13
积分
346
金钱
301
威望
1
贡献
0
发表于 2011-10-17 15:01:29 |显示全部楼层
首先要安装手机SD卡或TF卡驱动程序,步骤如下:
1、驱动程序下载地址:http://dl.google.com/android/android_usb_windows.zip
2、手机上打开:menu > Settings > Applications > Development> 勾选 > USB debugging;
3、WINDOWS发现新硬件后,选择下载文件解压缩后的文件夹,完成驱动安装;
4、电脑在识别手机存储卡是会在屏幕上有提示的(在手机最上边,用手触及拉下),按提示连接。

接下我们需要下载获得ROOT的文件(SDK文件):
1、SDK文件下载地址:http://www.qupan.com/down/Androidin_3255673.html
2、下载附件里的SDK文件为压缩文件,解压缩后放到任意盘符根目录,如C盘根目录;
3、在WINDOWS系统里打开“运行”命令;(操作步骤:开始-运行-输入“cmd”)
4、然后 “cd sdk”
    然后 “cd tools”
    最后输入 “adb devices
    完成后会出现如: HT845GZ21370 的字样 (每个人的数字可能不一样)


5、接下来继续输入:
    输入\"adb push recovery_testkeys.img /data/local/recovery.img\"
    完成后会出现1004 KB/s (0 bytes in 1767424.001s) (每个人的数字可能不一样)
    这一步正常就说明testkey已经push到G1里了


6、写入testkey
    1)G1连上WIFI 进入market 下载telnet;
    2)下载完成重起G1 然后在桌面(大时钟画面)上直接输入telnetd 回车(这时候G1上没有任何反应)后返回;
    3)进入telnet,直接点击Connect to Server 会进入输入界面;


    4)依次输入以下代码按回车键:(去掉引号)
        a、“mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system”(回车键)
        b、“cd /system”(回车键)
        c、“cat /data/local/recovery.img > recovery.img”(回车键)
        d、“flash_image recovery recovery.img”(回车键)
7、输入以下指令完毕后看到# #就是正常的。


8、为了确定已将testkey写入,按住“alt+L”重新启动机器进入电话的恢复模式,如果已经写入,在屏幕上方将会显示 “using test keys\"。咱们再继续,按\"home\"和返回键重新启动你的电话。


9、经过以上操作就全部完成获得ROOT操作了。

Rank: 3Rank: 3

升级  68.2%

帖子
253
积分
1523
金钱
1030
威望
45
贡献
145

最佳新人 活跃会员

发表于 2011-11-8 19:35:16 |显示全部楼层
本帖最后由 stallman 于 2011-11-8 22:45 编辑

sdk是google提供的开发工具包 software development kit
adb是Android Debug Bridge,他的作用是什么呢?
  1. Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:
复制代码
adb是一个多功能的命令行工具,他能使你跟虚拟设备实例通信,或者跟你的真实基于anddroid系统的设备通信,他是一个包含三部分的客户端-服务器端(C/S)架构的程序
  1. A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
复制代码
客户端,运行在的电脑(开发机)上,你可以通过命令adb来启动客户端,其他的Android工具,例如Eclipse插件ADT(Android Decelopmen Tools)和DDMS(未知,后续补充)也是创建了一个adb客户端
  1. A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
复制代码
服务器端在你的开发机的后台运行,服务器端管理客户端与运行在虚拟的android或者真实设备上的守护进程通信(PS:原来是这样啊,我刚读到C/S时还以为服务器短运行在android系统上呢:这种设计应该是考虑到手机的性能,无用的服务进程尽量不要)
  1. A daemon, which runs as a background process on each emulator or device instance.
复制代码
守护进程,运行在在虚拟设备或者硬件设备上的后台

关键字:bridge原来如此,:-)


使用道具 举报

Rank: 3Rank: 3

升级  68.2%

帖子
253
积分
1523
金钱
1030
威望
45
贡献
145

最佳新人 活跃会员

发表于 2011-11-8 20:01:26 |显示全部楼层
本帖最后由 stallman 于 2011-11-8 20:03 编辑

升级篇:
  1. The adb tool has moved to platform-tools/
复制代码
adb工具已经转移到platform-tools/,
附图:
Screenshot.png

使用道具 举报

Rank: 3Rank: 3

升级  68.2%

帖子
253
积分
1523
金钱
1030
威望
45
贡献
145

最佳新人 活跃会员

发表于 2011-11-8 20:05:44 |显示全部楼层
本帖最后由 stallman 于 2011-11-8 20:11 编辑

在linux下赋予adb执行权限,查看帮助
  1. chomd +x ./adb
  2. ./adb --help
复制代码
运行结果如下
  1. Android Debug Bridge version 1.0.29

  2. -d                            - directs command to the only connected USB device
  3.                                  returns an error if more than one USB device is present.
  4. -e                            - directs command to the only running emulator.
  5.                                  returns an error if more than one emulator is running.
  6. -s <serial number>            - directs command to the USB device or emulator with
  7.                                  the given serial number. Overrides ANDROID_SERIAL
  8.                                  environment variable.
  9. -p <product name or path>     - simple product name like 'sooner', or
  10.                                  a relative/absolute path to a product
  11.                                  out directory like 'out/target/product/sooner'.
  12.                                  If -p is not specified, the ANDROID_PRODUCT_OUT
  13.                                  environment variable is used, which must
  14.                                  be an absolute path.
  15. devices                       - list all connected devices
  16. connect <host>[:<port>]       - connect to a device via TCP/IP
  17.                                  Port 5555 is used by default if no port number is specified.
  18. disconnect [<host>[:<port>]]  - disconnect from a TCP/IP device.
  19.                                  Port 5555 is used by default if no port number is specified.
  20.                                  Using this command with no additional arguments
  21.                                  will disconnect from all connected TCP/IP devices.

  22. device commands:
  23.   adb push <local> <remote>    - copy file/dir to device
  24.   adb pull <remote> [<local>]  - copy file/dir from device
  25.   adb sync [ <directory> ]     - copy host->device only if changed
  26.                                  (-l means list but don't copy)
  27.                                  (see 'adb help all')
  28.   adb shell                    - run remote shell interactively
  29.   adb shell <command>          - run remote shell command
  30.   adb emu <command>            - run emulator console command
  31.   adb logcat [ <filter-spec> ] - View device log
  32.   adb forward <local> <remote> - forward socket connections
  33.                                  forward specs are one of:
  34.                                    tcp:<port>
  35.                                    localabstract:<unix domain socket name>
  36.                                    localreserved:<unix domain socket name>
  37.                                    localfilesystem:<unix domain socket name>
  38.                                    dev:<character device name>
  39.                                    jdwp:<process pid> (remote only)
  40.   adb jdwp                     - list PIDs of processes hosting a JDWP transport
  41.   adb install [-l] [-r] [-s] <file> - push this package file to the device and install it
  42.                                  ('-l' means forward-lock the app)
  43.                                  ('-r' means reinstall the app, keeping its data)
  44.                                  ('-s' means install on SD card instead of internal storage)
  45.   adb uninstall [-k] <package> - remove this app package from the device
  46.                                  ('-k' means keep the data and cache directories)
  47.   adb bugreport                - return all information from the device
  48.                                  that should be included in a bug report.

  49.   adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
  50.                                - write an archive of the device's data to <file>.
  51.                                  If no -f option is supplied then the data is written
  52.                                  to "backup.ab" in the current directory.
  53.                                  (-apk|-noapk enable/disable backup of the .apks themselves
  54.                                     in the archive; the default is noapk.)
  55.                                  (-shared|-noshared enable/disable backup of the device's
  56.                                     shared storage / SD card contents; the default is noshared.)
  57.                                  (-all means to back up all installed applications)
  58.                                  (-system|-nosystem toggles whether -all automatically includes
  59.                                     system applications; the default is to include system apps)
  60.                                  (<packages...> is the list of applications to be backed up.  If
  61.                                     the -all or -shared flags are passed, then the package
  62.                                     list is optional.  Applications explicitly given on the
  63.                                     command line will be included even if -nosystem would
  64.                                     ordinarily cause them to be omitted.)

  65.   adb restore <file>           - restore device contents from the <file> backup archive

  66.   adb help                     - show this help message
  67.   adb version                  - show version num

  68. scripting:
  69.   adb wait-for-device          - block until device is online
  70.   adb start-server             - ensure that there is a server running
  71.   adb kill-server              - kill the server if it is running
  72.   adb get-state                - prints: offline | bootloader | device
  73.   adb get-serialno             - prints: <serial-number>
  74.   adb status-window            - continuously print device status for a specified device
  75.   adb remount                  - remounts the /system partition on the device read-write
  76.   adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
  77.   adb reboot-bootloader        - reboots the device into the bootloader
  78.   adb root                     - restarts the adbd daemon with root permissions
  79.   adb usb                      - restarts the adbd daemon listening on USB
  80.   adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
  81. networking:
  82.   adb ppp <tty> [parameters]   - Run PPP over USB.
  83. Note: you should not automatically start a PPP connection.
  84. <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
  85. [parameters] - Eg. defaultroute debug dump local notty usepeerdns

  86. adb sync notes: adb sync [ <directory> ]
  87.   <localdir> can be interpreted in several ways:

  88.   - If <directory> is not specified, both /system and /data partitions will be updated.

  89.   - If it is "system" or "data", only the corresponding partition
  90.     is updated.

  91. environmental variables:
  92.   ADB_TRACE                    - Print debug information. A comma separated list of the following values
  93.                                  1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
  94.   ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
  95.   ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.
复制代码
选项参数果然够多,不愧是a versatile command line tool(多功能的命令行工具),有时间仔细研究下,下面看下主要问题,上面用到的adb devices,
第16行有解释
  1. devices                       - list all connected devices
复制代码
列出已经链接的设备,要回家了,回家继续!


使用道具 举报

您需要登录后才可以回帖 登录 | 注册

Archiver|手机版| 安锋网

GMT+8, 2012-5-21 05:42 , Processed in 0.270299 second(s), 23 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部