Closed Bug 928659 Opened 11 years ago Closed 10 years ago

fastboot flash not rebooting into bootloader

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: diafygi, Unassigned, NeedInfo)

Details

(Whiteboard: [SUMO-b2g])

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0 (Beta/Release)
Build ID: 20130911164256

Steps to reproduce:

1) Buy ZTE Open.

2) Add udev file to allow adb and fastboot to find device.
$ cat /etc/udev/rules.d/51-android.rules 
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
$ adb devices
List of devices attached 
roamer2	device
$ adb reboot bootloader
<wait a few seconds>
$ fastboot devices
ROAMER2	fastboot

3) Follow instructions in docs on building B2G.
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Preparing_for_your_first_B2G_build
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Building

3) Attempt to flash B2G build to device.
$ ./flash.sh
< waiting for device >
erasing 'cache'...
OKAY [  0.531s]
finished. total time: 0.531s
erasing 'userdata'...
OKAY [  1.407s]
finished. total time: 1.407s
sending 'userdata' (49378 KB)...
OKAY [  4.175s]
writing 'userdata'...
FAILED (status read failed (No such device))
finished. total time: 9.494s


Actual results:

The flash failed with an error saying "No such device". Error details:
1) After sending 'userdata' and outputting OKAY, the ZTE Open rebooted.
2) However, after rebooting the device did not go into bootloader mode.
3) Therefore, fastboot could not find the device (thus FAILED).
4) "adb devices" does show the device, however.

Manually trying to flash has the same error:
$ fastboot flash system system.img 
sending 'system' (111020 KB)...
OKAY [  9.394s]
writing 'system'...
FAILED (status read failed (No such device))
finished. total time: 14.748s


Expected results:

I would have expected for the device to reboot into bootloader mode so that fastboot could continue with the flash (i.e. writing 'userdata' or 'system').

Please let me know how I can assist in troubleshooting this.
Ok, I've pinpointed the exact spot in fastboot where the bug is occurring:

In engine.c[1], fb_queue_flash() first sends the data to the device (line #383), then tells the device to flash the partition via a "flash:boot" or "flash:recovery" command (line #388).

However, when usb_write() and ioctl() are eventually called for the "flash:boot" or "flash:recovery" command in usb_linux.c[2] (line #363), this causes the device to reboot.

When the device reboots, it no longer has the same usb_handle as previously. Thus, when usb_read() tries to read the response of the usb_write() in usb_linux.c[2] (line #400), it can't find the usb_handle it has stored as a variable (since the reboot/reconnect didn't allot the same fname to the device). This is why I get a "No such device" error.

So, the real problem is why does sending a "flash:boot" or "flash:recovery" command to the device cause a reboot? Apparently, that's not supposed to happen. When fastboot sends other commands (like "getvar:max-download-size") it returns just fine without a reboot.

Does anyone know the internals of the ZTE Open that might explain why those commands are causing reboots?

[1] - https://android.googlesource.com/platform/system/core/+/master/fastboot/engine.c
[2] - https://android.googlesource.com/platform/system/core/+/master/fastboot/usb_linux.c
Component: Hardware → Gaia::System
Ok, I think this bug is the typical behavior when attempting to flash to a Revision 01[1] ZTE Open where fastboot doesn't work properly. You will need to update the phone via recovery mode to the Revision 02[2] version before flashing via fastboot will work.

NOTE: The below instructions are for the US version of the ZTE Open only (since that's what I have).

How to tell if you're on Revision 01:
1) Boot phone normally.
2) Go to Settings > Device Information > Software
3) The version should be OPEN_US_DEV_FFOS_V1.0.0B01
4) If it says OPEN_US_DEV_FFOS_V1.0.0B02, you shouldn't have had this flashing bug (please comment and re-open this bug).

