Hi Stefan.<div><br></div><div>IIUC, I will need to first create a "parent" 8MB image in which the "main" region is placed in its correct relative location in "parent". I then invoke flashrom using the romlayout file and the image option as in "-i <span></span>main", and write option as in "-w parent". flashrom then extracts the region</div>
<div><span class="Apple-style-span" style> "main" from "parent" and flashes the ROM just with "main" region.</span><br></div><div><span class="Apple-style-span" style><br></span></div><div><span class="Apple-style-span" style>It would seem that your patches are the way to go if you have the time to merge them.</span></div>
<div><span class="Apple-style-span" style><br></span></div><div><span class="Apple-style-span" style>Many thanks Stefan (and to others) who are donating valuable time to enhance/maintain what is a great piece of software.</span></div>
<div><span class="Apple-style-span" style><br></span></div><div><span class="Apple-style-span" style>John</span></div><div><br>On Thursday, February 7, 2013, Stefan Tauner  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, 7 Feb 2013 16:09:45 -0800<br>
John Gainsborough <<a href="javascript:;" onclick="_e(event, 'cvml', 'jgindc1@gmail.com')">jgindc1@gmail.com</a>> wrote:<br>
<br>
> Hi Stefan.<br>
><br>
> I am now attempting to write to a flashrom using the layout/region<br>
> approach. I need to write a region from a 4MB ROM to the beginning of an<br>
> 8MB ROM.<br>
> The region image from the 4MB ROM is 4,128,768 bytes == 0x3f0000 long and<br>
> this file is called image1.<br>
> I have defined the 8MB ROM layout in file called romlayout_8MB to be:<br>
><br>
> 000000:3effff main<br>
> 3f0000:7fffff remainder<br>
><br>
> i.e I want to place the contents of file image1 in to the 8MB ROM region<br>
> defined as main.<br>
><br>
> I invoked flashrom as follows:<br>
><br>
> flashrom -p buspirate_spi:dev=/dev/ttyUSB0,spispeed=250k -l romlayout_8MB<br>
> -i main -w image1<br>
><br>
> The flash ROM is detected correctly, delay calculated, but then flashrom<br>
> immediately returns the error:<br>
> "image size doesn't match".<br>
><br>
> As always, guidance/suggestions gratefully received.<br>
<br>
That's one of the other things my patches fix :)<br>
The image you supply with -v/-r/-w is always used to present a mapping<br>
of the whole chip. The layout information is only used to select the<br>
address range inside that mapping. So for vanilla flashrom you have to<br>
create an 8MB file and fill the first 4MB with the content you want and<br>
continue as you have done.<br>
<br>
With my patches one can add an image name to any -i parameter (e.g. -i<br>
main:main.img) which is then mapped to the corresponding offset. IIRC<br>
one has still to supply a whole image with the correct size, but if the<br>
needed ranges are also present as "-i images" then it would not be used<br>
at all. Similar for the read operations: it would create a whole image<br>
with a lot of 0xFFs outside the selected regions and smaller/exact<br>
files for the "-i images".<br>
<br>
Maybe I have some time at the weekend to integrate the patches. I think<br>
there is consensus that we want them in and they have been tested by a<br>
number of people, so i think it should not break too much :)<br>
--<br>
Kind regards/Mit freundlichen Grüßen, Stefan Tauner<br>
</blockquote></div>