[flashrom] Breaking the assumption that filesize == romsize

Richard A. Smith richard at laptop.org
Thu Nov 18 21:14:16 CET 2010


On 11/18/2010 12:48 PM, Carl-Daniel Hailfinger wrote:

> On 18.11.2010 16:51, Richard Smith wrote:
>> Current flashrom forces that the loaded filesize must equal the
>> romsize.  If you are using an external programmer then this may not be
>> true.
>>
>
> Can you give an example use case?

Certainly since I'm exactly this case.  The EnE EC chips that I use 
KB3700,KB3930 have an address space of 64k. However, these parts can 
share space with the system firmware and the EC itself can use an SPI 
part that is much bigger (I forget exactly how big) The OLPC system used 
an 8Mbit part on both XO-1 and 1.5.

When doing EC work I'm only interested int the lower 64k and thats the 
size of file my build system generates.  The 64k blob gets sucked into 
the larger firmware image when we build the system firmware.

On the XO 1.75 the EC has its own SPI flash but you can't get a 64k SPI 
flash so its 128k.

When I want to program the EC directly with a programmer I only want to 
program the lower 64k.

Since my generated files are 64k in size flashrom won't load them unless 
I change my build system to generate files that match the size.

>> How deeply wired is this assumption?  I'd like to bypass those checks
>> it if the -p option is used.
>>
>
> The underlying problem is that flashrom can't know if you want
> top-aligned or bottom-aligned write. If you only want to write a part of
> the chip, you can do that with the layout feature, but that still
> requires an image file with full size. Suggestions are welcome on how
> flashrom should detect the alignment wanted by the user. (The famous
> "DoWhatIMean" function has not been implemented yet.)

The answer is don't try to guess.  Always use bottom aligned.  Thats 
what the --offset command is for.  Every programmer I've used for the 
last 20 years (probably about 10) works this way.  Its expected and 
intuitive.  You feed it a file and a chip type (if it can't autodetect) 
and it just programs that data starting at address zero.

-- 
Richard A. Smith  <richard at laptop.org>
One Laptop per Child




More information about the flashrom mailing list