How to update to Revision 02:
1) Obtain a microSD card and format it to FAT32.
2) Put the newly formatted microSD card into your phone.
3) Boot your phone normally (this will automatically put some files on your microSD card).
4) Turn off your phone and remove the microSD card.
5) Download the Revision 02 update[3].
6) Extract US_DEV_FFOS_V1.0.0B02_USER_SD.zip from the download.
7) Copy US_DEV_FFOS_V1.0.0B02_USER_SD.zip to the root folder of your microSD card.
8) Put the microSD card back into your phone.
9) Boot the phone into recovery (hold POWER + VOL-UP simultaneously for 5sec when turning the phone on).
10) Select "apply update from external storage" by using the VOL keys to navigate up and down and the POWER button to select.
11) Select US_DEV_FFOS_V1.0.0B02_USER_SD.zip on the directory listing.
12) The phone will proceed to update to Revision 02.
13) If you get a "E:signature verification failed" error during the update, you may have updated to something else before updating to Revision 02. I ended up having to return the device and get a new one. Mozilla says they are working on this[4].
14) Once your phone is updated to Revision 02, you should be able to flash normally[5].
15) You will likely have to manually copy a modified boot.img to the compile folder (where userdata.img is after building) to get around a system time error[6].


[1] - https://developer.mozilla.org/en-US/Firefox_OS/Developer_phone_guide/ZTE_OPEN#Revision_01
[2] - https://developer.mozilla.org/en-US/Firefox_OS/Developer_phone_guide/ZTE_OPEN#Revision_02
[3] - http://www.ztedevices.com/support/smart_phone/b5a2981a-1714-4ac7-89e1-630e93e220f8.html
[4] - https://groups.google.com/d/msg/mozilla.dev.b2g/pPLsGpEUqxc/xLTafOE33egJ
[5] - https://developer.mozilla.org/en-US/Firefox_OS/Preparing_for_your_first_B2G_build
[6] - https://developer.mozilla.org/en-US/Firefox_OS/Developer_phone_guide/ZTE_OPEN#Device_support
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Hey Michelle, do we have a SUMO article on this?  I think maybe it might be good to have one?  If you want me to write up a draft I can...
Flags: needinfo?(mluna)
Whiteboard: [SUMO-b2g]
I spoke with mluna, it would be better if it was a mozdev article instead.
Flags: needinfo?(mluna)
Flags: needinfo?(eshepherd)
Maybe this bug should be reopened, because as of now if you update to what zte has on its website on http://www.ztedevices.com/support/smart_phone/b5a2981a-1714-4ac7-89e1-630e93e220f8.html - ie EU_DEV_FFOS_V1.1.0B04_UNFUS_SD.zip - then you end up with a broken fastboot too. (ie fastboot flash reboots the device, as described in comment 2)
I'm running v1.1 from ZTE and fastboot is broken for me too.
Apparently they should be releasing it later this week:
https://groups.google.com/d/msg/mozilla.dev.b2g/wz3MiQ4wZDI/xqnOfoidceEJ

Will update this bug when I have confirmed that the did release it. Reopening in the mean time.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Its doesn't seem to out yet.

For now downgrading it to the older v1.0B02 release seems to work. Obviously, you need to root your device and install Clockworkmod( a third-party recovery tool) for the downgrade to succeed. For some reason Zte decided to disable downgrading to an older firmware throught their factory recovery tool :(
Looks like they released a new version as of 1/20 (last week).  I was able to get to fastboot using the ebay US version.  Can you try again please?
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago10 years ago
Resolution: --- → FIXED
I've the same problem.
I've corrupted the whole system partitions.
Now the phone boot only in fastboot (attached to USB, with or without the battery).
The volUP+Power doesn't anything and the volUP+volDOWN put the phone in download mode, that maybe can used with QPST programs or similar.

If someone know how can fix this trouble, can help me?
However, if anyone can help me, I've a zte open to give away... ;-)

Thank you
You need to log in before you can comment on or make changes to this bug.