2 # Copyright (C) 2011 OpenWrt.org
8 RAMFS_COPY_DATA
=/lib
/mpc85xx.sh
13 part
=$
(find_mtd_part u-boot
)
14 [ -z "$part" ] && return 1
16 dd if=$part bs
=4 count
=1 skip
=81728 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
19 tplink_get_image_hwid
() {
20 get_image
"$@" |
dd bs
=4 count
=1 skip
=16 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
23 tplink_get_image_boot_size
() {
24 get_image
"$@" |
dd bs
=4 count
=1 skip
=37 2>/dev
/null |
hexdump -v -n 4 -e '1/1 "%02x"'
27 platform_check_image
() {
28 local board
=$
(mpc85xx_board_name
)
29 local magic
="$(get_magic_long "$1")"
31 [ "$ARGC" -gt 1 ] && return 1
35 [ "$magic" != "01000000" ] && {
36 echo "Invalid image type."
43 hwid
=$
(tplink_get_hwid
)
44 imageid
=$
(tplink_get_image_hwid
"$1")
46 [ "$hwid" != "$imageid" ] && {
47 echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
53 boot_size
=$
(tplink_get_image_boot_size
"$1")
54 [ "$boot_size" != "00000000" ] && {
55 echo "Invalid image, it contains a bootloader."
63 echo "Sysupgrade is not yet supported on $board."
67 platform_do_upgrade
() {
68 local board
=$
(mpc85xx_board_name
)
72 default_do_upgrade
"$ARGV"
79 ( ps |
grep -v 'grep' |
grep '/dev/watchdog' ) && {
80 echo 'Could not disable watchdog'
85 append sysupgrade_pre_upgrade disable_watchdog