[flashrom] Re: Truncating flash for oversized image

2021-11-06 Thread Rob Shore
Thanks for the response guys!

I went ahead and cut down the ROM last week after sending this out, and was
able to successfully flash my part.  I very much understand why you would
have the interlock in there for ROM sizing, especially since this can run
an in system BIOS flash.  Having people blindly download ROMs off the
internet and brick their systems without external flashers or JTAG doesn't
sound like the most fun to support.

That said, I'm glad to see support in this tool for various voltages and
speeds.  I often do some pretty hacky reworks to get things programmed, so
this is useful stuff to have available in the command line tool!

--Rob


On Mon, Nov 1, 2021 at 4:15 AM Angel Pons  wrote:

> Hi Rob,
>
> On Sun, Oct 31, 2021 at 10:18 PM David Hendricks
>  wrote:
> >
> > On Sun, Oct 31, 2021 at 10:10 AM Rob Shore  wrote:
> >>
> >> Hello!
> >>
> >> I've just discovered Flashrom as a way to use a Dediprog SPI programmer
> with MacOS, which is awesome.  I've got a bit of a strange question though:
> >>
> >> I've got a 1Mbit rom on a board, but the image I was given for it is
> for a 2Mbit part. The firmware itself in the raw image is < 1Mbit, but the
> file is still larger than my ROM. Flashrom won't run the flash saying
> "Error: Image size (262144 B) doesn't match the flash chip's size (131072
> B)!", which is technically correct. Is there a way to force the flash, and
> just have the process end after the first 131072B, which would result in
> the data I need being on the ROM?
> >>
> >> Thanks, and looking forward to using this tool some more!
> >
> > Try one of these:
> > - Use a layout file to tell flashrom exactly where you intend to write:
> `echo "0:01 fw" > layout.txt && flashrom -p dediprog -l layout.txt
> -i fw --noverify-all -w `
> > - Create a new file that is the appropriate size, for example using `dd
> if= of= bs=1k count=128`
>
> I think the first approach won't work, as flashrom still wants the
> file size to be exactly that of the flash chip. In these cases, one
> needs to manually adjust the file. If the file is too small, add some
> padding before and/or after its contents. If the file is too large,
> extract a subsection of the desired size (see David's second
> approach). Because this depends on the firmware contents and use case,
> flashrom cannot do this automatically.
>
> > The size check is an intentional UI decision to help prevent writing an
> incorrect file to the flash. A little bit of extra caution here is
> typically much easier than recovering a bricked host.
>
> Indeed. Having to perform some extra steps before flashing is much
> better than having to recover a bricked system.
>
> > ___
> > flashrom mailing list -- flashrom@flashrom.org
> > To unsubscribe send an email to flashrom-le...@flashrom.org
>
> Best regards,
> Angel
>
___
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org


[flashrom] Re: Truncating flash for oversized image

2021-11-01 Thread Angel Pons
Hi Rob,

On Sun, Oct 31, 2021 at 10:18 PM David Hendricks
 wrote:
>
> On Sun, Oct 31, 2021 at 10:10 AM Rob Shore  wrote:
>>
>> Hello!
>>
>> I've just discovered Flashrom as a way to use a Dediprog SPI programmer with 
>> MacOS, which is awesome.  I've got a bit of a strange question though:
>>
>> I've got a 1Mbit rom on a board, but the image I was given for it is for a 
>> 2Mbit part. The firmware itself in the raw image is < 1Mbit, but the file is 
>> still larger than my ROM. Flashrom won't run the flash saying "Error: Image 
>> size (262144 B) doesn't match the flash chip's size (131072 B)!", which is 
>> technically correct. Is there a way to force the flash, and just have the 
>> process end after the first 131072B, which would result in the data I need 
>> being on the ROM?
>>
>> Thanks, and looking forward to using this tool some more!
>
> Try one of these:
> - Use a layout file to tell flashrom exactly where you intend to write: `echo 
> "0:01 fw" > layout.txt && flashrom -p dediprog -l layout.txt -i fw 
> --noverify-all -w `
> - Create a new file that is the appropriate size, for example using `dd 
> if= of= bs=1k count=128`

I think the first approach won't work, as flashrom still wants the
file size to be exactly that of the flash chip. In these cases, one
needs to manually adjust the file. If the file is too small, add some
padding before and/or after its contents. If the file is too large,
extract a subsection of the desired size (see David's second
approach). Because this depends on the firmware contents and use case,
flashrom cannot do this automatically.

> The size check is an intentional UI decision to help prevent writing an 
> incorrect file to the flash. A little bit of extra caution here is typically 
> much easier than recovering a bricked host.

Indeed. Having to perform some extra steps before flashing is much
better than having to recover a bricked system.

> ___
> flashrom mailing list -- flashrom@flashrom.org
> To unsubscribe send an email to flashrom-le...@flashrom.org

Best regards,
Angel
___
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org


[flashrom] Re: Truncating flash for oversized image

2021-10-31 Thread David Hendricks
On Sun, Oct 31, 2021 at 10:10 AM Rob Shore  wrote:

> Hello!
>
> I've just discovered Flashrom as a way to use a Dediprog SPI programmer
> with MacOS, which is awesome.  I've got a bit of a strange question though:
>
> I've got a 1Mbit rom on a board, but the image I was given for it is for a
> 2Mbit part. The firmware itself in the raw image is < 1Mbit, but the file
> is still larger than my ROM. Flashrom won't run the flash saying "Error:
> Image size (262144 B) doesn't match the flash chip's size (131072 B)!",
> which is technically correct. Is there a way to force the flash, and just
> have the process end after the first 131072B, which would result in the
> data I need being on the ROM?
>
> Thanks, and looking forward to using this tool some more!
>

Try one of these:
- Use a layout file to tell flashrom exactly where you intend to write:
`echo "0:01 fw" > layout.txt && flashrom -p dediprog -l layout.txt
-i fw --noverify-all -w `
- Create a new file that is the appropriate size, for example using `dd
if= of= bs=1k count=128`

The size check is an intentional UI decision to help prevent writing an
incorrect file to the flash. A little bit of extra caution here is
typically much easier than recovering a bricked host.
___
flashrom mailing list -- flashrom@flashrom.org
To unsubscribe send an email to flashrom-le...@flashrom.org