aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-04-09 06:33:56 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-04-09 06:33:56 +0000
commit2198db252ca8e865b1eac24e20a50f312b6dc6e9 (patch)
tree040ea415495c17784a3099f2019b9a6b95c5554e /target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
parentc6f95821161e9b4e44a9d26bb6441a3a994d1dcc (diff)
downloadupstream-2198db252ca8e865b1eac24e20a50f312b6dc6e9.tar.gz
upstream-2198db252ca8e865b1eac24e20a50f312b6dc6e9.tar.bz2
upstream-2198db252ca8e865b1eac24e20a50f312b6dc6e9.zip
bcm53xx: switch to the otrx for verifying TRX images
This adds checking CRC32 of provided firmware image. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45320
Diffstat (limited to 'target/linux/bcm53xx/base-files/lib/upgrade/platform.sh')
-rw-r--r--target/linux/bcm53xx/base-files/lib/upgrade/platform.sh22
1 files changed, 6 insertions, 16 deletions
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index e174cc7beb..ed84386a68 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -54,20 +54,6 @@ platform_identify() {
echo "unknown"
}
-# $(1): image that should contain trx
-# $(2): trx offset in image
-platform_check_image_trx() {
- local magic=$(get_magic_long_at "$1" $2)
-
- [ "$magic" != "48445230" ] && {
- return 1
- }
-
- # TODO: Check crc32
-
- return 0
-}
-
platform_check_image() {
[ "$#" -gt 1 ] && return 1
@@ -93,7 +79,7 @@ platform_check_image() {
error=1
}
- if ! platform_check_image_trx "$1" "$header_len"; then
+ if ! otrx -c "$1" -o "$header_len"; then
echo "No valid TRX firmware in the CHK image"
error=1
fi
@@ -108,12 +94,16 @@ platform_check_image() {
error=1
}
- if ! platform_check_image_trx "$1" 32; then
+ if ! otrx -c "$1" -o 32; then
echo "No valid TRX firmware in the CyberTAN image"
error=1
fi
;;
"trx")
+ if ! otrx -c "$1"; then
+ echo "Invalid (corrupted?) TRX firmware"
+ error=1
+ fi
;;
*)
echo "Invalid image type. Please use only .trx files"