mini update... working on the kernel and nisprog in parallel.
in this screenshot (see attachment):
First few lines is the code to match ECUID by similarity to find the most likely keyset to use (yay, no more typing two 32-bit hex keys !)
The last part is a test command "tfl" that compares CRC "checksums" over the whole ROM to determine which memory blocks were modified and need to be reflashed. As you can see in my test, blocks 1, 8 and 13 are different. The reason for this is mainly twofold :
- comparing CRCs takes about 6-7 seconds, instead of comparing a full dump which takes over 3 minutes for a 1MB ROM !!
- reflashing only the required blocks is a huge timesaver (from 8x to 256x faster !)
- bonus : leaving the other blocks alone can help with flash durability
The only drawback is that a CRC is not perfect. Currently I'm using one CRC16 per 256 byte chunks -- that is, 2 bytes of checksum for every 256B of data. It is very possible to find two different chunks that share a same CRC. (this is a well-known probability thing, "birthday problem")
I haven't done the math (someone please do, I'd like to see actual figure), but the takeaway is that it's very unlikely.
This is even more true since even the smallest flash blocks (4kB) are compared with 16 CRCs, and if there is a single different CRC the whole block is reflashed.
Still, I'll provide the reflash command with "orig_rom.bin" and "new_rom.bin" arguments so it can base its modified-block-selection on a file comparison instead. In other words :
- provide desired new_ROM.bin file
- select blocks to reflash, three options :
- full ROM, all blocks
- CRC comparison to select blocks, as described above.
- compare new_ROM.bin to a user-specified "old_ROM_contents.bin" to select blocks
- erase + write selected blocks