aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/scripts
diff options
context:
space:
mode:
authorFrank Haverkamp <haver@vnet.ibm.com>2008-01-07 14:05:00 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-15 12:47:00 +0200
commit4bf037f3a2aea4328e10422379f751370d288d46 (patch)
tree68a24f007e8b89609d14d44165a8bcd669629e7a /ubi-utils/scripts
parent07e6203fd3078d6855e7d33597bdbbae10e555fd (diff)
ubi-utils: bin2nand, nand2bin add support of different ecc layouts
Both tools were lacking support of alternate ECC layouts. Only our intitial format was supported. With this change, it should be very easy to add more layouts in addtion to the already supported ones, which are: IBM (our format), and the MTD default layout. NAND OOB sizes of 512 and 2048 are currently supported. In contrast to the old version of bin2nand, the holes inbetween the ECC data is now not filled with 0x00 anymore but instead 0xff (like deleted flash) is used. This should not cause any difference. The testcase reflects the different layouts too. Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
Diffstat (limited to 'ubi-utils/scripts')
-rw-r--r--ubi-utils/scripts/bin2nand2bin_test.sh43
1 files changed, 38 insertions, 5 deletions
diff --git a/ubi-utils/scripts/bin2nand2bin_test.sh b/ubi-utils/scripts/bin2nand2bin_test.sh
index a17c91b..2192f02 100644
--- a/ubi-utils/scripts/bin2nand2bin_test.sh
+++ b/ubi-utils/scripts/bin2nand2bin_test.sh
@@ -1,5 +1,8 @@
#!/bin/sh
#
+# Version: 1.1
+# Author: Frank Haverkamp <haver@vnet.ibm.com>
+#
# Testcase for nand2bin and bin2nand. Generate testdata and inject
# biterrors. Convert data back and compare with original data.
#
@@ -8,14 +11,44 @@
#
inject_biterror=./scripts/inject_biterror.pl
-
pagesize=2048
oobsize=64
# Create test data
dd if=/dev/urandom of=testblock.bin bs=131072 count=1
-echo "Test conversion without bitflips ..."
+for layout in IBM MTD ; do
+ echo "*** Simple test with $layout layout ..."
+
+ echo -n "Convert bin to mif ... "
+ bin2nand -l$layout --pagesize=${pagesize} -o testblock.mif testblock.bin
+ if [ $? -ne "0" ]; then
+ echo "failed!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ echo -n "Convert mif to bin ... "
+ nand2bin -l$layout --pagesize=${pagesize} -o testblock.img testblock.mif
+ if [ $? -ne "0" ]; then
+ echo "failed!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ echo -n "Comparing data ... "
+ diff testblock.bin testblock.img
+ if [ $? -ne "0" ]; then
+ echo "failed!"
+ exit 1
+ else
+ echo "ok"
+ fi
+done
+
+echo "*** Test conversion without bitflips ..."
echo -n "Convert bin to mif ... "
bin2nand --pagesize=${pagesize} -o testblock.mif testblock.bin
@@ -44,7 +77,7 @@ else
echo "ok"
fi
-echo "Test conversion with uncorrectable ECC erors ..."
+echo "*** Test conversion with uncorrectable ECC erors ..."
echo -n "Inject biterror at offset $ioffs ... "
${inject_biterror} --offset=0 --bitmask=0x81 \
--input=testblock.mif \
@@ -76,7 +109,7 @@ else
exit 1
fi
-echo "Test bitflips in data ... "
+echo "*** Test bitflips in data ... "
for offs in `seq 0 255` ; do
cp testblock.mif testblock_bitflip.mif
@@ -142,7 +175,7 @@ for offs in `seq 0 255` ; do
fi
done
-echo "Test bitflips in OOB data ... "
+echo "*** Test bitflips in OOB data ... "
for offs in `seq 0 $oobsize` ; do
let ioffs=$pagesize+$offs