utility app: fix flash read/write problem on mtd devices
authorHao Zhang <hzhang@ti.com>
Wed, 15 May 2013 20:41:56 +0000 (16:41 -0400)
committerHao Zhang <hzhang@ti.com>
Wed, 15 May 2013 20:41:56 +0000 (16:41 -0400)
utility_flash/cgi-bin/flashread.cgi
utility_flash/cgi-bin/flashwrite.cgi
utility_flash/flash.html

index b6c2a99dbd9ad9cefb6e08ced90f753c49dccf42..6bc092d6d0447e95e5301092d4d151af24653167 100755 (executable)
@@ -9,7 +9,7 @@ cat << EOM
 </head>
 <body>
 <div id='wrapper'><div id='logo'><h1>Flash Read</h1>
-</div><div id='header'><div id='menu'><ul><li><a href='/flash.html'>Back</a></li>
+</div><div id='header'><div id='menu'><ul>
 </ul></div></div></div>
 <div id='page'>
 EOM
@@ -32,7 +32,7 @@ cat > $TMPFILE
 get_params()
 {
 partition=$(cat $TMPFILE | sed -n '4p'| sed 's/.$//')
-mtddevname=$(cat /proc/mtd | awk -v pat="$partition" '$0 ~ pat {printf $1}' | sed 's/://')
+mtddevname=$(cat /proc/mtd | awk 'NR < 4' | awk -v pat="$partition" '$0 ~ pat {printf $1}' | sed 's/://')
 mtddev="/dev/"$mtddevname
 TMPFILE_DATA="../"$partition".bin"
 }
@@ -53,7 +53,7 @@ rm -f $TMPFILE
 exit
 fi
 
-mtdsz="0x"$(cat /proc/mtd | awk -v pat="$partition" '$0 ~ pat {printf $2}')
+mtdsz="0x"$(cat /proc/mtd | awk 'NR < 4' | awk -v pat="$partition" '$0 ~ pat {printf $2}')
 mtdsz=$(($mtdsz))
 }
 
@@ -64,7 +64,7 @@ cat << EOM1
 <p>Reading <i>$mtdsz</i> bytes from <i>$mtddev</i> ...</p>
 </div>
 EOM1
-nanddump -o -q -f $TMPFILE_DATA -l $mtdsz $mtddev
+nanddump -q -f $TMPFILE_DATA -l $mtdsz $mtddev
 sync
 }
 
index 2f17741fc9507fb9fa6ea0016d44f225bd08fdfb..c53dc1ddb608e6d9f0ece54b9102ac8df143c238 100755 (executable)
@@ -9,7 +9,7 @@ cat << EOM
 </head>
 <body>
 <div id='wrapper'><div id='logo'><h1>Flash Write</h1>
-</div><div id='header'><div id='menu'><ul><li><a href='/flash.html'>Back</a></li>
+</div><div id='header'><div id='menu'><ul>
 </ul></div></div></div>
 <div id='page'>
 EOM
@@ -29,7 +29,7 @@ TMPFILE=`mktemp`
 TMPFILE_DATA=`mktemp`
 cat > $TMPFILE
 partition=$(cat $TMPFILE | sed -n '4p'| sed 's/.$//')
-mtddevname=$(cat /proc/mtd | awk -v pat="$partition" '$0 ~ pat {printf $1}' | sed 's/://')
+mtddevname=$(cat /proc/mtd | awk 'NR < 4' | awk -v pat="$partition" '$0 ~ pat {printf $1}' | sed 's/://')
 mtddev="/dev/"$mtddevname
 soffset=$(head -8 $TMPFILE | wc -c)
 eoffset=$(tail -1 $TMPFILE | wc -c)
@@ -63,7 +63,7 @@ rm -f $TMPFILE
 exit
 fi
 
-mtdsz="0x"$(cat /proc/mtd | awk -v pat="$partition" '$0 ~ pat {printf $2}')
+mtdsz="0x"$(cat /proc/mtd | awk 'NR < 4' | awk -v pat="$partition" '$0 ~ pat {printf $2}')
 mtdsz=$(($mtdsz))
 if [ $osize -gt $mtdsz ] ; then
 cat << EOM1
index fb9648a05f8000ada43947e1a06ba92bc157f43c..500b207cc8cde3c915b7faf6f3daf7f7e316bb4e 100644 (file)
@@ -71,8 +71,8 @@
                                <tr>
                                        <td width="20%" align="left"> Partition </td>
                                        <td align="left" width="60%">
-                                       <input type="radio" value="params" name="mtd_partition"> Parameters 
-                                       <input type="radio" value="ubifs" checked name="mtd_partition"> FileSystem (e.g. UBI)</td> 
+                                       <input type="radio" value="u-boot" name="mtd_partition"> Boot loader
+                                       <input type="radio" value="params" checked name="mtd_partition"> Boot loader environment parameters</td>
                                </tr>
                                <tr>
                                        <td width="20%" align="left"> Image File</td>
@@ -94,8 +94,8 @@
                                <tr>
                                        <td width="20%" align="left"> Partition </td>
                                        <td align="left" width="60%">
-                                       <input type="radio" value="params" name="mtd_partition"> Parameters 
-                                       <input type="radio" value="ubifs" checked name="mtd_partition"> FileSystem (e.g. UBI)</td> 
+                                       <input type="radio" value="u-boot" name="mtd_partition"> Boot loader
+                                       <input type="radio" value="params" checked name="mtd_partition"> Boot loader environment parameters</td>
                                </tr>
                                <tr>
                                        <td width="20%" align="left" colspan="2">