summaryrefslogtreecommitdiffstats
path: root/utils/ypr0tools/test.sh
diff options
context:
space:
mode:
authorLorenzo Miori <memorys60@gmail.com>2013-07-09 18:20:08 +0200
committerThomas Martitz <kugel@rockbox.org>2013-09-07 15:56:07 +0200
commitda8a6a90c33f8bf8f2cad9ff009d813b8b7fbaab (patch)
tree6cf1d0f79ca72df989c35486c81c1999cc85a116 /utils/ypr0tools/test.sh
parentcb27d4066a3a96cfc3758dff47c59cbadc3402ee (diff)
downloadrockbox-da8a6a90c33f8bf8f2cad9ff009d813b8b7fbaab.tar.gz
rockbox-da8a6a90c33f8bf8f2cad9ff009d813b8b7fbaab.zip
Firmware tools for Samsung YP-R0/YP-R1 (and possibly others)
They have been rewritten for being completely free and as fast as possible. Successfully extracted, patched, repacked and flashed original firmware (tested on device and it worked) Change-Id: I74d47d13f2dc3a2832a0d6821d3c2182dfd4b33b Reviewed-on: http://gerrit.rockbox.org/506 Reviewed-by: Thomas Martitz <kugel@rockbox.org> Tested-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'utils/ypr0tools/test.sh')
-rwxr-xr-xutils/ypr0tools/test.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/utils/ypr0tools/test.sh b/utils/ypr0tools/test.sh
new file mode 100755
index 0000000000..3c891e6e7f
--- /dev/null
+++ b/utils/ypr0tools/test.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+######################################################################
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+#
+# Script to test packer and unpacker
+# Copyright (C) 2013 Lorenzo Miori
+######################################################################
+
+ROM_FILE="$1"
+TMP_FOLDER=""
+
+goto_temp()
+{
+ if [ -n "$TMP_FOLDER" ]
+ then
+ cd $TMP_FOLDER
+ fi
+}
+
+cleanup()
+{
+ echo "$1"
+ OLD_DIR=`pwd`
+ goto_temp
+ rm -f "$ROM_FILE"_TEST_CRYPT "MBoot.bin" "zImage" "cramfs-fsl.rom" "SYSDATA.bin" "TEST_MD5SUMS" "RevisionInfo.txt" > /dev/null
+ cd $OLD_DIR
+ if [ -n "$TMP_FOLDER" ]
+ then
+ rmdir $TMP_FOLDER
+ fi
+ make clean
+ exit $2
+}
+
+if [ $# -lt 1 ]
+then
+ cleanup "FAIL: Missing parameter! Run with: test.sh <path to working rom to test> <optional: destination to temporary files>" 1
+fi
+
+if [ $# -eq 2 ]
+then
+ TMP_FOLDER="$2/"
+ mkdir $TMP_FOLDER
+ if [ $? -ne 0 ]
+ then
+ echo "FAIL: temporary directory exists!"
+ fi
+fi
+
+# be sure we have the executables up-to-date
+make clean
+make
+
+./fwdecrypt $1 $TMP_FOLDER
+if [ $? -ne 0 ]
+then
+ cleanup "FAIL: Error while decrypting ROM file" 1
+fi
+
+./fwcrypt $TMP_FOLDER$1_TEST_CRYPT $TMP_FOLDER
+if [ $? -ne 0 ]
+then
+ cleanup "FAIL: Error while decrypting ROM file" 1
+fi
+
+OLD_DIR=`pwd`
+goto_temp
+
+md5sum MBoot.bin zImage cramfs-fsl.rom SYSDATA.bin RevisionInfo.txt > "TEST_MD5SUMS"
+
+md5sum --strict -c "TEST_MD5SUMS"
+if [ $? -ne 0 ]
+then
+ cleanup "FAIL: MD5SUM mismatch!" 1
+fi
+
+cd $OLD_DIR
+
+cleanup "OK: test completed without errors." 0