[flashrom] flashrom ignoring ROM layout region

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Fri Feb 8 07:25:40 CET 2013

On Thu, 7 Feb 2013 16:09:45 -0800
John Gainsborough <jgindc1 at gmail.com> wrote:

> Hi Stefan.
> I am now attempting to write to a flashrom using the layout/region
> approach. I need to write a region from a 4MB ROM to the beginning of an
> 8MB ROM.
> The region image from the 4MB ROM is 4,128,768 bytes == 0x3f0000 long and
> this file is called image1.
> I have defined the 8MB ROM layout in file called romlayout_8MB to be:
> 000000:3effff main
> 3f0000:7fffff remainder
> i.e I want to place the contents of file image1 in to the 8MB ROM region
> defined as main.
> I invoked flashrom as follows:
> flashrom -p buspirate_spi:dev=/dev/ttyUSB0,spispeed=250k -l romlayout_8MB
> -i main -w image1
> The flash ROM is detected correctly, delay calculated, but then flashrom
> immediately returns the error:
> "image size doesn't match".
> As always, guidance/suggestions gratefully received.

That's one of the other things my patches fix :)
The image you supply with -v/-r/-w is always used to present a mapping
of the whole chip. The layout information is only used to select the
address range inside that mapping. So for vanilla flashrom you have to
create an 8MB file and fill the first 4MB with the content you want and
continue as you have done.

With my patches one can add an image name to any -i parameter (e.g. -i
main:main.img) which is then mapped to the corresponding offset. IIRC
one has still to supply a whole image with the correct size, but if the
needed ranges are also present as "-i images" then it would not be used
at all. Similar for the read operations: it would create a whole image
with a lot of 0xFFs outside the selected regions and smaller/exact
files for the "-i images".

Maybe I have some time at the weekend to integrate the patches. I think
there is consensus that we want them in and they have been tested by a
number of people, so i think it should not break too much :)
Kind regards/Mit freundlichen Grüßen, Stefan Tauner

More information about the flashrom mailing list