[kwlug-disc] [Android] I have a very expensive paperweight

Keefer Rourke keefer.rourke at gmail.com
Wed Apr 29 20:13:24 EDT 2015


Thanks for the replies everyone! Thankfully the solution didn't require any
soldering or reflowing of electronic parts (as Khalid went through); I
managed to find the stock Canadian firmware for the Moto G and repair the
partition table.

The main issue was the fact that I didn't rtfm and I mixed up `fastboot
erase system` and `fastboot format system`, the latter being what I wanted.
Erase system actually seems to destroy the system partition where the
operating system resides, presumably leaving unallocated memory space. This
is where the (dangerous) confusion usually arises with fastboot from my
experience: to format user data on the device, you have to use `fastboot
erase userdata`. This is not the case with other device partitions unless
you want to render the device unusable.

For anyone that's interested, the process I went through appears to be the
same, with some exceptions, for any recent Motorola phone (Moto X, Moto G,
Droid Maxx, probably the Moto E, etc). I'll describe it below:

Repairing the partition table (the thing I didn't know how to do but turned
out to be surprisingly easy):

   1. Firstly, locate your phone's stock firmware appropriate for your
   bootloader version (basically use whatever the most recent version of the
   firmware you were last running). For me this was the Canadian Telus 5.0.2
   build for the XT1032. Note that Koodo phones use the Telus firmware. Unless
   you have a supported Developer Edition of a device such as the Moto X,
   getting firmware is a bit of sketchy process, but I found legitimate
   looking firmware here: http://www.filefactory.com/folder/c6cdedc45a775d27
   2. Next step is to wait the 12134564321 hours for the file to download
   (filefactory greedily limits download speeds unless you pay their
   ridiculous premium). I'll probably mirror the firmware that I used
   somewhere else so that others with my problem don't have to wait in agony
   with a dead phone.
   3. Once downloaded, extract the archive and rebuild the partition table
   by executing `fastboot flash partition path/to/file/gpt.bin`

Once the gpt.bin flashes successfully (only took me a matter of seconds),
the device's GPT partition table will be rebuilt so you can proceed to
format the partitions as required. To do this all the other images need to
be flashed as their respective partitions.

My archive contained a logo image (the manufacturer branding you get on
boot up prior to starting android), several sparse images which made up the
system, a recovery image, a modem image, and probably a few others I'm
forgetting. The contents of these archives likely varies by device and
firmware version though, so be wary. There was also conveniently an XML
file contained within the firmware archive which when opened and read,
essentially told me the sequence which I needed to flash each file in, and
to which partitions. There was also some erasing of certain partitions,
that were presumably related to the modem, that was required (though I
didn't understand why), and finally a cache and userdata wipe.

Basically the process was pretty straight forward, and I ended up with a
system that was completely restored to stock, as if I'd just gotten it new
out of the box (but with a very void warranty). From there, I flashed TWRP
since there were display issues with ClockworkMod based recoveries (CWM
touch, PhilZ) on my Moto G, and installed Euphoria OS as I had originally
intended to do. If anyone wants any more detailed information on the
process, I'll be happy to provide it at some point, though the command
history, exact file names, and the official instructions for flashing that
I used are on my other laptop.

Cheers,
Keefer

On 29 April 2015 at 18:37, Nick Guenther <nguenthe at uwaterloo.ca> wrote:

>
>
> On 28/04/15 11:20 PM, Khalid Baheyeldin wrote:
>
>> On Tue, Apr 28, 2015 at 10:33 PM, Keefer Rourke <keefer.rourke at gmail.com>
>> wrote:
>>
>>  Has anyone gone through anything similar with corrupted memory on their
>>> devices, or dealt with restoring to stock firmware on non-Nexus devices?
>>> Any advice?
>>>
>>
>> So, my advice is to look for TWRP for your specific device. This is a
>> custom recovery that can do a lot of things, including reflashing,
>> changing
>> file systems, backup, ...etc.
>> If you can't find TWRP, then look for ClockWorkMod (CWM).
>>
>
> For future reference, you should never be "searching" for TWRP, you should
> be "selecting" it from their official releases at http://teamw.in/Devices/.
> There seem to currently be two "Moto G" devices listed, so you're in luck.
> If they didn't, there is a way to do it yourself, though it is a bit of an
> investment: the source is at
> https://github.com/omnirom/android_bootable_recovery, a build guide is at
> http://forum.xda-developers.com/showthread.php?t=1943625, and note that
> you need to find a BoardConfig.mk file which will be provided with the
> kernel source code that the manufacturer is, per the GPL, supposed to
> provide somewhere on their website.
>
> Once you have it you can run it by getting into fastboot mode on your
> device (which is unfortunately not entirely standard) and then doing
> `fastboot boot twrp.img`
> (you can also `fastboot flash recovery twrp.img`, but it writes to flash
> instead of to RAM so be wary of doing that, certainly be wary without a
> backup of the original recovery partition).
>
> In theory you could use a different recovery system besides TWRP, but TWRP
> is the best by far at the moment. However, if your bootloader is stuck
> locked, you won't be able to use it and you will need to get a stock ROM
> and use whatever method the stock recovery expects. I know that many
> companies have custom Windows apps for uploading ROMs through their stock
> recoveries; I do not know if they all have different protocols, but if
> there is a canonical protocol I haven't yet found documentation and,
> especially, have not yet found a linux program which speaks it (I also have
> an expensive brick at the moment; I've gotten close to being able to fix it
> by circumventing the recovery, but I'm *stuck*: see
> https://github.com/swetland/omap4boot/issues/8; what kind of open source
> is this??).
>
> I'll want to reemphasize what Khalid said that if you can't find a stock
> ROM either from your sketchy filehost or somewhere else on XDA, try
> http://wiki.cyanogenmod.org/w/Devices or
> http://omnirom.org/supported-devices/, and please share the results
> because Android is a dark art, partly out of how popular it is (hence how
> much mis- and outdated information spreads) and partly, I think, because
> Google doesn't want to actually invest in making development on their
> devices easy, only development on their OS.
>
>
>
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20150429/3fdc05c9/attachment.htm>


More information about the kwlug-disc mailing list