summaryrefslogtreecommitdiff
path: root/ubi-utils/scripts/unubi_test.sh
diff options
context:
space:
mode:
authorFrank Haverkamp <haver@vnet.ibm.com>2007-11-24 11:04:51 +0100
committerFrank Haverkamp <haver@vnet.ibm.com>2007-11-24 11:04:51 +0100
commit26c965bc654d67881fc54f4b24a552600752dadd (patch)
treeec8033e92872dd7a594063a893bd6cd4b708e0c4 /ubi-utils/scripts/unubi_test.sh
parent0d2d0f43b9aa9b08f610169b412fd24a15dea154 (diff)
ubi-utils: various fixes in unubi
The extraction of data from blocks used for dynamic volumes was totally broken. The data size was calculated wrong. This fix is not perfect, the alignment is still ignored. The parameter "header-size" is very misleading. It does not reflect the vid hdr offset properly. I assume therefor that it only works for the layout I am using where the vid hdr is at the _end_ of the 1st NAND page (2048). I added the generation of a textfile with information about the blocks which are going into the internal graph representation. Instead of a graph I think that a simple array will simplify the code very much. The array must than be sorted properly to cope with older and newer block-copies but that should not be a problem. discussed the tool with my coleage Andreas Arnez and we found that it might be a good idea to replace it even with a perl program for the same purpose since that would offer the flexibility to change it on the fly when needed. The tool is mainly used for crash analysis so it could be an advantage to change it without needing a C-compiler. Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
Diffstat (limited to 'ubi-utils/scripts/unubi_test.sh')
-rw-r--r--ubi-utils/scripts/unubi_test.sh82
1 files changed, 63 insertions, 19 deletions
diff --git a/ubi-utils/scripts/unubi_test.sh b/ubi-utils/scripts/unubi_test.sh
index 1cbe426..40dc2e2 100644
--- a/ubi-utils/scripts/unubi_test.sh
+++ b/ubi-utils/scripts/unubi_test.sh
@@ -6,56 +6,100 @@
# 2007 Frank Haverkamp <haver@vnet.ibm.com>
#
-version=1.0
+version=1.1
image=data.mif
oob=oob.bin
data=data.bin
pagesize=2048
volmax=31
-datadir=unubi_data.bin
+datadir=unubi_data
-echo "Testcase: ${0} Version: ${version}"
-echo
-
-if [ -f $1 ]; then
- image=${1}
-fi
+# general arguments e.g. debug enablement
+# unubi_args="-D"
+echo "------------------------------------------------------------------------"
+echo "Testcase: ${0} Version: ${version}"
+echo "------------------------------------------------------------------------"
echo "Testing nand2bin ..."
echo " Input: ${image}"
echo " Data: ${data}"
echo " OOB: ${oob}"
echo " Pagesize: ${pagesize}"
-
nand2bin --pagesize ${pagesize} -o ${data} -O ${oob} ${image}
echo
+echo "------------------------------------------------------------------------"
echo "Testing unubi ..."
+echo "------------------------------------------------------------------------"
unubi --version
+echo
+echo "------------------------------------------------------------------------"
echo "Trying to extract first ${volmax} volumes ..."
+echo "------------------------------------------------------------------------"
+mkdir -p ${datadir}/volumes
for v in `seq 0 ${volmax}` ; do
- unubi -r${v} ${data}
+ unubi ${unubi_args} -r${v} -d${datadir}/volumes ${data}
echo -n "."
done
echo "ok"
+ls -l ${datadir}/volumes
+echo
-ls -l unubi_data.bin/
-
+echo "------------------------------------------------------------------------"
echo "Extracting graphics ..."
-unubi -a ${data}
+echo "------------------------------------------------------------------------"
+unubi -a -d${datadir} ${data}
+echo "Use gnuplot to display:"
+ls ${datadir}/*.plot
+ls ${datadir}/*.data
+echo
+echo "------------------------------------------------------------------------"
+echo "eb-split"
+echo "------------------------------------------------------------------------"
+unubi -e -d${datadir}/eb-split ${data}
+ls -l ${datadir}/eb-split
+echo
-echo "Extracting volume info table ..."
-unubi -i ${data}
+echo "------------------------------------------------------------------------"
+echo "vol-split"
+echo "------------------------------------------------------------------------"
+unubi -v -d${datadir}/vol-split ${data}
+ls -l ${datadir}/vol-split
+echo
+echo "The generated images contain only the data (126KiB in our "
+echo "case) not including the UBI erase count and volume info "
+echo "header. For dynamic volumes the data should be the full "
+echo "126KiB. Unubi cannot know how much of the data is valid. "
+echo
+
+echo "------------------------------------------------------------------------"
+echo "!vol-split"
+echo "------------------------------------------------------------------------"
+unubi -V -d${datadir}/vol-split! ${data}
+ls -l ${datadir}/vol-split\!
+echo
+echo "The generated images contain the full block data of 128KiB "
+echo "including the UBI erase count and volume information header."
+echo
+echo "------------------------------------------------------------------------"
+echo "Extracting volume info table ..."
+echo "------------------------------------------------------------------------"
+unubi -i -d${datadir} ${data}
+echo "I strongly hope that empty ubi blocks are filled with 0xff! "
echo
+
+echo "------------------------------------------------------------------------"
echo "Table 0"
-echo "-------"
+echo "------------------------------------------------------------------------"
cat ${datadir}/vol_info_table0
-
echo
+
+echo "------------------------------------------------------------------------"
echo "Table 1"
-echo "-------"
-cat ${datadir}/vol_info_table1 \ No newline at end of file
+echo "------------------------------------------------------------------------"
+cat ${datadir}/vol_info_table1
+echo