2 # Copyright (C) 2011 OpenWrt.org
10 part
=$
(find_mtd_part u-boot
)
11 [ -z "$part" ] && return 1
13 dd if=$part bs
=4 count
=1 skip
=81728 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
16 tplink_get_image_hwid
() {
17 get_image
"$@" |
dd bs
=4 count
=1 skip
=16 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
20 tplink_get_image_boot_size
() {
21 get_image
"$@" |
dd bs
=4 count
=1 skip
=37 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
24 platform_check_image
() {
25 local board
=$
(board_name
)
26 local magic
="$(get_magic_long "$1")"
28 [ "$#" -gt 1 ] && return 1
32 [ "$magic" != "01000000" ] && {
33 echo "Invalid image type."
40 hwid
=$
(tplink_get_hwid
)
41 imageid
=$
(tplink_get_image_hwid
"$1")
43 [ "$hwid" != "$imageid" ] && {
44 echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
50 boot_size
=$
(tplink_get_image_boot_size
"$1")
51 [ "$boot_size" != "00000000" ] && {
52 echo "Invalid image, it contains a bootloader."
60 echo "Sysupgrade is not yet supported on $board."
64 platform_do_upgrade
() {
65 local board
=$
(board_name
)
69 default_do_upgrade
"$ARGV"
76 ( ps |
grep -v 'grep' |
grep '/dev/watchdog' ) && {
77 echo 'Could not disable watchdog'
82 append sysupgrade_pre_upgrade disable_watchdog