获取 Android 4.2 的 ROOT 权限(越狱)

时间:2022-08-29 14:58:00

Today Google launches Android 4.2 alongside the new Nexus lineup. Galaxy Nexus as well as Nexus 7 owners that have the ability to run apps with elevated privileges are faced with a dilemma on whether to upgrade or not. Fear not, you can still root your Nexus using the latest version of Android.

The advantages of rooting are nothing to sneeze at. I run apps with elevated privileges more than a few times a day and I had to get the root capabilities up and running after upgrading to Android 4.2. The process is fairly straightforward and should not pose any difficulty even to less experienced users. I do have to mention that this guide can apply to the Nexus 4 and 10 as well, after developers release the compatible tools.

Getting started

In order to root Android 4.2 the following three requirements must be satisfied beforehand:

  1. The Android SDK, which you can download from Google Developers
  2. A custom recovery likeClockworkMod (CWM) or Team Win Recovery Project (TWRP)
  3. SuperSU, which you can download from CF-Root

There are no major differences between the two, but TWRP is more touch-oriented thanks to larger buttons. CWM is also available in a touch-compatible variant, but it has much smaller buttons. It's a matter of personal preference between the two though, but you have to choose one.

Before starting the process I urge you to perform a backup, as all data might be lost afterwards. You can copy the contents of the SD card to a safe external location such as cloud storage service or computer hard drive.

译者信息获取 Android 4.2 的 ROOT 权限(越狱)

Google 刚刚为 Nexus 7 发布了 Android 4.2 更新,而 Galaxy Nexus 和 Nexus 7 的用户确处于是否升级的两难的抉择。但不用害怕,你仍然可以为最新更新的 Android 4.2 取得 ROOT 权限。

本教程的方法并不难,同样适合经验并不丰富的用户。

开始

为了取得 Android 4.2 的 ROOT 权限,必须准备下面三个软件工具:

  1. 下载 Android SDK,下载地址:Google Developers
  2. 一个定制的 Recovery 工具,如 ClockworkMod (CWM) 或 Team Win Recovery Project(TWRP) ,请选择对应设备
  3. SuperSU 可以从 CF-Root 下载

两个 Recovery 工具并没有太多不同,TWRP 更适合于触摸屏设备上使用,因为按钮比较大。CWM 同样可用于触摸设备,按钮小得多。你可以根据个人喜好来选择。

获取 Android 4.2 的 ROOT 权限(越狱)

在开始之前建议你先备份下数据,也可以直接将 SD 卡的内容复制到一个安全的地方,如云存储或者计算机的硬盘。

Setting the Stage

The first step that needs to be performed after all the files are downloaded is to install the Android SDK. Afterwards open the Android SDK Manager and select the following two items:

  • Android SDK Platform-tools -- it contains the required programs to install Android 4.2 Jelly Bean
  • Google USB Driver -- it contains the necessary drivers for the Nexus device

Then you should create a folder in an easily accessible location within the command line. In this example I will use a folder named "Root" in my C:\ drive in Windows. The path name will therefore be: "C:\Root".

From the folder where Android SDK Platform-tools is installed (in my case it is "C:\Program Files x86)\Android\android-sdk\platform-tools") copy the following files to the previously created "Root" folder:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll
  • fastboot.exe

The following files must also be copied to the "Root" folder:

  • CWM-SuperSU-v0.97.zip -- SuperSU file
  • The custom recovery that you previously downloaded for your specific device (please see below)

For my Samsung-made Google Galaxy Nexus (codename "maguro") I will use TWRP with the name "openrecovery-twrp-2.3.1.0-maguro.img".

Depending on your device the name of the file that you must copy may differ.

In order to make the process smoother for instance the SuperSU file can be renamed to "root.zip" and the custom recovery to "customrecovery.zip". It's a matter of convenience, but for accuracy I will stick to the original naming for this guide.

If the previous steps are completed you must have the following six files in your "Root" folder:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll
  • fastboot.exe
  • CWM-SuperSU-v0.97.zip -- SuperSU file
  • The custom recovery. In my case it is "openrecovery-twrp-2.3.1.0-maguro.img"

