aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mpc85xx/base-files/lib
diff options
context:
space:
mode:
authorJames <>2013-03-17 12:16:37 +0000
committerJames <>2013-03-17 12:16:37 +0000
commit27b76ab0671089c47506615a796a261e993896a7 (patch)
tree61213d67e7fa87b20356b23798558e2c4212c42f /target/linux/mpc85xx/base-files/lib
downloadtrunk-36060-master.tar.gz
trunk-36060-master.tar.bz2
trunk-36060-master.zip
Diffstat (limited to 'target/linux/mpc85xx/base-files/lib')
-rw-r--r--target/linux/mpc85xx/base-files/lib/.svn/entries68
-rw-r--r--target/linux/mpc85xx/base-files/lib/.svn/prop-base/mpc85xx.sh.svn-base9
-rw-r--r--target/linux/mpc85xx/base-files/lib/.svn/text-base/mpc85xx.sh.svn-base39
-rwxr-xr-xtarget/linux/mpc85xx/base-files/lib/mpc85xx.sh39
-rw-r--r--target/linux/mpc85xx/base-files/lib/preinit/.svn/entries96
-rw-r--r--target/linux/mpc85xx/base-files/lib/preinit/.svn/prop-base/03_preinit_do_mpc85xx.sh.svn-base5
-rw-r--r--target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/03_preinit_do_mpc85xx.sh.svn-base9
-rw-r--r--target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/05_mpc85xx_load_input_drivers.svn-base11
-rw-r--r--target/linux/mpc85xx/base-files/lib/preinit/03_preinit_do_mpc85xx.sh9
-rw-r--r--target/linux/mpc85xx/base-files/lib/preinit/05_mpc85xx_load_input_drivers11
-rw-r--r--target/linux/mpc85xx/base-files/lib/upgrade/.svn/entries62
-rw-r--r--target/linux/mpc85xx/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base9
-rw-r--r--target/linux/mpc85xx/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base85
-rwxr-xr-xtarget/linux/mpc85xx/base-files/lib/upgrade/platform.sh85
14 files changed, 537 insertions, 0 deletions
diff --git a/target/linux/mpc85xx/base-files/lib/.svn/entries b/target/linux/mpc85xx/base-files/lib/.svn/entries
new file mode 100644
index 0000000..b5d0887
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/.svn/entries
@@ -0,0 +1,68 @@
+10
+
+dir
+36060
+svn://svn.openwrt.org/openwrt/trunk/target/linux/mpc85xx/base-files/lib
+svn://svn.openwrt.org/openwrt
+
+
+
+2013-02-21T19:20:34.086008Z
+35733
+juhosg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3c298f89-4303-0410-b956-a3cf2f4a3e73
+
+mpc85xx.sh
+file
+
+
+
+
+2013-03-17T12:12:30.000000Z
+21e4a8d8298069ee16cb75a4d25047f6
+2013-02-21T19:20:34.086008Z
+35733
+juhosg
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+741
+
+upgrade
+dir
+
+preinit
+dir
+
diff --git a/target/linux/mpc85xx/base-files/lib/.svn/prop-base/mpc85xx.sh.svn-base b/target/linux/mpc85xx/base-files/lib/.svn/prop-base/mpc85xx.sh.svn-base
new file mode 100644
index 0000000..03b5bfa
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/.svn/prop-base/mpc85xx.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 6
+native
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/target/linux/mpc85xx/base-files/lib/.svn/text-base/mpc85xx.sh.svn-base b/target/linux/mpc85xx/base-files/lib/.svn/text-base/mpc85xx.sh.svn-base
new file mode 100644
index 0000000..5757563
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/.svn/text-base/mpc85xx.sh.svn-base
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+MPC85XX_BOARD_NAME=
+MPC85XX_MODEL=
+
+mpc85xx_board_detect() {
+ local model
+ local name
+
+ model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)
+
+ case "$model" in
+ *"TL-WDR4900 v1")
+ name="tl-wdr4900-v1"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -z "$MPC85XX_BOARD_NAME" ] && MPC85XX_BOARD_NAME="$name"
+ [ -z "$MPC85XX_MODEL" ] && MPC85XX_MODEL="$model"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$MPC85XX_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$MPC85XX_MODEL" > /tmp/sysinfo/model
+}
+
+mpc85xx_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}
diff --git a/target/linux/mpc85xx/base-files/lib/mpc85xx.sh b/target/linux/mpc85xx/base-files/lib/mpc85xx.sh
new file mode 100755
index 0000000..5757563
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/mpc85xx.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+MPC85XX_BOARD_NAME=
+MPC85XX_MODEL=
+
+mpc85xx_board_detect() {
+ local model
+ local name
+
+ model=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)
+
+ case "$model" in
+ *"TL-WDR4900 v1")
+ name="tl-wdr4900-v1"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -z "$MPC85XX_BOARD_NAME" ] && MPC85XX_BOARD_NAME="$name"
+ [ -z "$MPC85XX_MODEL" ] && MPC85XX_MODEL="$model"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$MPC85XX_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$MPC85XX_MODEL" > /tmp/sysinfo/model
+}
+
+mpc85xx_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}
diff --git a/target/linux/mpc85xx/base-files/lib/preinit/.svn/entries b/target/linux/mpc85xx/base-files/lib/preinit/.svn/entries
new file mode 100644
index 0000000..7f945d7
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/preinit/.svn/entries
@@ -0,0 +1,96 @@
+10
+
+dir
+36060
+svn://svn.openwrt.org/openwrt/trunk/target/linux/mpc85xx/base-files/lib/preinit
+svn://svn.openwrt.org/openwrt
+
+
+
+2013-02-21T19:20:34.086008Z
+35733
+juhosg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3c298f89-4303-0410-b956-a3cf2f4a3e73
+
+03_preinit_do_mpc85xx.sh
+file
+
+
+
+
+2013-03-17T12:12:30.000000Z
+1cb63717add7c4e88b0ccb1ce99a1217
+2013-02-21T19:20:34.086008Z
+35733
+juhosg
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+109
+
+05_mpc85xx_load_input_drivers
+file
+
+
+
+
+2013-03-17T12:12:30.000000Z
+23f37395878f48cd20a21ac339ea8dd1
+2013-02-16T17:13:38.348909Z
+35626
+juhosg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+202
+
diff --git a/target/linux/mpc85xx/base-files/lib/preinit/.svn/prop-base/03_preinit_do_mpc85xx.sh.svn-base b/target/linux/mpc85xx/base-files/lib/preinit/.svn/prop-base/03_preinit_do_mpc85xx.sh.svn-base
new file mode 100644
index 0000000..bdbd305
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/preinit/.svn/prop-base/03_preinit_do_mpc85xx.sh.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 6
+native
+END
diff --git a/target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/03_preinit_do_mpc85xx.sh.svn-base b/target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/03_preinit_do_mpc85xx.sh.svn-base
new file mode 100644
index 0000000..88ba608
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/03_preinit_do_mpc85xx.sh.svn-base
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_mpc85xx() {
+ . /lib/mpc85xx.sh
+
+ mpc85xx_board_detect
+}
+
+boot_hook_add preinit_main do_mpc85xx
diff --git a/target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/05_mpc85xx_load_input_drivers.svn-base b/target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/05_mpc85xx_load_input_drivers.svn-base
new file mode 100644
index 0000000..ef1cce3
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/preinit/.svn/text-base/05_mpc85xx_load_input_drivers.svn-base
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+preinit_mpc85xx_load_input_drivers() {
+ insmod input-core
+ insmod gpio_keys
+ insmod button-hotplug
+}
+
+boot_hook_add preinit_main preinit_mpc85xx_load_input_drivers
diff --git a/target/linux/mpc85xx/base-files/lib/preinit/03_preinit_do_mpc85xx.sh b/target/linux/mpc85xx/base-files/lib/preinit/03_preinit_do_mpc85xx.sh
new file mode 100644
index 0000000..88ba608
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/preinit/03_preinit_do_mpc85xx.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_mpc85xx() {
+ . /lib/mpc85xx.sh
+
+ mpc85xx_board_detect
+}
+
+boot_hook_add preinit_main do_mpc85xx
diff --git a/target/linux/mpc85xx/base-files/lib/preinit/05_mpc85xx_load_input_drivers b/target/linux/mpc85xx/base-files/lib/preinit/05_mpc85xx_load_input_drivers
new file mode 100644
index 0000000..ef1cce3
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/preinit/05_mpc85xx_load_input_drivers
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+preinit_mpc85xx_load_input_drivers() {
+ insmod input-core
+ insmod gpio_keys
+ insmod button-hotplug
+}
+
+boot_hook_add preinit_main preinit_mpc85xx_load_input_drivers
diff --git a/target/linux/mpc85xx/base-files/lib/upgrade/.svn/entries b/target/linux/mpc85xx/base-files/lib/upgrade/.svn/entries
new file mode 100644
index 0000000..f107025
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/upgrade/.svn/entries
@@ -0,0 +1,62 @@
+10
+
+dir
+36060
+svn://svn.openwrt.org/openwrt/trunk/target/linux/mpc85xx/base-files/lib/upgrade
+svn://svn.openwrt.org/openwrt
+
+
+
+2013-02-21T19:20:34.086008Z
+35733
+juhosg
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3c298f89-4303-0410-b956-a3cf2f4a3e73
+
+platform.sh
+file
+
+
+
+
+2013-03-17T12:12:30.000000Z
+929c2712d12ab3f956f5516892b566a1
+2013-02-21T19:20:34.086008Z
+35733
+juhosg
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1565
+
diff --git a/target/linux/mpc85xx/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base b/target/linux/mpc85xx/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base
new file mode 100644
index 0000000..03b5bfa
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 6
+native
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/target/linux/mpc85xx/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base b/target/linux/mpc85xx/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base
new file mode 100644
index 0000000..dbd179f
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base
@@ -0,0 +1,85 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+. /lib/mpc85xx.sh
+
+PART_NAME=firmware
+RAMFS_COPY_DATA=/lib/mpc85xx.sh
+
+tplink_get_hwid() {
+ local part
+
+ part=$(find_mtd_part u-boot)
+ [ -z "$part" ] && return 1
+
+ dd if=$part bs=4 count=1 skip=81728 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
+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=$(mpc85xx_board_name)
+ local magic="$(get_magic_long "$1")"
+
+ [ "$ARGC" -gt 1 ] && return 1
+
+ case $board in
+ tl-wdr4900-v1)
+ [ "$magic" != "01000000" ] && {
+ echo "Invalid image type."
+ return 1
+ }
+
+ local hwid
+ local imageid
+
+ hwid=$(tplink_get_hwid)
+ imageid=$(tplink_get_image_hwid "$1")
+
+ [ "$hwid" != "$imageid" ] && {
+ echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
+ 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
+ ;;
+ esac
+
+ echo "Sysupgrade is not yet supported on $board."
+ return 1
+}
+
+platform_do_upgrade() {
+ local board=$(mpc85xx_board_name)
+
+ case "$board" in
+ *)
+ default_do_upgrade "$ARGV"
+ ;;
+ esac
+}
+
+disable_watchdog() {
+ killall watchdog
+ ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
+ echo 'Could not disable watchdog'
+ return 1
+ }
+}
+
+append sysupgrade_pre_upgrade disable_watchdog
diff --git a/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh b/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh
new file mode 100755
index 0000000..dbd179f
--- /dev/null
+++ b/target/linux/mpc85xx/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,85 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+. /lib/mpc85xx.sh
+
+PART_NAME=firmware
+RAMFS_COPY_DATA=/lib/mpc85xx.sh
+
+tplink_get_hwid() {
+ local part
+
+ part=$(find_mtd_part u-boot)
+ [ -z "$part" ] && return 1
+
+ dd if=$part bs=4 count=1 skip=81728 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
+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=$(mpc85xx_board_name)
+ local magic="$(get_magic_long "$1")"
+
+ [ "$ARGC" -gt 1 ] && return 1
+
+ case $board in
+ tl-wdr4900-v1)
+ [ "$magic" != "01000000" ] && {
+ echo "Invalid image type."
+ return 1
+ }
+
+ local hwid
+ local imageid
+
+ hwid=$(tplink_get_hwid)
+ imageid=$(tplink_get_image_hwid "$1")
+
+ [ "$hwid" != "$imageid" ] && {
+ echo "Invalid image, hardware ID mismatch, hw:$hwid image:$imageid."
+ 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
+ ;;
+ esac
+
+ echo "Sysupgrade is not yet supported on $board."
+ return 1
+}
+
+platform_do_upgrade() {
+ local board=$(mpc85xx_board_name)
+
+ case "$board" in
+ *)
+ default_do_upgrade "$ARGV"
+ ;;
+ esac
+}
+
+disable_watchdog() {
+ killall watchdog
+ ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
+ echo 'Could not disable watchdog'
+ return 1
+ }
+}
+
+append sysupgrade_pre_upgrade disable_watchdog