answered
2019-10-06 15:24:48 +0200
After trying to use the flashing script that @coderus linked me at https://github.com/mer-hybris/droid-config-sony-nile/blob/master/sparse/boot/flash.sh the syntax error went away.
However, the device would still not flash properly; the script would tell me
> ./flash_upstream.sh
Detected Linux
Searching device to flash..
No device that can be flashed found. Please connect your device in fastboot mode before running this script.
In a different terminal, I ran the following:
# ./fastboot devices -l
CQ3001HC3L fastboot usb:3-13.1
so the device obviously isconnected in fastboot mode. Next, I realized that the fastboot "address" starts with usb:3, so I decided to test the proposed workaround in the helpdesk article about flashing from USB3 ports: https://jolla.zendesk.com/hc/en-us/articles/360012031854
I ran the following command as root:
lspci -nn | grep USB | cut -d '[' -f3 | cut -d ']' -f1 | xargs -I@ sudo setpci -H1 -d @ d0.l=0
which turned all ports into USB2 ports temporarily. Now, when connecting the device, both dmesg and fastboot list the device as a USB2 device. But the flashing script still would not work on the device.
In the meantime, I had found that the device sometimes randomly restarts when issuing a fastboot command to it. I would hit enter in the terminal, the command would begin running, then the device would turn off and restart, and the command would hang forever. This happened randomly, and I was not able to identify some regular behaviour or pattern, or steps to reproduce it systematically.
I kept poking in the flashing script, and found that it essentially runs a number of fastboot flash [partition] [image file] commands. So, I decided to start running these manually. Without much success at first, the behaviour was still the same as described in the original post in this thread. The flashing command would just hang after sending.
Then, I came up with this idea: When I issue a fastboot command and the device reboots, I'll hold the Volume-Up button at the same time, so that it reboots back into fastboot mode. So, here are the steps:
- Run the flash command for the first partition
fastboot flash boot_a ${SAILFISH_IMAGE_PATH}hybris-boot.img
as root. - The device decides to reboot (you can see this when the blue LED turns off). The fastboot flash command will hang, do not interrupt it.
- Hold the volume up button while it does this, it will reboot back into fastboot mode.
- Once the device is back into fastboot mode, the flashing command will continue running and succeed!
I repeated this procedure several times for the other partitions that are flashed by the script:
fastboot flash boot_a ${SAILFISH_IMAGE_PATH}hybris-boot.img
fastboot flash boot_b ${SAILFISH_IMAGE_PATH}hybris-boot.img
fastboot flash userdata ${SAILFISH_IMAGE_PATH}sailfish.img001
fastboot flash system_b ${SAILFISH_IMAGE_PATH}fimage.img001
fastboot flash vendor_a ${SAILFISH_IMAGE_PATH}vendor.img001
fastboot flash vendor_b ${SAILFISH_IMAGE_PATH}vendor.img001
fastboot flash oem_a ${SAILFISH_IMAGE_PATH}SW_binaries_for_Xperia_Android_8.1.6.4_r1_v17_nile.img
(this is the vendor binary downloaded from the Sony website)
And it works.
If you, as a future reader, found this post because you have a similar issue, I'm sorry for the vague problem description and solution; I neither know what's actually going wrong nor why this fix works. But it did work for me, so I'm writing it up anyway, in case someone else actually ever encounters this same problem :D
try with upstream flash.sh:
https://github.com/mer-hybris/droid-config-sony-nile/blob/master/sparse/boot/flash.sh
coderus ( 2019-10-05 23:55:10 +0200 )editThat does fix the syntax error, but flashing doesn't even find the device now. Instead, the device reboots at this point, and the script exits with the following message:
The device is in fastboot mode and connected. In another terminal I can find it without problems:
pilino ( 2019-10-06 00:22:11 +0200 )editNot really having an idea but it could it be USB 3 issue? https://together.jolla.com/question/193348/xa2-flashing-issues/
And where did you get that erroneous flashing script from?
peterleinchen ( 2019-10-06 11:15:34 +0200 )edit@peterleinchen Yes, I had that suspicion as well, especially since dmesg would report the device as a USB3 devices even though the port is usb 2.... So I applied the workaround listed on the helpdesk article about USB3 flashing to downgrade all ports to USB2. The issue remains...
The flashing script with the error is the one included with the latest download version of Sailfish X for Xperia XA2 devices :/
pilino ( 2019-10-06 14:02:05 +0200 )editStrange.
I downloaded the 3.1.0.11 for H4113 few weeks ago and my flash script does not contain mentioned lines.
Are you sure you followed all steps? Install required dependences, extract the downloaded zip, change to that extracted directory... start command with prepended ".\"
Else I just do not know :(
peterleinchen ( 2019-10-06 15:05:27 +0200 )edit