[flashrom] Breaking the assumption that filesize == romsize

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Nov 18 21:30:53 CET 2010


On 18.11.2010 21:14, Richard A. Smith wrote:
> 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.

I see. On x86, you would only want to program the upper 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.

This would introduce breakage for the main use case of flashrom: x86
BIOS. If you flash a smaller image to an x86 BIOS chip, it must always
be top 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.

It may be expected by people working with programmers, but how can we
tell x86 users with no standalone programmer experience that flashing
smaller images (with the suggested bottom alignment) bricks their
systems by default?

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the flashrom mailing list