aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 066bfd414..f1d95f6f6 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -65,6 +65,10 @@ tplink_get_image_hwid() {
get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
+tplink_get_image_boot_size() {
+ get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
platform_check_image() {
local board=$(ar71xx_board_name)
local magic="$(get_magic_word "$1")"
@@ -174,6 +178,14 @@ platform_check_image() {
return 1
}
+ local boot_size
+
+ boot_size=$(tplink_get_image_boot_size "$1")
+ [ "$boot_size" != "00000000" ] && {
+ echo "Invalid image, it contains a bootloader."
+ return 1
+ }
+
return 0
;;
wndr3700)