From your indication I wrote this script, should this work for our purpose ?
Code:
#!/bin/bash
src=$1
dst=$2
tmp1="./tmp1.img"
tmp2="./tmp2.img"
if test $# -lt 2
then
echo "Missing parameter"
exit
fi
size=`wc -c $src | cut -d' ' -f1 ` # in bytes
size=$[ ($size+1024) / 1024 ]
i=0
echo "Image size $size kb"
while test $size -gt $i
do
echo -e "\t$i"
#Write from the image to the partition
dd if=$src of=$dst bs=1024 count=1 skip=$i seek=$i
#Copy the last read kb to a temp file
dd if=$src of=$tmp1 bs=1024 count=1 skip=$i
#Copy the last written kb to another file
dd if=$dst of=$tmp2 bs=1024 count=1 skip=$i
#Compare the difference between the files
val=`diff $tmp1 $tmp2| wc -l`
if test $val -ne 0
then
echo -e "\tError at $i"
base64 $tmp1 | head
echo ""
base64 $tmp2 | head
fi
i=$[$i+1]
done
rm $tmp1
rm $tmp2