Hello David,

Thanks for commands usage .

For the command:
dd if=test2.bin of=test.bin bs=1 seek=$((0x1a1e0)) conv=notrunc

It is subtle when you are mentioning bs=1, If we donot specify bs, it will take a default value of 512 I suppose, then seek will be (0x1a1e0)*512 which will skip lot of bytes from the beginning of the file.

 So, we cannot use a layout file to write to a specific region.

Rgds,




On Tue, Aug 2, 2016 at 1:31 AM, David Hendricks <dhendrix@chromium.org> wrote:


On Mon, Aug 1, 2016 at 9:59 AM, Pradeep Ch <shanmugp@sysargus.com> wrote:

How do I pad the bootloader. img to 8MBytes ? But, still it occupies the first 106976 Bytes right ? Remaining space is empty I suppose.

To create a 8MB file full of 0xff bytes:
dd if=/dev/zero bs=1k count=8192 2>/dev/null | tr "\000" "\377" > test.bin

From there, you can use dd with skip=, seek=, and conv=notrunc to place your content wherever you need to in the image. For example,
dd if=test1.bin of=test.bin bs=1 conv=notrunc
dd if=test2.bin of=test.bin bs=1 seek=$((0x1a1e0)) conv=notrunc

Thanks.

On Aug 1, 2016 9:08 PM, "Urja Rannikko" <urjaman@gmail.com> wrote:
Hi,

On Mon, Aug 1, 2016 at 10:33 AM, Pradeep Ch <shanmugp@sysargus.com> wrote:
>
> I am attempting to write to a flashrom using layout/region approach.
> The NOR flash size is 8MBytes. The file size I am writing is 106976 Bytes.
>
> The rom.layout file contents are:
>  00000000:0001a1df test1
>  0001a1e0:007fffff test2
>
> The command I am using is:
> ./flashrom -p ft2232_spi:type=arm-usb-ocd --layout rom.layout --image test1
> -w bootloader.img
>
> The error I am getting is :
> Using region: "test1".
> Calibrating delay loop... OK.
> Found Eon flash chip "EN25Q64" (8192 kB, SPI) on ft2232_spi.
> Error: Image size (106976 B) doesn't match the flash chip's size (8388608
> B)!
>
> Please let me know about the error.

The current layout system will only limit the actually written area,
not change the requirements of the flash file being the size of the
chip, so in this case you'd need to pad the bootloader.img to 8MB.

_______________________________________________
flashrom mailing list
flashrom@flashrom.org
https://www.flashrom.org/mailman/listinfo/flashrom



--
David Hendricks (dhendrix)
Systems Software Engineer, Google Inc.