aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-10-26 18:58:13 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-10-26 18:58:13 +0000
commita65df2f1ec14523e0dadde2ded50b1f66eff84f2 (patch)
tree14aa2d6fa4a42fd20ddaf0bd0516e3de60c573c6 /target
parent368d37f9ade35b4e8f4f0ad6f18f1b13e3fa9a33 (diff)
downloadmaster-187ad058-a65df2f1ec14523e0dadde2ded50b1f66eff84f2.tar.gz
master-187ad058-a65df2f1ec14523e0dadde2ded50b1f66eff84f2.tar.bz2
master-187ad058-a65df2f1ec14523e0dadde2ded50b1f66eff84f2.zip
ar71xx: reject TP-Link images containing a bootloader
The original TP-Link firmware images can be flashed via the sysupgrade command, however those may contain a bootloader. Flashing such an image via sysupgrade bricks the board, and it can't be recovered without a serial console. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33944 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-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 066bfd4149..f1d95f6f6a 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)