j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: wmb Date: 2007-09-29 21:26:04 +0200 (Sat, 29 Sep 2007) New Revision: 648
Modified: cpu/x86/pc/olpc/copynand.fth Log: copy-nand - support reloading files saved with dump-nand, with OOB data inline.
Modified: cpu/x86/pc/olpc/copynand.fth =================================================================== --- cpu/x86/pc/olpc/copynand.fth 2007-09-29 19:25:03 UTC (rev 647) +++ cpu/x86/pc/olpc/copynand.fth 2007-09-29 19:26:04 UTC (rev 648) @@ -90,7 +90,10 @@ h# 100 buffer: crc-name-buf : crc-name$ ( -- adr len ) crc-name-buf count ;
+0 value img-has-oob? + : ?open-crcs ( -- ) + img-has-oob? if exit then image-name$ + 4 - " .img" caps-comp 0= if image-name$ crc-name-buf place " crc" crc-name$ + 3 - swap move @@ -98,6 +101,10 @@ then #crc-records if ." Check file is " crc-name$ type cr + + #image-eblocks if + #image-eblocks #crc-records <> " CRC file length is wrong" ?nand-abort + then then ;
@@ -106,13 +113,26 @@ : open-img ( "devspec" -- ) image-name$ open-dev to fileih fileih 0= " Can't open NAND image file" ?nand-abort - " size" fileih $call-method /nand-block um/mod ( residue #eblocks ) - to #image-eblocks ( residue ) - 0<> " Image file size is not a multiple of the NAND erase block size" ?nand-abort + " size" fileih $call-method ( d.size ) + 2dup /nand-block um/mod swap if ( d.size #eblocks ) + \ Wrong size for the no-oob data format; try the dump-nand format + drop ( d.size #eblocks ) + h# 21100 um/mod swap ( #eblocks residue ) + 0<> " Image file size is not a multiple of the NAND erase block size" ?nand-abort + true to img-has-oob? + else ( d.size #eblocks ) + false to img-has-oob? + nip nip ( #eblocks ) + then ( #eblocks ) + to #image-eblocks + #image-eblocks 0= " Image file is empty" ?nand-abort +;
- #crc-records if - #image-eblocks #crc-records <> " CRC file length is wrong" ?nand-abort +: ?skip-oob ( -- ) + img-has-oob? if + load-base h# 1100 " read" fileih $call-method ( len ) + h# 1100 <> " Bad read of OOB data in .img file" ?nand-abort ( ) then ;
@@ -181,8 +201,8 @@ : copy-nand ( "devspec" -- ) open-nand get-img-filename + open-img ?open-crcs - open-img
['] noop to show-progress
@@ -198,6 +218,7 @@ i ?check-crc load-base " copy-block" $call-nand ( page# error? ) " Error writing to NAND FLASH" ?nand-abort ( page# ) + ?skip-oob nand-pages/block / show-written ( ) loop
@@ -233,8 +254,8 @@ hex open-nand close-nand-ihs \ To set sizes get-img-filename + open-img ?open-crcs - open-img #crc-records 0= " No CRC file" ?nand-abort
['] noop to show-progress