On Wed, Apr 20, 2011 at 05:18:50PM +1000, James Cameron wrote:
> There is one small problem left to fix; Q3A64 fs-update displays an
> error at the end because the total number of blocks written has not
> agreed with the number of blocks specified at the top of the file.  I
> propose to fix that somehow, but I've yet to decide on exactly how.
> It was introduced by -r2186, where on your request Mitch changed the
> check from last block written to number of blocks written.  It does
> not happen with Q3A62.

I've fixed this locally and tested with my sparse .zd file, and
os860.zd.  The patch is attached for review.

I've changed the ?all-written check, which happens after the blocks are
written, so that it reports a warning if either:

- the highest block written is below the end of the image, and/or;

- the lowest block written is not zero.

For an fs-update of a sparse .zd file, using a partial download, the
first warning appears after "Short read of zdata file".

For an fs-update of a zero block last .zd file, using a partial
download, both warnings shall appear.

This changes the meaning of the #image-eblocks value from a count of
blocks expected, to a count of blocks in the original image from which
the .zd was made.

(Also, in the previous code, #eblocks-written was not reset when
fs-update started, so I suspect a second fs-update would have generated
a spurious warning.)

Do you have a sample of your "write zero block last" .zd file?  I've
looked at os16.zd2.zsp but it writes zero block first.  I really should
set up an F14 builder here.  Got any checklist?

-- 
James Cameron
http://quozl.linux.org.au/
Index: cpu/x86/pc/olpc/via/fsupdate.fth
===================================================================
--- cpu/x86/pc/olpc/via/fsupdate.fth	(revision 2191)
+++ cpu/x86/pc/olpc/via/fsupdate.fth	(working copy)
@@ -8,16 +8,30 @@
    push-hex $number pop-base  " Bad number" ?nand-abort
 ;
 
-0 value #eblocks-written
+0 value min-eblock#
+0 value max-eblock#
 
+: written ( eblock# -- )
+   dup
+   max-eblock# max to max-eblock# ( eblock# )
+   min-eblock# min to min-eblock#
+;
+
 : ?all-written  ( -- )
-   #eblocks-written #image-eblocks <>  if
+   max-eblock# 1+ #image-eblocks <>  if
       cr
       red-letters
-      ." WARNING: The file specified " #image-eblocks .d
-      ." chunks but wrote only " #eblocks-written .d ." chunks" cr
+      ." WARNING: The file said highest block " #image-eblocks .d
+      ." but wrote only as high as block " max-eblock# .d cr
       black-letters
    then
+   min-eblock# 0 <>  if
+      cr
+      red-letters
+      ." WARNING: The file did not write a zero block, "
+      ." but wrote only as low as block " min-eblock# .d cr
+      black-letters
+   then
 ;
 
 0 value secure-fsupdate?
@@ -57,6 +71,8 @@
    ?compare-spec-line
    get-hex# to /nand-block
    get-hex# to #image-eblocks
+   #image-eblocks to min-eblock#
+   0 to max-eblock#
    " size" $call-nand  #image-eblocks /nand-block um*  d<
    " Image size is larger than output device" ?nand-abort
    #image-eblocks  show-init
@@ -200,8 +216,8 @@
       swap-buffers                          ( eblock# )
 \  then
 
+   dup written                              ( eblock# )
    show-written                             ( )
-   #eblocks-written 1+ to #eblocks-written  ( )
    show-temperature
    hdd-led-toggle
 ;
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to