From there, you can proceed to install the drivers for "fastboot mode". To install them, follow these steps:

  1. Power off your Nexus device.
  2. Press and hold Volume Up and Volume Down then press and hold the Power button; the device will now enter "fastboot mode".
  3. Go to Device Manager (Computer -> Properties -> Device Manager in Windows 7/8) and identify the device; for me it shows up as Android 1.0.
  4. Right click Android 1.0 and select "Update Driver Software," then select "Browse my computer for driver software".
  5. Select "Let me pick from a list of device drivers on my computer," then click "Next".
  6. From "Have Disk..." option go to the folder where you have Google USB Driver installed (for me it's "C:\Program Files .(x86)\Android\android-sdk\extras\google\usb_driver") and select "android_winusb.inf".
  7. Out of the three options select "Android ADB Interface" and validate any future warning window to install the driver.

译者信息获取 Android 4.2 的 ROOT 权限(越狱)

设置阶段

文件下载完后第一步需要做的就是安装 Android SDK,然后打开 Android SDK Manager 然后选择下面两项:

  • Android SDK Platform-tools -- 包含所需程序以安装 Android 4.2 Jelly Bean
  • Google USB Driver -- 包含 Nexus device 必须的驱动

然后你创建一个文件夹在可从命令行轻易访问的路径。这里我们假设创建的路径是 C:\Root。

在 Android SDK 平台工具安装的路径中 (我这里是 "C:\Program Files x86)\Android\android-sdk\platform-tools") 将下面四个文件复制到 C:\Root 目录:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll
  • fastboot.exe

下面文件也必须复制到 C:\Root 文件夹:

  • CWM-SuperSU-v0.97.zip -- SuperSU 文件
  • 之前下载的 Recovery 工具

我使用的是三星 Google Galaxy Nexus (代码 "maguro") ,我将使用 TWRP 这个工具,文件名:"openrecovery-twrp-2.3.1.0-maguro.img".

由于设备不同,你所复制的文件可能会有所不同。

为了让我们的过程顺利些,可将 SuperSU 文件重命名为 root.zip,而 Recovery 工具文件重命名为 customercovery.zip。这只是临时处理,不过我还是保留原来的文件名。

前面几步完成后,你的 Root 文件夹就有下面 6 个文件:

  • adb.exe
  • AdbWinApi.dll
  • AdbWinUsbApi.dll
  • fastboot.exe
  • CWM-SuperSU-v0.97.zip -- SuperSU file
  • 定制的 recovery. 我这里是 "openrecovery-twrp-2.3.1.0-maguro.img"

到这里,你可为 "fastboot mode" 安装驱动了,具体步骤如下:

  1. 将你的 Nexus device 关机
  2. 按住音量上、下键和电源键,设备将进入 "fastboot mode" 模式
  3. 打开 Device Manager (电脑 -> 属性 -> 设备管理器) ,我这里显示的是 Android 1.0
  4. 右键 Android 1.0 然后选择 "更新驱动程序" ,接着选择 "浏览计算机以查找驱动程序".
  5. 选择 Google USB 驱动程序安装目录下 (我这里是 "C:\Program Files .(x86)\Android\android-sdk\extras\google\usb_driver") 然后选择 "android_winusb.inf" 文件
  6. 在显示的三个选项中选择 "Android ADB Interface" 来安装驱动程序,过程可能会有一些警告信息
Final preparations

Everything is prepared in order to start the installation process, but in order to do so a command window must be opened. Windows Key + R opens "Run"; type in "cmd" and the command window appears. Typing "cd C:\Root" and pressing Enter sets the "Root" folder as the working directory. Pressing the Shift key and right clicking inside the "Root" folder will also deliver the same result.

The device must be turned on in "fastboot mode" which I have explained at step no.2 during the driver installation process, and obviously plugged-in to the computer. You then have to type in the following commands while in "fastboot mode":

  1. fastboot devices -- this is just for verification purposes; if there is no listed device then the drivers have been improperly installed and steps 1 through 7 must be redone.
  2. fastboot oem unlock -> you have to accept the prompt in order to continue -- this command will unlock the bootloader, but it will also erase the data on the device which is why a backup is necessary.
  3. fastboot reboot-bootloader -- this will reboot the bootloader.
  4. fastboot flash recovery openrecovery-twrp-2.3.1.0-maguro.img -- this will flash the custom recovery --please use the specific file and name for your particular Nexus device!
  5. fastboot erase cache -- this will erase the cache -- might not be necessary but it's just as a precaution.
  6. fastboot reboot -- this will reboot the device.

After Android 4.2 is loaded and running the SuperSU file must be copied from the "Root" folder to the internal storage (shows up in Windows Explorer as a Nexus device). A simple copy and paste will do the trick here.

Then you have to power off the Nexus device and enter "fastboot mode" again. Use the Volume Up and Volume Down keys to navigate until you can select "Recovery Mode". After the power button is pressed the device will reboot in the new custom recovery.

译者信息获取 Android 4.2 的 ROOT 权限(越狱)

最后准备

万事俱备了,接下来打开命令行窗口,并进入 C:\Root 目录。

在设备驱动程序安装过程中设备必须处于 "fastboot mode" 模式并且通过 USB 线连接到计算机,然后你需要在 "fastboot mode" 中运行下列命令:

  1. fastboot devices -- 该命令是校验目的,如果没有列出任何设备,那么前面提到的 1-6 步都要重做
  2. fastboot oem unlock -> 你必须确认提示信息然后继续,该命令将解锁 bootloader,同时也将擦除设备上的数据,所以我前面说到必须要备份数据。
  3. fastboot reboot-bootloader -- 该命令将重启 bootloader
  4. fastboot flash recovery openrecovery-twrp-2.3.1.0-maguro.img -- 该命令将定制的 Recovery 刷到设备中,这个文件名根据你下载的可能有所不同
  5. fastboot erase cache -- 该命令将擦除缓存,这步也可能不需要,这里仅作预防
  6. fastboot reboot -- 重启设备

在 Android 4.2 加载完毕后必须将 SuperSU 文件从 Root 文件夹复制到设备的内部存储器中(你可以通过资源管理器直接复制)。

然后关闭 Nexus 设备然后再次进入 "fastboot mode" 模式,使用音量上下键来选择 "Recovery Mode" 菜单项。再按下电源键后设备将以新的定制 Recovery 来重启设备。

Rooting your Nexus device

If you have ClockworkMod installed, you have to perform the following steps:

  1. Select "install zip from sdcard"
  2. Select "choose zip from sdcard"
  3. Select "0" (zero) folder
  4. Select "CWM-SuperSU-v0.97.zip"
  5. Select "Yes - Install CWM-SuperSU-v0.97.zip"
  6. Select "Go Back"
  7. Select "reboot system now"

If you have Team Win Recovery Project installed, you have to perform the following steps:

  1. Press "Install".\
  2. Select "CWM-SuperSU-v0.97.zip" -- for me it's in the "0" (zero) folder
  3. Swipe to confirm flash
  4. Press "Wipe cache/dalvik" (just as a precaution)
  5. Swipe to wipe
  6. Press "Reboot System"

After Android 4.2 loads your device can run apps with elevated privileges (meaning it's rooted). A SuperSU app is installed in order to allow root requests, so please use your judgement on which apps you grant access.

译者信息获取 Android 4.2 的 ROOT 权限(越狱)

开始获取 ROOT 权限

如果你选择安装 ClockworkMod ,需要执行下面几步:

  1. 选择 "install zip from sdcard"
  2. 选择 "choose zip from sdcard"
  3. 选择 "0" (zero) folder
  4. 选择 "CWM-SuperSU-v0.97.zip"
  5. 选择 "Yes - Install CWM-SuperSU-v0.97.zip"
  6. 选择 "Go Back"
  7. 选择 "reboot system now"

如果你选择安装 Team Win Recovery Project ,请执行:

  1. 点击 "Install".\
  2. 选择 "CWM-SuperSU-v0.97.zip" -- for me it's in the "0" (zero) folder
  3. Swipe to confirm flash
  4. 点击 "Wipe cache/dalvik" (just as a precaution)
  5. Swipe to wipe
  6. 点击 "Reboot System"

到这里我们所有的步骤都已经完成,同时安装了 SuperSU 应用可用于允许 ROOT 权限请求。