On Thu, Oct 28, 2010 at 8:35 PM, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> wrote:
On 29.10.2010 04:58, David Hendricks wrote:
> New version, more bug fixes. Thanks for Carl-Daniel for testing!
> - Restore the original ROM before beginning the second set of tests.
> - The last iteration of the second test (un-aligned partial writes) was
> causing problems on a 128KB part (emulated). I've removed it for now since
> I'm in a hurry to get out tonight.
> - Fixed a copy + paste error in the 4k aligned test layout.
> - Added $FLASHROM_PARAM to the list of parameters passed into Flashrom.
>

Thanks! The following change to the second while loop seems to fix the
issues with 128kB flash chips for me:

# Protect against too long write
writelen=4096
if [ $((${offset} + 4096 + 4096)) -ge 131072 ]; then
       writelen=$((131072 - $((${offset} + 4096))))
       if [ ${writelen} -lt 0 ]; then
               writelen=0
       fi
fi
dd if=${ZERO_4K} of=${TESTFILE} bs=1 conv=notrunc seek=${offset} 2>/dev/null
dd if=${FF_4K} of=${TESTFILE} bs=1 conv=notrunc seek=$((${offset} +
4096)) count=writelen 2>/dev/null

ACKed-by: David Hendricks <dhendrix@google.com>

Before you commit, add the last range to the unaligned layout and maybe add a note to the comments above. Maybe something like:
# 3. The new content must be written at specified offsets.
#
# Note: The last chunk of 0xff bytes is only 2K as to avoid overrunning a 128KB
# test image.
echo "
...
0x01e800:0x01f7ff 00_15
0x01f800:0x01ffff ff_15
" > layout_unaligned.txt

Thanks!

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