Hi Willy, You might be interested in another approach that is used in the chromium branch https://chromium.googlesource.com/chromiumos/third_party/flashrom. The "--diff" longopt allows the user to supply a file to diff against the -w argument. This is useful in cases where the user wishes to skip the initial read step, and flashrom will figure out which blocks need to be erased and written thereby eliminating unnecessary erase/write operations as well.
There is some documentation for it here: https://sites.google.com/a/chromium.org/dev/chromium-os/packages/cros-flashr...
On Thu, Sep 10, 2015 at 2:13 PM, Willy Tarreau w@1wt.eu wrote:
Hello,
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.
Best regards, Willy
flashrom mailing list flashrom@flashrom.org http://www.flashrom.org/mailman/listinfo/flashrom