Having an unlocked and rooted device provides several advantages :
- Easy backup and restore with Nandroid backup,
- Easy firmware replacement and updates installation,
- Advanced debugging capabilities.
The following instructions allow unlocking and rooting a Nexus device (Galaxy Nexus, Nexus 7) from the command line on a Linux machine. It involves:
- Backuping your device,
- Unlocking the bootloader,
- Restoring the backup,
- Rooting the device.
Here is the list of prerequisites :
- Android SDK, to have access to
- Clockwork Mode (CWM) recovery image.
- SuperSU installable zip.
platform-tools directory of the Android SDK must be on your
the device must have USB debugging enabled.
On Linux, you don’t have to install any driver. You need however to enable
access for your users. Depending on your distribution, you may have a package
handling that, but if not, here is a quick way to give access to your user to
the device (here
antoine). Type as
1 2 3 4 5
Plug your device on the USB cable, and you should be able to see it with
1 2 3
Unlocking the bootloader wipes all the data on the device. If you’re not doing this on a new device, you may want to backup and restore your data and applications. With the device connected in USB debug mode, type :
Depending on the amount of data you have on your device, this process can be quite long.
Unlocking the device is easy. With the device connected in USB debug mode, type:
The device will reboot in fastboot mode. To check this, type:
You will see your device in the list. Then you can unlock it by typing:
1 2 3 4 5 6 7 8 9 10 11
At the end of the process, reboot your device:
You will go through the initialization process in the device.
Once the device is up and running, you can restore your data with:
To root the device, we will apply the SuperSU installable zip as an update in CWM.
First we push the SuperSU installable zip in the device filesystem:
Now that the device is unlocked, we can boot it into CWM. We first reboot it in fastboot mode:
And then boot it with CWM:
1 2 3 4 5 6
After a few seconds, the device will show the CWM interface. With the volume
buttons, move to the
install zip from sdcard option and select it by pushing
the power button.
On the new menu that appears, choose the
apply /sdcard/update.zip option and
scroll down to the
Yes option. click on the power button and SuperSU will
Once done, you can go back to the main CWM menu and reboot the device.
Permanently install CWM
You can permanetly install CWM on the device recovery partition so that you can start your device in CWM without being connected via USB.
Your device automatically restores the recovery partition at each boot. To avoid
that, you need to delete the
/system/recovery-from-boot.p file on the
1 2 3 4 5
You can then reboot in fastboot mode and install CWM permanetly :
1 2 3
I personally don’t recommend to install CWM permanetly as it will prevent you from installing the OTA updates that are pushed to your device.