View Single Post
Old 02-02-2016, 06:01 PM   #27
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
CopyCmp (compare-write/readback/compare) script

At last!
This turkey finally pasted its Q.A. testing:
Spoiler:

Code:
=== Normal output when both sizes equal
=== ending on full block or partial block

=== Src and Dst both 3 full blocks, test: c-w/r/c
Termination on block boundary. (0+0.0+0)
Blocks: 3, plus Bytes: 0, Total skips: 0, Total bytes: 12288
test01.dst: Before: 12288; After: 12288

=== Src and Dst both 3 full blocks, test: c
Termination on block boundary. (0+0.0+0)
Blocks: 3, plus Bytes: 0, Total skips: 3, Total bytes: 12288
test01.dst: Before: 12288; After: 12288

=== Src and Dst both 3-1/2 blocks, test: c-w/r/c
Termination on partial block boundary; w/r/c (0+1.0+1)
Blocks: 3, plus Bytes: 2048, Total skips: 0, Total bytes: 14336
test02.dst: Before: 14336; After: 14336

=== Src and Dst both 3-1/2 blocks, test: c
Termination on partial block boundary; match (0+1.0+1)
Blocks: 3, plus Bytes: 2048, Total skips: 4, Total bytes: 14336
test02.dst: Before: 14336; After: 14336

=== Following are "Notice"s because they might be intended usage.
=== That is: Changing only an initial portion of the destination.

=== Src 2 full blocks, Dst 3 full blocks, test: c-w/r/c
Notice: EOF on test03.src, full block on test03.dst (0+0.1+0)
Blocks: 2, plus Bytes: 0, Total skips: 0, Total bytes: 8192
test03.dst: Before: 12288; After: 12288

=== Src 2 full blocks, Dst 3 full blocks, test: c
Notice: EOF on test03.src, full block on test03.dst (0+0.1+0)
Blocks: 2, plus Bytes: 0, Total skips: 2, Total bytes: 8192
test03.dst: Before: 12288; After: 12288

=== Src 2-1/2 blocks, Dst 3-1/2 blocks, test: c-w/r/c
Notice: Partial block on test04.src, common bytes: 2048; w/r/c (0+1.1+0)
Blocks: 2, plus Bytes: 2048, Total skips: 0, Total bytes: 10240
test04.dst: Before: 14336; After: 14336

=== Src 2-1/2 blocks, Dst 3-1/2 blocks, test: c
Notice: Partial block on test04.src, common bytes: 2048; match (0+1.1+0)
Blocks: 2, plus Bytes: 2048, Total skips: 3, Total bytes: 10240
test04.dst: Before: 14336; After: 14336

=== Src 3-1/4 blocks, Dst 3-1/2 blocks, test: c-w/r/c
Termination on partial block boundary; w/r/c (0+1.0+1)
Blocks: 3, plus Bytes: 1024, Total skips: 0, Total bytes: 13312
test05.dst: Before: 14336; After: 14336

=== Src 3-1/4 blocks, Dst 3-1/2 blocks, test: c
Termination on partial block boundary; match (0+1.0+1)
Blocks: 3, plus Bytes: 1024, Total skips: 4, Total bytes: 13312
test05.dst: Before: 14336; After: 14336

=== Src 3 blocks, Dst 2-3/4 blocks, test: c-w/r/c
Notice: Partial block on test06.dst, common bytes: 3072; w/r/c (1+0.0+1)
Blocks: 2, plus Bytes: 3072, Total skips: 0, Total bytes: 11264
test06.dst: Before: 11264; After: 11264

=== Src 3 blocks, Dst 2-3/4 blocks, test: c
Notice: Partial block on test06.dst, common bytes: 3072; match (1+0.0+1)
Blocks: 2, plus Bytes: 3072, Total skips: 3, Total bytes: 11264
test06.dst: Before: 11264; After: 11264

=== Typically error conditions (source and destination size mis-match).
=== But since EOF is only recognized when encountered, the destination
=== blocks prior to the current block have been modified.

=== Src 3 blocks, Dst 2 blocks, test: c-w/r/c
Notice: full block on source, EOF on test07.dst (1+0.0+0)
Blocks: 2, plus Bytes: 0, Total skips: 0, Total bytes: 8192
test07.dst: Before: 8192; After: 8192

=== Src 3 blocks, Dst 2 blocks, test: c
Notice: full block on source, EOF on test07.dst (1+0.0+0)
Blocks: 2, plus Bytes: 0, Total skips: 2, Total bytes: 8192
test07.dst: Before: 8192; After: 8192

=== Src 3 blocks, Dst 3-1/4 blocks, test: c-w/r/c
Notice: EOF on test08.src, partial block on test08.dst (0+0.0+1)
Blocks: 3, plus Bytes: 0, Total skips: 0, Total bytes: 12288
test08.dst: Before: 13312; After: 13312

=== Src 3 blocks, Dst 3-1/4 blocks, test: c
Notice: EOF on test08.src, partial block on test08.dst (0+0.0+1)
Blocks: 3, plus Bytes: 0, Total skips: 3, Total bytes: 12288
test08.dst: Before: 13312; After: 13312

=== Src 2 blocks, Dst 3 blocks, test: c-w/r/c
Notice: EOF on test09.src, full block on test09.dst (0+0.1+0)
Blocks: 2, plus Bytes: 0, Total skips: 0, Total bytes: 8192
test09.dst: Before: 12288; After: 12288

=== Src 2 blocks, Dst 3 blocks, test: c
Notice: EOF on test09.src, full block on test09.dst (0+0.1+0)
Blocks: 2, plus Bytes: 0, Total skips: 2, Total bytes: 8192
test09.dst: Before: 12288; After: 12288

=== Src 3-1/2 blocks, Dst 3 blocks, test: c-w/r/c
Notice: partial block on source, EOF on test010.dst (0+1.0+0)
Blocks: 3, plus Bytes: 0, Total skips: 0, Total bytes: 12288
test010.dst: Before: 12288; After: 12288

=== Src 3-1/2 blocks, Dst 3 blocks, test: c
Notice: partial block on source, EOF on test010.dst (0+1.0+0)
Blocks: 3, plus Bytes: 0, Total skips: 3, Total bytes: 12288
test010.dst: Before: 12288; After: 12288

Command shell scripting is slow, but programming flash erase blocks is even slower -
So the script first compares each source and destination block pair (or fractional common parts) and just skips to the next block if the same.

The attached tar-ball has it all -
dd and dc3dd for both x86 and armel
the copycmp.sh script
and the tests directory with reference input files (made with dc3dd).

Tomorrow - write up directions on how to use this invention.
(The kindle's updater might get stuck in a loop on errors, but this script will not - and will tell us more than we probably wanted to know.)

Note:
Does copycmp file-to-device, device-to-file, file-to-file, and I suppose device-to-device (that last use is untested).
Attached Files
File Type: gz copycmp.tar.gz (264.1 KB, 345 views)

Last edited by knc1; 02-03-2016 at 02:03 PM.
knc1 is offline   Reply With Quote