I was bothered by having to read all the contents of an empty flash
before programming just a boot loader to it. It's particularly long
when using a buspirate board. I looked into the code to see how to
bypass this and discovered it was already planned but not implemented
due to the (presumably) complex API of the doit() function.
I took a different route : I'm using 3 different write levels in write_it:
- normal write (read first)
- trusted write (no need to read but still erase)
- fully trusted write (flash assumed to be clean)
These ones are set using a new "-t" flag for which I have even updated
the man page and indicated that it's not recommended.
It worked well for me so I'm sending the patches assuming they'll be
useful for someone else.
BTW, to give you a bit more context, I was writing a 8MB flash to upgrade
a small router from its 4MB one, so I just had to add 4MB of \xff after the
existing image before flashing it.