Make : Motorola/Google

Model : Moto G

Model Code : XT1039

Purchased : 2013-11-24

Storage : 8GB

Developer Mode

link

  1. "Settings | About phone"
  2. Press Build Number 7 times

It will tell you when you're a "developer". Can now enable USB debugging.

Mounting

  • Use go-mtpfs to mount as fuse filesystem

Backup

Backs up to local backup.ab in local folder. Requires confirmation on the phone itself.

android-sdk/platform-tools/adb backup -all -f backup.ab

Backup with adb su and tar

adb shell su -c "cd /system && busybox tar cvf - * | gzip -c > /sdcard/dump/system.tgz"

Backup without busybox

./adb shell ls -l -a | grep '^[^l]' | sed -e 's/^d.* \([^ ]*\)\r$/mkdir sav\/\1; .\/adb pull \/\1 sav\/\1/' -e 's/-.* \([^ ]*\)\r$/.\/adb pull \/\1 sav\/\1/' | /bin/bash

or

time adb shell ls -l -a | grep '^[^l]' | sed -e 's/^d.* \([^ ]*\)\r$/mkdir -p sav\/\1; adb pull \/\1 sav\/\1/' -e 's/-.* \([^ ]*\)\r$/adb pull \/\1 sav\/\1/' | /bin/bash

Engineering Mode

*#*#4636#*#*

Rooting

  1. Install android SDK
  2. Connect device via USB and switch it to fastboot mode

    1. power off, then hold power and volume-down button

    2. Extract unlock key (bootloader) 0123456789ABCDEF#0123456789ABCD (bootloader) EF0123456789ABCDEF01234567#0123 ...

  3. Login to Motorola unlock page and enter key to retrieve unlock code.

  4. Code is 20-character alphanumeric
  5. There's nowhere to set

Unlock Bootloader

sudo fastboot oem unlock UNLOCK_CODE

$[Get Code]5

Flash CyanogenMod

https://wiki.cyanogenmod.org/w/Install_CM_for_peregrine

  • Download CM, CMRecovery, OpenGApps
  • Install CMRecovery adb reboot bootloader sudo fastboot flash recovery ./cm-13.0-20160820-SNAPSHOT-ZNH5YAO0J6-peregrine-recovery.img

  • Boot recovery

  • In CMRecovery:
    • Factory Reset / Wipe

Failed with Bootloader Version error

install failed this device has bootloader 4113

Update bootloader

http://forum.xda-developers.com/moto-g/help/rc-faq-cm12-frequently-questions-t2996087/page24#post59520890

adb reboot bootloader
fastboot getvar version-bootloader
fastboot flash motoboot motoboot.img
fastboot reboot-bootloader
fastboot getvar version-bootloader  # verify version

No SIM detected

Need to update Radio firmware

fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn

Post-flash config

  • Install OpenGApps from fastboot
  • Encrypt phone
  • Restart
  • Install TitaniumBackup
  • Restore data