[TOOL] Moto X FXZ Flashing Script (100% back to stock) [10/03/2013] - Moto X Original Android Development

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:
Code:
(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:
Code:
# 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:
Code:
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:
Code:
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:
Code:
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:
Code:
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.
Put your phone in fastboot and at the command prompt type:
Code:
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.

$ fastboot getvar all
will return the identifier of the latest signed software flashed on a device in the ro.buildfingerprint field
(bootloader) ro.build.fingerprint[0]: motorola/ghost_att/ghost:4.2.2/1
(bootloader) ro.build.fingerprint[1]: 3.9.0Q2.X-116-X-17-51/12:user/bl
(bootloader) ro.build.fingerprint[2]: dacfg,release-keys
So, anyone up to just add logic so that this exact version is reflashed on the device (and only this version, and auto-download the right one)..
might play with it this week-end.
<SNIP>

planktoid said:
$ fastboot getvar all
will return the identifier of the latest signed software flashed on a device in the ro.buildfingerprint field
(bootloader) ro.build.fingerprint[0]: motorola/ghost_att/ghost:4.2.2/1
(bootloader) ro.build.fingerprint[1]: 3.9.0Q2.X-116-X-17-51/12:user/bl
(bootloader) ro.build.fingerprint[2]: dacfg,release-keys
So, anyone up to just add logic so that this exact version is reflashed on the device (and only this version, and auto-download the right one)..
might play with it this week-end.
Click to expand...
Click to collapse
Shouldn't take but a moment. Good tip!
Sent from my XT1058 using Tapatalk 4

Refactored the whole package, it's now v0.2.0.
Trying to get it up on PyPI. I seem to be having issues with XDA on my mac. I'll update the OP in a little while.

planktoid said:
$ fastboot getvar all
will return the identifier of the latest signed software flashed on a device in the ro.buildfingerprint field
(bootloader) ro.build.fingerprint[0]: motorola/ghost_att/ghost:4.2.2/1
(bootloader) ro.build.fingerprint[1]: 3.9.0Q2.X-116-X-17-51/12:user/bl
(bootloader) ro.build.fingerprint[2]: dacfg,release-keys
So, anyone up to just add logic so that this exact version is reflashed on the device (and only this version, and auto-download the right one)..
might play with it this week-end.
Click to expand...
Click to collapse
In the latest v0.2.0 release, I've modified the getvar wrapper to return the result as a dictionary. For now it does not work with 'all', but I did test with ro.build.fingerprint and others. Soon it will also return a dictionary for 'all' too.
Sent from my XT1058 using Tapatalk 4

Thanks for this.
One question, is it possible to downgrade with this tool?
I am trying to easily flash back to the stock AT&T release and re-root.

gunnyman said:
Thanks for this.
One question, is it possible to downgrade with this tool?
I am trying to easily flash back to the stock AT&T release and re-root.
Click to expand...
Click to collapse
I'm not sure. I also have an at&t phone, but my bootloader is still locked.
Sent from my XT1058 using Tapatalk 4

Mine too

gunnyman said:
Mine too
Click to expand...
Click to collapse
What did you flash to it. I'll reproduce and try back to stock.
Sent from my XT1058 using Tapatalk 4

I'm under nda not to say lol. But the att update is rolling out.

gunnyman said:
I'm under nda not to say lol. But the att update is rolling out.
Click to expand...
Click to collapse
Hah! Well, if the bootloader allows downgrading, then it should work.
Sent from my XT1058 using Tapatalk 4

gunnyman said:
I'm under nda not to say lol. But the att update is rolling out.
Click to expand...
Click to collapse
bhundven said:
Hah! Well, if the bootloader allows downgrading, then it should work.
Click to expand...
Click to collapse
Well, the update rolled out. Lets find out!

bhundven said:
Well, the update rolled out. Lets find out!
Click to expand...
Click to collapse
Seems to be a negatory, sir.
My log from my script says everything flashed successfully, but on the fastboot framebuffer, I saw lots of 'preflash validation failed' messages like this:
Code:
Partition (boot) Security Version Downgraded
preflash validation failed for boot
and a few other partitions
My script seems to think the flash was successful. Attached is the log.

The phone rebooted and seems fine, though.
When I check for an update, it says there aren't any. So I wonder if the downgrade attempt even did anything at all.
Strange...

I hope new FXZs are released to reflect the update.

Actually, I see the FAILED messages in the log. So, it looks like I need to update the script to check the return codes from fastboot and not the command return code!
Hang tight! I'll have an update soon. I'm also going to add a version check to make sure you don't try to downgrade!
Also, I'm going to do the md5sum check before trying to flash.

<SNIP>
Not sure exactly what your tool is going to do that a normal script kiddy hasn't already done. Flashing fxz files using the fastboot command is childs play, and many scripts exist for this very purpose.
YOU CAN NOT BUILD A TOOL that is going to allow you to downgrade your firmware on a bootloader locked Motorola phone. On older devices the secure version was contained in the CDT.bin file and on newer phones it is contained in the gpt.bin file. Once this has been upgraded then you can only flash that version of firmware. That is why you get preflash validation errors. It will not matter if you try in Windows, OSX, or Linux.
Look around XDA and you should find other more detailed explanations.

jimmydafish said:
Not sure exactly what your tool is going to do that a normal script kiddy hasn't already done. Flashing fxz files using the fastboot command is childs play, and many scripts exist for this very purpose.
Click to expand...
Click to collapse
Have you looked at the github repository? The name of the repo is called "moto-x-tools". Sorry, this one tool out of the set is the only one I've done. And I only did it a few days ago. Also, if you noticed, I'm making a python fastboot frontend library. It still needs some love, but it's work in progress.
jimmydafish said:
YOU CAN NOT BUILD A TOOL that is going to allow you to downgrade your firmware on a bootloader locked Motorola phone.
Click to expand...
Click to collapse
Did I say that was the goal of the project?
jimmydafish said:
On older devices the secure version was contained in the CDT.bin file and on newer phones it is contained in the gpt.bin file. Once this has been upgraded then you can only flash that version of firmware. That is why you get preflash validation errors. It will not matter if you try in Windows, OSX, or Linux.
Click to expand...
Click to collapse
This tool was designed to allow you to go back to stock on the same version as say a modified version of the the stock rom, with the same bootloader version. This check in my one script is coming soon! Trust me. I was asked to test how it handled flashing an old FXZ with a newer update. And obviously it did not go well. My phone still works fine, because the bootloader was smarter then I was.
jimmydafish said:
Look around XDA and you should find other more detailed explanations.
Click to expand...
Click to collapse
You'd be surprised what I've learned by searching around the last few days. Sorry for journaling my progress of learning.
BTW, could you not QUOTE THE ENTIRE OP!?!?!?
Thanks,
-Bryan

bhundven said:
Hang tight! I'll have an update soon. I'm also going to add a version check to make sure you don't try to downgrade!
Click to expand...
Click to collapse
Just quoting... you know... to make it even more clear.

Interesting to note:
Code:
Running: fastboot flash partition gpt.bin
(bootloader) Variable not supported!
target reported max download size of 805306368 bytes
sending 'partition' (32 KB)...
OKAY [ 0.180s]
writing 'partition'...
FAILED (remote failure)
finished. total time: 0.880s
Running: fastboot flash motoboot motoboot.img
(bootloader) Variable not supported!
target reported max download size of 805306368 bytes
sending 'motoboot' (1588 KB)...
OKAY [ 0.298s]
writing 'motoboot'...
(bootloader) flashing sbl3 ...
(bootloader) flashing rpm ...
(bootloader) flashing tz ...
(bootloader) flashing aboot ...
(bootloader) flashing sbl1 ...
(bootloader) flashing sbl2 ...
OKAY [ 4.960s]
finished. total time: 5.258s
From that failed flash; While gpt.bin failed to flash, motoboot.img (which contains aboot and sbl[1-3]) flashed fine. Maybe it wasn't updated in 139.12.54?

Related

[Q][Kernel][i9023] Help : flashing kernel killed my phone

Hello everybody,
Before telling you about my issue, i should mention that i am a complete newbie regarding flashing kernels. This was my first try, and it didn't work out too well.
I needed to test the USB OTG/Host Functionality for a project at work, and i read that it was possible to enable it on the Nexus S by flashing a custom kernel (kernel_usbhost_build5_icsnexuss from sztupy). It's probably worth mentioning that prior to this i updated the phone to Android 4.0.3.
So i started this morning by rooting it, unlocking the bootloader and installing CWM.
At that point i realized that the recovery mode wasn't accessible : the graphics of the droid with an open belly appears for half a second, and then it gives me the black screen treatment for about a minute before rebooting.
However since there are other ways to flash kernels, i figured i could do without recovery so i didn't look more into it.
I then flashed the kernel using fastboot with this command :
Code:
C:\Program Files\Android\android-sdk\tools>fastboot flash:raw boot H:\data\Downloads\kernel_usbhost_build5_icsnexuss\kernel\zImage
creating boot image...
creating boot image - 3446784 bytes
sending 'boot' (3366 KB)...
OKAY [ 0.422s]
writing 'boot'...
OKAY [ 0.500s]
finished. total time: 0.922s
From the trace i figured that all went well, but when i reboot it stays blocked on the splash screen with the Google logo. Since then i tried flashing several other kernels, without any success. Also tried to flash an update.zip (both ICS and GB) over fastboot but i get this error :
Code:
C:\Program Files\Android\android-sdk\tools>fastboot update H:\data\Downloads\upd
ate.zip
archive does not contain 'android-info.txt'
archive does not contain 'android-product.txt'
error: update package has no android-info.txt or android-product.txt
So to sum it up i now only have access to the bootloader, without recovery mode.
Before you all jump on me, i know what i did is bad habits (i should have tested the kernel before flashing it), i did it in a hurry without checking i had all sufficient knowledge, and to be honest i would probably have been more careful if was doing it on my personal device.
Truth is now i'm really desperate because i turned my company issued phone into a brick and don't have the slightest idea what to do about it...
Is there any guru out there who knows how i could get out of this ?
Thanks a lot !
Download clockworkmod recovery and use fastboot to flash it.
Fastboot flash recovery yourfilename.img
Enter recovery and mounts and storage and mount USB storage
Transfer the kernel you want to your SD card. The one you flashes isn't a kernel I'm almost sure.
Try a different one.
Then transfer a rom to your SD card.
Factory reset/full wipe, then go to mounts and storage and format everything except your sdcard.
DO NOT FORMAT YOUR SD CARD!!!
Once that is done go to install zip from sdcard and flash the rom and then the kernel and reboot. Should be fine then. Keep me posted.
..
Election Day said:
The image you need would be this ClockworkMod img. Save it somewhere, cd to the sdk/platform-tools/ directory and then do:
Code:
fastboot flash recovery /path/to/saved/file/recovery-clockwork-5.0.2.0-crespo.img
Just drag and drop the file in your terminal, after typing the space after "recovery".
Furthermore, what nodstuff said.
Click to expand...
Click to collapse
Ha ha oops! Forgot that part!
I usually just cd to the one where I have recovery saved!
..
Thanks a lot for answering so quickly !
I'll give it a try on Monday, let you know how it goes.
Election Day said:
Yes, you can also do that, of course. In that case you'd have to provide the full path for fastboot. Or maybe you don't have to on Windows? I don't really use that operating system to be honest.
In that case it would be something like:
Code:
C:\Program Files\Android\android-sdk\tools\fastboot flash recovery recovery-clockwork-5.0.2.0-crespo.img
Looking at OP's quotes that is probably the most logical way in this case, you're right.
Click to expand...
Click to collapse
No I just cd to downloads (where recovery file would be) in terminal, type: fastboot flash recovery xxxxxx img
And that's it.
I set the path to fast boot and adb in environmental variables in device manager.
Maybe that's why.
..
Just tried out your tips, worked like a charm !
However I had to wipe everything twice before it would let me update to 4.0.3, I would get this weird error :
file_getprop: failed to stat "/system/build.prop": No such file or directory
Anyway now I'm back on ICS and, following your advice, i found another kernel to flash : Matr1x. No problem with this one, now I can test USB OTG.
Thanks again, you guys rule !

md5 missing

trying to install http://forum.xda-developers.com/showthread.php?t=2181399 and it says my md5 is missing so there for i cant install the rom... cant figure it out and need to have my phone back.. also backup is failing as well
phatryan69 said:
trying to install http://forum.xda-developers.com/showthread.php?t=2181399 and it says my md5 is missing so there for i cant install the rom... cant figure it out and need to have my phone back.. also backup is failing as well
Click to expand...
Click to collapse
leave both those options unchecked when flashing. You check the MD5 on your PC using an md5 checking application or you can do it with an md5 check app on your phone, but not during flash.
exad said:
leave both those options unchecked when flashing. You check the MD5 on your PC using an md5 checking application or you can do it with an md5 check app on your phone, but not during flash.
Click to expand...
Click to collapse
but if my md5 is missing even b4 i flash what must i do then? cause i thought md5's were added in the file itself.
Read what Exad said and try again.
Turn off md5 checking in recovery and do it manually yourself before flashing.
Sent from my Evita
had no idea htc phones were such a PITA to install and such. long time samsung guy... i thought i did everything right but said failed when i tried to install...
Not really a pain in the ass, I've never had an issue.
So you turned off md5 checking and it still failed?
Did it give an error code?
Which recovery are you using?
Sent from my Evita
---------- Post added at 03:46 AM ---------- Previous post was at 03:22 AM ----------
PS. an md5 is not "added to a file", nor is it "a part of a file". An md5 is merely a hexadecimal readout of the contents of that file.
Here's how it works: A file is created, in our case it is a zip file. The creator or publisher of that file uses an md5 generator to generate the md5sum, which as I said before, is just a numerical readout (like a fingerprint) of the contents of that file. Now the end user has a tool to make sure that the file hasn't been compromised during a download or transfer. Using an md5 checker is a simple way to verify that the file is uncompromised. Input the md5 given by the publisher into an md5 checking app, then the app calculates the md5 of the file you've downloaded, if they match you know the file integrity is good.
Sent from my Evita
I don't find it to be a PITA either...
I mean, if you're rooting.. a lot of this stuff should be familiar or already make sense.
Idk just seems like I'm either missing a step or not doing something right.. I've followed everything I can as far as loading ROMs extracting boot.IMG and flashing in fast boot then booting into recov then flashing like u normally would and everything then pops up and says failed missing md5.. I can get root and everything fine but the minute I get to flashing a ROM I have a problem.. Maybe I needs step back and relook over what I'm doin
Using twrp btw
Sent from my SGH-I927 using xda app-developers app
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using?
Sent from my Evita
what ver. of twrp?
timmaaa said:
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using
i have everything unchecked that could be unchecked yes... and 2.5.0.0
Click to expand...
Click to collapse
phatryan69 said:
timmaaa said:
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using
i have everything unchecked that could be unchecked yes... and 2.5.0.0
Click to expand...
Click to collapse
I would recommend upgrading TWRP to 2.6.0.0. 2.5 had some issues with this phone (mostly with Sense ROMs in my experience). In TWRP > Settings make sure "Zip file signature verification" is unchecked. I think that sets the overall default. Otherwise I think you have to uncheck it each time on the screen where you "Swipe to Confirm Flash".
Click to expand...
Click to collapse
phatryan69 said:
timmaaa said:
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using
i have everything unchecked that could be unchecked yes... and 2.5.0.0
Click to expand...
Click to collapse
2.5 has issues.
flash 2.6
then fastboot erase cache
then do a factory reset in twrp
Then try again.
Click to expand...
Click to collapse
having alot of problems with my computer nor recognizing my phone as well it seems... just uninstalled and reinstalled all drivers as well but only in bootloader when it says that trying to send commands to the phone.
installing 2.6
idk what i did but i got my phone on that rom and running...is there a list of fastboot commands somewhere?>
Not that I know of. Some that should work don't work also so... Maybe ill write one up later.
Sent from my HTC One X using xda app-developers app
phatryan69 said:
idk what i did but i got my phone on that rom and running...is there a list of fastboot commands somewhere?>
Click to expand...
Click to collapse
exad said:
Not that I know of. Some that should work don't work also so... Maybe ill write one up later.
Sent from my HTC One X using xda app-developers app
Click to expand...
Click to collapse
Just running "fastboot" will give you a list of sorts, but I don't know that most of those should ever be run by most of us. A list of the useful ones and what they do would be awesome, exad!
Code:
C:\Users\username>fastboot
usage: fastboot [ <option> ] <command>
commands:
update <filename> reflash device from update.zip
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
format <partition> format a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it
devices list all connected devices
continue continue with autoboot
reboot reboot device normally
reboot-bootloader reboot device into bootloader
help show this help message
options:
-w erase userdata and cache (and format
if supported by partition type)
-u do not first erase partition before
formatting
-s <specific device> specify device serial number
or path to device port
-l with "devices", lists device paths
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address
-n <page size> specify the nand page size. default: 2048
-S <size>[K|M|G] automatically sparse files greater than
size. 0 to disable
Since moving to cwm i haven't had an issue. I had tons of issues with twrp after 2.3.x.x i moved when cwm got official and haven't changed back. We also latest cwm builds from mdmower i believe the alias is, ill post a link when i get home.
DvineLord said:
Since moving to cwm i haven't had an issue. I had tons of issues with twrp after 2.3.x.x i moved when cwm got official and haven't changed back. We also latest cwm builds from mdmower i believe the alias is, ill post a link when i get home.
Click to expand...
Click to collapse
I've always had cwm might have to try that for a while
Sent from my HTC One X using xda app-developers app
Since TWRP 2.6 was released, I would have a hard time switching. They even made Wiping quicker and easier. I'd take a look at it if I was you. I've seen an issue with someone going from CM to TWRP and no longer being able to mount/access there SD card in TWRP. Dunno who's fault that is but they had to flash over an older non touch CWM and then fastboot erase cache and then flash TWRP. What a pain.

[Q] Flashing stock via fastboot error message

Hi, I want to (re-)flash the stock 4.1.2 rom on my Photon Q, because I recently run into some problems of the phone sending messages to the number 8737 even after I had removed the stock sms app.
This should be the right rsd file:
Code:
asanti_c_sprint-user-4.1.2-9.8.2Q-122_XT897_FFW-5-6-release-keys-cid9.xml.zip (MD5: 88f43a03d313bbcc262db78f15ac957c)
I'm on linux and I don't have any Windows system I could install and run RSDLite on. So I decided to take the fastboot way: I unzipped the above file and tried flashing the rom manually. But I always run in to the following error output:
Code:
# fastboot flash cdrom cdrom
(bootloader) Variable not supported!
target reported max download size of 31457280 bytes
Invalid sparse file format at header magi
error: write_sparse_skip_chunk: don't care size 22923264 is not a multiple of the block size 4096
fastboot: ../libsparse/sparse.c:143: write_all_blocks: Assertion `pad >= 0' failed.
Note that "fastboot devices" lists the Photon Q as "T069503UAP fastboot". The same or a similar error messages applies to "fastboot flash system system.img" etc. I use fastboot from the Fedora 20 "android-tools" package (version 20130123git98d0789-2).
Any ideas what's the problem here? Solution?
Thanks in advance!
It's dangerous to try and fastboot the items yourself. Would be better to borrow a Windows PC or something to use RSD (virtual machines are also NOT recommended for this).
But perhaps you should just try to fastboot the other partitions. Not sure 'cdrom' is needed. Either way, I strongly, STRONGLY advise against doing what you are doing.
Okay, thanks for your advice!
The same or similar error messages appear when flashing the other partitions (as already mentioned in the first post). Unfortunately, it's really hard to find somebody with a Windows system, at the moment. I thought RSDLite uses fastboot internally anyway.
I'm not sure if the FXZ images can be flashed as they are, via fastboot.
I believe they should be converted to the standard ext4 format via the simg2img.py pytoon script, before being usable.
I repeat I'm not sure, but I believe that hardly motorola's own format is handled correctly by the fastboot command.
Whatever, for your convenience, I attach the mentioned converter script.
Aside fastboot, can be used for a variety of other purposes, the ext4 images can be mounted straight in Linux via loopback device or extracted in windows with a bunch of tools, personally I use Ftk Imager.
Thanks, that tool is great! After conversion, I was indeed able to mount the system partition as follows:
Code:
# mount -o ro,loop system_converted.img /some/mnt/path
But it doesn't help with the other files (cdrom, boot.img, recovery.img), because they seem to have a different format. However, the system partition was all I wanted. Now, instead of reflashing, I'm going to compare the system partition's files (especially in the "app" folder) and see what might have caused my problem.
tuxor1337 said:
But it doesn't help with the other files (cdrom, boot.img, recovery.img),
Click to expand...
Click to collapse
The boot, recovery and similar partitions aren't written on top of a filesystem like /system or /data.
they are written as they are on top of the physical media.
you can safely flash them in any way: fastboot, restore by recovery and so on.
unlike the filesystem based partitions, they are always in the same format.
If you need to edit the boot or recovery content you need a special script to unpack and repack them, many android kitchens have it
I was just wondering whether flashing on Linux will work when using "moto fastboot" like this one: http://forum.xda-developers.com/showthread.php?t=1138092
I don't really need this functionality anymore. But out of curiosity: What do you think?
My photon has a broken USB connector, so I can't test it in first person.
Btw, I believe that testing is the only way to understand what is flashable and what not, obviously taking handy a good full nandroid backup.

NVIDIA Shield Unlock Bootloader FAILED <Remote: <>

Good afternoon-
I recently picked up a NVIDIA Shield from a friend of mine because it would not turn back on for him. It is currently stuck at the NVIDIA Boot screen. I can access the Bootloader and I can access stock recovery. However, when I attempted to use Fastboot to unlocked the bootloader I receive the below...
(bootloader) Showing Options on Display.
(bootloader) Use device keys for selection.
(bootloader) erasing userdata...
(bootloader) erasing userdata done
(bootloader) erasing cache...
(bootloader) erasing cache done
(bootloader) unlocking...
FAILED (remote: ()
finished. total time: 3.872s
I am using "Fastboot OEM Unlock" and it does prompt me on the Shield to unlock, but once I select unlock it bounces right back to the bootloader and fails. I tried wiping data and factory reset via stock recovery, but when I do I receive an E: Failed to Mount /Cache (Invalid Argument). It will not let me read/write any of my user data files at all. It seems as if they are corrupt, but I am not quite sure.
I am looking for a way to get this thing back up and running. I am perfectly fine with losing all data on it. Is there a stock kernal that I can flash with a locked bootloader? I fear the issue is with the bootloader or corrupted EMMC. I am open to any and all suggestions!
Make sure that your USB cable is plugged into a USB 2.0 port directly connected to your motherboard as sometimes USB 3.0 ports can cause problems and front panel USB connections can be unreliable.
from: https://forum.xda-developers.com/showthread.php?t=2399737
In case it is interesting, (if someone get managed) it should be possible to boot into twrp recovery with locked bootloader.
- Linux only - (I have not tested and can not confirm if this works. maybe i have a thinking blunder)
first we need a u-boot from another unlocked (similar) device (not sure about size?)
Code:
dd if=/dev/mmcblk0boot0 of=u-boot-dtb-tegra.bin bs=1048576 count=1
second we can boot this u-boot without flashing
Code:
tegra-uboot-flasher exec u-boot-dtb-tegra.bin
third we can boot twrp from fastboot
Code:
fastboot boot twrp-3.3.1-0-shieldtablet.img
Pre-requisites
you need to create your own cbootimage-config
https://github.com/NVIDIA/cbootimage-configs/tree/master/tegra124/nvidia
Adding Board Support
====================
If that doesn't work out, you may create the required configuration files
using the following process:
1)
Extract the BCT from the existing device. Various methods exist to do this:
1a)
Recent versions of tegrarcm now have the capability to read the BCT from the
device without requiring any HW-specific binaries, nor code already installed
on the device:
tegrarcm --bct board.bct readbct
1b)
If you have access to Linux running on the device already, then you can use
dump the memory device directly:
For devices which boot from eMMC:
dd if=/dev/mmcblk0boot0 of=bct.bin bs=65536 count=1
For devices which boot from SPI:
dd if=/dev/mtd0ro of=bct.bin bs=65536 count=1
1c)
If you have a working nvflash for your device, then this can also extract the
BCT:
nvflash --bl fastboot.bin --getbct --bct board.bct
If that doesn't work, you could try reading the content of the BCT partition
or the start of the raw device, then extracting the BCT:
nvflash --bl fastboot.bin --read 2 board.bct
or:
nvflash --bl fastboot.bin --rawdeviceread 0 128 board.bct
Note that some of the above commands extract many more bytes of data that is
strictly required. However, this avoids updating these instructions for each
new chip; Tegra20's BCT is just under 4KiB, Tegra30's around 6KiB, etc.
2)
Convert the BCT to a cbootimage configuration file:
bct_dump board.bct > board.bct.cfg
This will de-compile the extracted BCT binary into a text configuration file
suitable for later use by cbootimage.
To follow the same structure as the rest of the configuration files in this
project, it's then best to split up board.bct.cfg into separate board.bct.cfg
(DevType, DeviceParam, and SDRAM lines), and board.img.cfg (all other header
parameters). Use the existing configuration files as a guide.
Once you have performed these steps, you will have configuration files
suitable for your personal use. We don't accept contributions to this project
that were derived in this fashion. We encourage you to contact the vendor
and request them to submit their own configuration files.
Click to expand...
Click to collapse
tegra-uboot-flasher
https://github.com/NVIDIA/tegra-uboot-flasher-scripts
Introduction
============
This project provides scripts and data that provide a simple way of using
tegrarcm and U-Boot to write U-Boot (or an alternative image) to the boot
flash of a Tegra device.
The flash images handled by this tool include just the bootloader and any
other data necessary for the bootloader to execute (i.e. the BCT). Creating or
flashing a root filesystem, either on the Tegra device's built-in flash, or on
external storage media, is a separate step unrelated to this tool.
Pre-requisites
==============
This document assumes that the instructions in README-developer.txt have
already been followed. Those instructions generate various files that the
flashing process uses. These include host-based utilities such as tegrarcm,
U-Boot binaries that run on the Tegra target device, and the flash images to
write to the Tegra device.
If you are using a distribution package of this tool, the development steps
have likely already been followed, and you need only follow the instructions
in this file.
If you are working with the source code to this tool, you almost certainly
need to follow the instructions in README-developer.txt first.
Board Configurations
====================
Every Tegra board design has a name. Examples are Harmony or Cardhu.
Each board may exist in a number of different configurations; perhaps the
RAM size or speed varies, or a different type of boot flash is supported.
Each of these configurations is also given a name. tegra-uboot-flasher's
user-interface uses these configuration names exclusively. Examples are
harmony, cardhu-a02-1gb, cardhu-a04-1gb.
You may find a list of valid values for configname by executing:
tegra-uboot-flasher list-configs
Simple Usage - Flashing
=======================
To flash a board, connect a USB cable from your host PC to the Tegra device,
place that board into USB recovery mode, and execute the following as root
on the host machine:
tegra-uboot-flasher flash CONFIG
This will download code and data to the Tegra device and execute a flashing
routine. Once this is complete, the system will reboot into the freshly
flashed boot image, and the system will proceed to boot normally. Depending
on the board and U-Boot support, the flashing process may be observed via the
debug serial port, or on a built-in LCD panel.
Simple Usage - Testing U-Boot
=============================
If you simply want to download an unmodified U-Boot to the Tegra device and
execute it, execute the following as root on the host machine:
tegra-uboot-flasher exec CONFIG
This can be useful for quickly testing changes to U-Boot without writing it
to flash every time. This mode of operation is a very simple wrapper around
tegrarcm, which eliminates the need to remember which BCT to use for each
board configuration.
Advanced Options
================
A number of command-line options exist to control tegra-uboot-flasher's
behaviour. For example, you may specify an alternate image to be written
to boot flash, load configuration data from an alternate location, save
the temporary files created during execution for later analysis, etc.
Execute tegra-uboot-flasher with the --help option to see a description
of these options.
Click to expand...
Click to collapse

Error trying to flash 8.1 factory image

I sideloaded the 8.1 OTA yesterday. However, I'm having issues with my finger print sensor and want to do a clean flash of the whole image. I downloaded the Walleye .011 image file from Google's site this morning. When I attempt to flash the image using the flash-all command, I receive the following error:
wiping userdata...
CreateProcess failed: The system cannot find the file specified. (2)
mke2fs failed: -1
error: Cannot generate image for userdata
I have my bootloader unlocked but am not rooted. The phone is currently on the .011 build but it will not let me flash the image. Any ideas? I've also downloaded the latest platform tools in case that was an issue.
Thanks,
Rick
C5Longhorn said:
I sideloaded the 8.1 OTA yesterday. However, I'm having issues with my finger print sensor and want to do a clean flash of the whole image. I downloaded the Walleye .011 image file from Google's site this morning. When I attempt to flash the image using the flash-all command, I receive the following error:
wiping userdata...
CreateProcess failed: The system cannot find the file specified. (2)
mke2fs failed: -1
error: Cannot generate image for userdata
I have my bootloader unlocked but am not rooted. The phone is currently on the .011 build but it will not let me flash the image. Any ideas? I've also downloaded the latest platform tools in case that was an issue.
Thanks,
Rick
Click to expand...
Click to collapse
Are you running it from the directory where the image is?
C5Longhorn said:
I sideloaded the 8.1 OTA yesterday. However, I'm having issues with my finger print sensor and want to do a clean flash of the whole image. I downloaded the Walleye .011 image file from Google's site this morning. When I attempt to flash the image using the flash-all command, I receive the following error:
wiping userdata...
CreateProcess failed: The system cannot find the file specified. (2)
mke2fs failed: -1
error: Cannot generate image for userdata
I have my bootloader unlocked but am not rooted. The phone is currently on the .011 build but it will not let me flash the image. Any ideas? I've also downloaded the latest platform tools in case that was an issue.
Thanks,
Rick
Click to expand...
Click to collapse
I had the same issue with my 2 XL and it was driving me crazy.
The only way I was able to get the factory image to flash is by removing the -w flag near the bottom of the script. I couldn't figure out what was going wrong and have never needed to modify the script for a factory image to flash.
your problem could be easily solved by restoring factory settings.
have you compared the SHA-256 Checksum hashes? It may/might explain or expose if something is missing...
I mean it's doubtful that you've gone this far where it would be something like that, but you never know... small but won't hurt to try and if that ends up being it, then it's a small thing and keeps you from going all too far...
Thanks for all the replies. I have not compared a checksum yet, but will validate they are the same.
I wanted to flash the whole image as a way to completely clean install the system and my apps. Wouldn't a factory reset only remove my data and configuration settings? If there was an issue with the system files, those wouldn't be fixed, correct?
Thanks,
Rick
Sent from my Pixel 2 using Tapatalk
osi13 said:
I had the same issue with my 2 XL and it was driving me crazy.
The only way I was able to get the factory image to flash is by removing the -w flag near the bottom of the script. I couldn't figure out what was going wrong and have never needed to modify the script for a factory image to flash.
Click to expand...
Click to collapse
How I can do that ( removing the -w flag near the bottom of the script ) pls help
zetareticuli said:
How I can do that ( removing the -w flag near the bottom of the script ) pls help
Click to expand...
Click to collapse
You want to remove the -w flag from flashall.sh or flashall.bat.
osi13 said:
You want to remove the -w flag from flashall.sh or flashall.bat.
Click to expand...
Click to collapse
problem solved i found the (-w) but the problem now is i can't flash or install one ROM to start the process to go out of the bootloop problem.. no recovery mode, i can't install TWRP, the phone are connecting with my comp and i has tryied flash many stock rom's and flash the 4 core.img, but nothing works can you help me??

Categories

Resources