ar71xx/tplink_pharos_check_image: extend check to allow different magics
authorAlexander Couzens <lynxis@fe80.eu>
Fri, 13 Oct 2017 02:32:06 +0000 (04:32 +0200)
committerAlexander Couzens <lynxis@fe80.eu>
Sat, 14 Oct 2017 05:00:49 +0000 (07:00 +0200)
The cpe210v2 will have a different magic, but the same model string check.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
target/linux/ar71xx/base-files/lib/upgrade/platform.sh

index 1ffd1bde423de05781ae9f4bb72733b8e92dc09e..adb920c393526b5382430c77763bfcb93e7d595a 100755 (executable)
@@ -94,9 +94,10 @@ tplink_get_image_boot_size() {
 }
 
 tplink_pharos_check_image() {
-       local magic_long="$(get_magic_long "$1")"
-       [ "$magic_long" != "7f454c46" ] && {
-               echo "Invalid image magic '$magic_long'"
+       local image_magic="$(get_magic_long "$1")"
+       local board_magic="$2"
+       [ "$image_magic" != "$board_magic" ] && {
+               echo "Invalid image magic '$image_magic'. Expected '$board_magic'."
                return 1
        }
 
@@ -544,7 +545,8 @@ platform_check_image() {
        eap120|\
        wbs210|\
        wbs510)
-               tplink_pharos_check_image "$1" && return 0
+               # magic = .ELF
+               tplink_pharos_check_image "$1" "7f454c46" && return 0
                return 1
                ;;
        a40|\