[Moto X Original Android Development] bhundven:
Hello fellow moto x owners!

Downgrade fail notice!

Just a notice, I tried downgrading after the AT&T camera update, and my flash failed because the bootloader did not allow the downgrade. See this post for more details!

My build number is still the updated version: 13.0Q2.X-116-X-17-54

The original version is: 13.9.0Q2.X-116-X-17-51

Introduction

I didn't make the goals in my previous OP revisions this clear, but let me lay this out to keep the trolls away.

First off, I am making a python fastboot frontend library. So that you can more easily control fastboot with a python script.

Normally, I hack on kernels, but with the bootloader on my phone still locked, I wanted to contribute something to the community.

Second, I'm creating a suite of tools called 'moto-x-tools'; hence the github repository name. The first tool I've made is the only useful one (sorry, doing stuff takes time and testing...).

The first one I created is a small python tool to allow you to flash back to stock on any platform with the FXZ's supplied by Skrilax_CZ. NOTE: The script currently doesn't check if you are flashing a different version of an FXZ image's bootloader as what you have installed on your device. I plan on fixing this soon!

So, you cannot Downgrade your device with this tool. You can only go back to stock with the version of the bootloaders that you have installed. This is only a limitation on LOCKED BOOTLOADERS. So for now, it's a big deal, but soon, you won't have to worry about that crap. Shuve on.

Expect more useful tools to come soon!

Current State

I have tested this script on Mac OS X 10.8.5 and Ubuntu Linux 13.04 Raring Ringtail.

For now, DO NOT USE THIS ON WINDOWS!

I kept getting:

(bootloader) Preflash validation failed
FAILED (remote failure)

This might be a driver issue, but I'll have to figure this out later. Anyone got more info on this error?

In v0.2.0 I have reworked the package so that it is a proper PyPI package. For each release I flash my AT&T xt1058 (16G) back to 100% stock on my Mac OS X 10.8.5 and Ubuntu Linux 13.04 Raring Ringtail before I tag the release and push changes to GitHub.

Requirements

Mac OS X

On Mac OS X you need to install the Motorola Device Manager.

Linux

On Linux, you will need to setup u-dev to set the permissions so that you can use fastboot.

Create a new file with the following contents in /etc/udev/rules.d/50-fastboot.rules:

# AT&T XT1058 16G NAND
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="2e23", MODE="0660", GROUP="plugdev"

(these are the vendor-id and product-id I found by putting my phone in fastboot mode, plugging it into my linux laptop, and typing lsusb -n. It maybe different for other vendor/carrier devices. Please post your vendor-id and product-id and model so that I can add to this list! Thanks!)

and type the command groups to make sure your are in the plugdev group.

If you are not, type:

sudo adduser plugdev

After that is done, logout and log back in to have your session reflect that you are now in the plugdev group.

Then reload the udev rules with:

sudo udevadm control --reload-rules

Download the android sdk. Run the SDK Manager to Install/Update the platform tools.

Add the platform-tools directory to your operating system's "PATH" environment variable. On linux and mac, just add:

export PATH="/path/to/platform-tools:$PATH"

to your ${HOME}/.profile file.

Windows

(CURRENTLY NOT SUPPORTED, YET)

On Windows you need to install the Motorola Device Manager.

Also, check out this stack-overflow. (got a better tutorial for this, let me know!)

Also, you will need to get and install the latest 2.7 version of python from python.org. I tested with python 2.7.5 (x86_64)

Download

Releases can be downloaded from here.

The github repository is here.

Changes to the code can be found here.

I've released this as GPLv2, so enjoy!

I test every release on my own phone on Linux and Mac OS X (soon Windows 8 ).

Install moto-x-tools

Download the latest release from the release link above.

Starting with v0.2.0, moto-x-tools is now a python package.

Install this like you would any normal python package:

python setup.py install

Instructions

In a command prompt; extract the FXZ zip file for your device and change into the directory with the firmware binaries and xml file.

No need to remove the 'getvar' line in the xml, the script I made will ignore it and move on. :cool:

Put your phone in fastboot and at the command prompt type:

moto-x-flash ATT_XT1058_4.2.2-13.9.0Q2.X-116-X-17-51_CFC_1FF.xml

(obiously changing the xml filename to what xml filename your firmware has!)

Now wait. The script will check MD5 checksums of files it will flash, so the checksum and flashing progress will take a while.

At the end of the script it will either tell you if a problem happened or if it was successful and will reboot your device into your fresh 100% stock install.

Attached is a log of flashing my device.

Issues? Problems? Suggestions?

If you find issues, please use the issue tracker on github.