brcm47xx: switch to the otrx for verifying TRX images
[openwrt/openwrt.git] / target / linux / brcm47xx / base-files / lib / upgrade / platform.sh
index 8c09706ee89cfcc2f22ece2fe482d1bc2b01a269..b9110a7589961ceaccae8513c684838a5e5b0e42 100644 (file)
@@ -97,11 +97,10 @@ platform_check_image() {
                                error=1
                        }
 
-                       magic=$(get_magic_long_at "$1" "$header_len")
-                       [ "$magic" != "48445230" ] && {
+                       if ! otrx -c "$1" -o "$header_len"; then
                                echo "No valid TRX firmware in the CHK image"
                                error=1
-                       }
+                       fi
                ;;
                "cybertan")
                        local pattern=$(dd if="$1" bs=1 count=4 2>/dev/null | hexdump -v -e '1/1 "%c"')
@@ -113,11 +112,10 @@ platform_check_image() {
                                error=1
                        }
 
-                       magic=$(get_magic_long_at "$1" 32)
-                       [ "$magic" != "48445230" ] && {
+                       if ! otrx -c "$1" -o 32; then
                                echo "No valid TRX firmware in the CyberTAN image"
                                error=1
-                       }
+                       fi
                ;;
                "trx")
                ;;