[U-Boot] [PATCH] test: dfu: script: wrong md5sum on nand partitions

Heiko Schocher hs at denx.de
Fri Sep 12 08:27:30 CEST 2014


when uplaoding a file, at least from a nand partition, the complete
mtd nand partition size is transferred. This leads in a wrong md5sum
as the filesize is different between the downloaded file and the
uploaded file. Limit the uploaded filesize to the downloaded
fixes this.

Signed-off-by: Heiko Schocher <hs at denx.de>
Cc: Lukasz Majewski <l.majewski at samsung.com>
Cc: Stephen Warren <swarren at nvidia.com>
Cc: Roger Meier <r.meier at siemens.com>

---

Tested this on the siemens boards, with current ml I get:

Init script for generating data necessary for DFU test script OK
=========================================================================================
DFU EP0 transmission test program
Trouble shoot -> disable DBG (even the KERN_DEBUG) in the UDC driver
@ -> TRATS2 # dfu 0 mmc 0
 =========================================================================================
File: dat_960.img
TX: md5sum:2947e8f573bc34ba3791f991bd2da869
RX: md5sum:cde0b2024d8ddb55eee9d4b51264ad67
    -------> FAILED

with this patch:

Init script for generating data necessary for DFU test script OK
=========================================================================================
DFU EP0 transmission test program
Trouble shoot -> disable DBG (even the KERN_DEBUG) in the UDC driver
@ -> TRATS2 # dfu 0 mmc 0
 =========================================================================================
File: dat_960.img
TX: md5sum:2947e8f573bc34ba3791f991bd2da869
RX: md5sum:2947e8f573bc34ba3791f991bd2da869
    -------> OK
---
 test/dfu/dfu_gadget_test.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/dfu/dfu_gadget_test.sh b/test/dfu/dfu_gadget_test.sh
index 2f5b7db..5084a29 100755
--- a/test/dfu/dfu_gadget_test.sh
+++ b/test/dfu/dfu_gadget_test.sh
@@ -45,6 +45,7 @@ dfu_test_file () {
     printf "$COLOUR_GREEN ========================================================================================= $COLOUR_DEFAULT\n"
     printf "File:$COLOUR_GREEN %s $COLOUR_DEFAULT\n" $1
 
+    filesize=$(stat -c '%s' $1)
     dfu-util -D $1 -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
 
     echo -n "TX: "
@@ -54,9 +55,11 @@ dfu_test_file () {
 
     dfu-util -D ${DIR}/dfudummy.bin -a $TARGET_ALT_SETTING_B >> $LOG_FILE 2>&1 || die $?
 
+    N_FILE_FULL=$DIR$RCV_DIR${1:2}"_rcv_full"
     N_FILE=$DIR$RCV_DIR${1:2}"_rcv"
 
-    dfu-util -U $N_FILE -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
+    dfu-util -U $N_FILE_FULL -a $TARGET_ALT_SETTING >> $LOG_FILE 2>&1 || die $?
+    dd if=$N_FILE_FULL of=$N_FILE bs=$filesize count=1 >> $LOG_FILE 2>&1 || die $?
 
     echo -n "RX: "
     calculate_md5sum $N_FILE
-- 
1.8.3.1



More information about the U-Boot mailing list