[openfirmware] [commit] r2873 - cpu/x86/pc/olpc/via
repository service
svn at openfirmware.info
Thu Feb 23 04:20:16 CET 2012
Author: quozl
Date: Thu Feb 23 04:20:16 2012
New Revision: 2873
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2873
Log:
OLPC fs-verify - add fs-verify-quick for abort on first mismatch, report accidental use of zd file, and rethrow exception after cleanup to allow caller to see it.
Modified:
cpu/x86/pc/olpc/via/fsverify.fth
Modified: cpu/x86/pc/olpc/via/fsverify.fth
==============================================================================
--- cpu/x86/pc/olpc/via/fsverify.fth Thu Feb 23 02:39:46 2012 (r2872)
+++ cpu/x86/pc/olpc/via/fsverify.fth Thu Feb 23 04:20:16 2012 (r2873)
@@ -1,9 +1,12 @@
\ Boot script for post-audit testing
[ifndef] fs-verify
+false value fs-verify-quick?
vocabulary fs-verify-commands
also fs-verify-commands definitions
+false value data?
: zblocks: ( "eblock-size" "#eblocks" ... -- )
+ data? 0= " Not a zsp file" ?nand-abort
get-hex# to /nand-block
get-hex# to #image-eblocks
open-nand
@@ -11,10 +14,12 @@
;
: zblocks-end: ( -- )
+ false to data?
;
\ This could be a no-op ...
: data: ( "filename" -- )
+ true to data?
safe-parse-word fn-buf place
" ${DN}${PN}\${CN}${FN}" expand$ image-name-buf place
;
@@ -31,6 +36,11 @@
$= ( okay? )
;
+: ?mismatch
+ cr
+ fs-verify-quick? " One block mismatch, remainder not checked" ?nand-abort
+;
+
: zblock: ( "eblock#" "comprlen" "hashname" "hash-of-128KiB" -- )
get-hex# ( eblock# )
@@ -44,7 +54,7 @@
" Malformed hash string" ?nand-abort ( eblock# hashname$ hash$ )
verify-hash ( eblock# okay? )
- swap .d if (cr else cr then
+ swap .d if (cr else ?mismatch then
;
previous definitions
@@ -61,16 +71,21 @@
t-hms(
also fs-verify-commands
- ['] include-file catch ?dup if ( x error )
- nip .error
- then
+ ['] include-file catch ( 0 | x error# )
previous
show-done
close-nand-ihs
)t-hms
+ throw ( )
+;
+
+: fs-verify ( "fs.zsp" -- ) \ test blocks
+ false to fs-verify-quick?
+ safe-parse-word $fs-verify
;
-: fs-verify ( "devspec" -- )
+: fs-verify-quick ( "fs.zsp" -- ) \ test blocks until a mismatch
+ true to fs-verify-quick?
safe-parse-word $fs-verify
;
More information about the openfirmware
mailing list