Closed TomKing062 closed 1 year ago
maybe it's cause by gcc(or system related)? hardcoded 2147483647 is not good, this just solved my own solution.
Can you show the end of the partition table from the .xml?
<Partition id="userdata" size="0xFFFFFFFF"/>
</Partitions>
Did you compile on Windows or Linux?
windows msys2 mingw64
Okay, then it's the same problem as with the strtol() function on Windows.
fixed: https://github.com/ilyakurdyukov/spreadtrum_flash/commit/fa20bcc314c931e0c790ba62ab028706d802ccc3
Windows saturates values read from scanf/strtol, while Linux truncates them.
https://github.com/ilyakurdyukov/spreadtrum_flash/blob/6886a85e6e9d80a5e02d8c9afd1c991b20a36b35/spd_dump.c#LL826C2-L826C2
now the packet end with userdata size ff ff ff 7f (BSL_REP_OPERATION_FAILED, 0x84)
add
if(size == 2147483647) size = -1;
beforeWRITE32_LE(buf + 0x48, size);
then the packet end with userdata size ff ff ff ff (repartition successfully)