Unlock the Moto G (XT1077/XT1079)

Stefan "hr" Berder // // mobile

I recently got my hands on a cheap Moto G through the official tmall shop of Motorola. A dual SIM phone for 799 RMB (around 118€ or $125) with current version of android (5.0.2), 16G of storage and a micro SD slot, what else to say? The only catch is that it’s the Chinese version of the Moto G with no google apps installed. I like my android experience to be complete even if it’s often a challenge in China. So I went on to root and install the gapps on the brand new phone but all I found was in Chinese. So here’s a straight howto in English for whoever would need it.

Moto G unboxing

Note

First thing you should do after opening the box is connect the phone to a WiFi network and run through the phone upgrade(s).

Downloads

I like to start with this because downloads for android are routinely from slow platforms. Better have everything at hands before you start:

Phone boot menu

This action will happen several time during the whole process so it’s essential to do it properly. It can be done via the buttons or simply by using adb

Access the boot menu via phone buttons:

  • Power off your android phone
  • Hold down the Volume Down then press the Power buttons and keep both of them pressed for 10 seconds.
  • When you release the buttons you should see a menu with text giving you a status of your phone.

Access the boot menu using adb:

  • In the Settings app, select “Developer options” then check “USB debugging”“.
  • Plug the phone via USB and plug the other end on your computer.
  • Your phone will ask you if you want to allow USB debugging from this copmputer, touch “OK”.
  • In a terminal, type the following command to make sure the phone is accessible:
$ adb devices
List of devices attached
XXX      device
  • If a device is listed, then you can restart it to access the boot menu with the following command:
$ adb reboot bootloader
Moto G bootloader menu

Unlock the bootloader

The phone bootloader is locked to keep us from changing the system, but hey, where is the fun in that?

Warning

This step will void your warranty and wipe your phone memory (apps, photos, contacts, etc)

  • First step is to install fastboot via the android SDK from the android developer website or install a package on your ubuntu (trusty/14.04 and above):
$ sudo apt-get install android-tools-fastboot
  • You now need to put the phone in developer mode, to do this open the Settings app, go all the way down the list of options to “About phone”. Now touch reperatedly the “Build number” until a message tells you that you are now a developer.
Android developer mode 4 stepsAndroid developer mode ready
  • In the Settings app, select “Developer options” then check “Enable OEM unlock”.
OEM unlock option
  • Plug the phone via USB and plug the other end on your computer.
  • Start the phone to the boot menu
  • From a terminal, use fastboot to get the OEM unlock data, this step will print a block of codes:
$ fastboot oem get_unlock_data
...
(bootloader) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(bootloader) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(bootloader) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(bootloader) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(bootloader) XXXXXXX
OKAY [  0.142s]
finished. total time: 0.142s
  • You have to sign up on Motorola unlock website and navigate to step 2 of unlocking. Use the “Data Scrub Tool” to convert the block of code from the previous command to a continuous line of code. Submit that line to check if your device can be unlocked. The way this form works is non intuitive, after submiting your line of code, if nothing happens then everything is good. You can now click on “Request Unlock Key”.
  • Motorola will send you an email with the unlock key (20 characters), use that key to unlock the bootloader using the following command:
$ fastboot oem unlock XXX
  • Press the Volume Up button to reboot the phone, during the boot you should see a new screen that warns you that your bootloader is unlocked. That’s the sign that everything worked properly.
Moto G unlocked bootloader

Root the phone

  • Unlocking the bootloader wiped the phone so you now need to put the phone in developer mode again, to do this open the Settings app, go all the way down the list of options to “About phone”. Now touch reperatedly the “Build number” until a message tells you that you are now a developer.
  • In the Settings app, select “Developer options” then check “Enable OEM unlock” and “USB debugging”.
Android USB debugging option
  • Plug the phone via USB and plug the other end on your computer.
  • Allow this computer to do USB debugging.
Moto G unlocked bootloader
  • Start the phone to the boot menu
  • Now flash the ChainFire image using the following commands:
$ fastboot oem unlock
$ fastboot boot CF-Auto-Root-titanumtsds-titanretde-xt1068.img
  • The phone should reboot after this finishes, when looking in the apps list you should find SuperSU. That’s the sign that the rooting worked properly.
Moto G unlocked bootloader

Recovery image

  • While the phone is running android, use the following commands to push the busybox and Google Apps packages on the phone storage:
$ adb push busybox-xxx.zip /sdcard/
$ adb push gapps-lp-xxx-signed.zip /sdcard/
  • Start the phone to the boot menu.
  • Use the following command to flash CWM PhilZ Touch 6 Recovery image to the phone:
$ fastboot flash recovery CWM_Touch_Titan_v2.img
  • When the flash is done, scroll to “Recovery” using Volume Down, select by pressing Volume Up.
ClockWorkMod Philz Touch 6 recovery menu
  • The CWM menu should appear, you should now scroll to “Install Zip” using Volume Down and select it using Power.
  • Scroll to “Choose zip from /sdcard” and select it.
  • Scroll to the busybox zip package and select it.
  • When this install is successfully finished, do the same install steps for the gapps zip package.
  • Go back to the first menu and select “Reboot System Now”.
  • Your phone will stop on a screen saying “Android is upgrading”, just wait for this step to finish.
  • When the system is started, you should be able to find Google Play and Gmail apps (and more).

That’s it, you now have a fully functional Android phone with its Google services/apps. If you have any problem, hit me up on twitter or weibo (@sberder for both).

For an install to my taste, the next steps involve installing Titanium backup to remove as many apps as possible from the original image and Nova launcher to replace the home screen.

//