ilyakurdyukov / spreadtrum_flash

Spreadtrum firmware dumper for Linux
102 stars 33 forks source link

repartition failed #3

Closed TomKing062 closed 1 year ago

TomKing062 commented 1 year ago

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; before WRITE32_LE(buf + 0x48, size);

then the packet end with userdata size ff ff ff ff (repartition successfully)

TomKing062 commented 1 year ago

maybe it's cause by gcc(or system related)? hardcoded 2147483647 is not good, this just solved my own solution.

ilyakurdyukov commented 1 year ago

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?

TomKing062 commented 1 year ago

image windows msys2 mingw64

ilyakurdyukov commented 1 year ago

Okay, then it's the same problem as with the strtol() function on Windows.

ilyakurdyukov commented 1 year ago

fixed: https://github.com/ilyakurdyukov/spreadtrum_flash/commit/fa20bcc314c931e0c790ba62ab028706d802ccc3

Windows saturates values read from scanf/strtol, while Linux truncates them.