On Sun, Oct 31, 2021 at 10:10 AM Rob Shore <robertms6@gmail.com> wrote:
Hello!

I've just discovered Flashrom as a way to use a Dediprog SPI programmer with MacOS, which is awesome.  I've got a bit of a strange question though:

I've got a 1Mbit rom on a board, but the image I was given for it is for a 2Mbit part. The firmware itself in the raw image is < 1Mbit, but the file is still larger than my ROM. Flashrom won't run the flash saying "Error: Image size (262144 B) doesn't match the flash chip's size (131072 B)!", which is technically correct. Is there a way to force the flash, and just have the process end after the first 131072B, which would result in the data I need being on the ROM?

Thanks, and looking forward to using this tool some more!

Try one of these:
- Use a layout file to tell flashrom exactly where you intend to write: `echo "00000:01ffff fw" > layout.txt && flashrom -p dediprog -l layout.txt -i fw --noverify-all -w <file>`
- Create a new file that is the appropriate size, for example using `dd if=<original_file> of=<new_file> bs=1k count=128`

The size check is an intentional UI decision to help prevent writing an incorrect file to the flash. A little bit of extra caution here is typically much easier than recovering a bricked host.