diff options
author | James <> | 2013-03-17 12:16:37 +0000 |
---|---|---|
committer | James <> | 2013-03-17 12:16:37 +0000 |
commit | 27b76ab0671089c47506615a796a261e993896a7 (patch) | |
tree | 61213d67e7fa87b20356b23798558e2c4212c42f /target/linux/ramips/base-files/lib | |
download | trunk-36060-master.tar.gz trunk-36060-master.tar.bz2 trunk-36060-master.zip |
Diffstat (limited to 'target/linux/ramips/base-files/lib')
15 files changed, 1140 insertions, 0 deletions
diff --git a/target/linux/ramips/base-files/lib/.svn/entries b/target/linux/ramips/base-files/lib/.svn/entries new file mode 100644 index 0000000..9dc2779 --- /dev/null +++ b/target/linux/ramips/base-files/lib/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/target/linux/ramips/base-files/lib +svn://svn.openwrt.org/openwrt + + + +2013-03-11T21:02:43.602648Z +35971 +juhosg + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +ramips.sh +file + + + + +2013-03-17T12:12:46.000000Z +33b007f2295ede63bd3b2943d92a0302 +2013-03-11T21:02:43.602648Z +35971 +juhosg +has-props + + + + + + + + + + + + + + + + + + + + +3538 + +upgrade +dir + +preinit +dir + diff --git a/target/linux/ramips/base-files/lib/.svn/prop-base/ramips.sh.svn-base b/target/linux/ramips/base-files/lib/.svn/prop-base/ramips.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/target/linux/ramips/base-files/lib/.svn/prop-base/ramips.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/target/linux/ramips/base-files/lib/.svn/text-base/ramips.sh.svn-base b/target/linux/ramips/base-files/lib/.svn/text-base/ramips.sh.svn-base new file mode 100644 index 0000000..6638b0a --- /dev/null +++ b/target/linux/ramips/base-files/lib/.svn/text-base/ramips.sh.svn-base @@ -0,0 +1,234 @@ +#!/bin/sh +# +# Copyright (C) 2010-2013 OpenWrt.org +# + +RAMIPS_BOARD_NAME= +RAMIPS_MODEL= + +all500x_board_detect() { + local systype + + systype=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo) + case "$systype" in + *"RT5350"*) + RAMIPS_MODEL="Allnet ALL5003" + ;; + *"RT3352"*) + RAMIPS_MODEL="Allnet ALL5002" + ;; + esac +} + +ramips_board_detect() { + local machine + local name + + machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo) + + case "$machine" in + *"8devices Carambola") + name="carambola" + ;; + *"Edimax 3g-6200n") + name="3g-6200n" + ;; + *"AirLive Air3GII") + name="air3gii" + ;; + *"Edimax BR-6425") + name="br6425" + ;; + *"Allnet ALL0239-3G") + name="all0239-3g" + ;; + *"Allnet ALL0256N") + name="all0256n" + ;; + *"Allnet ALL5002/ALL5003") + name="all5002" + ;; + *"ARC FreeStation5") + name="freestation5" + ;; + *"Argus ATP-52B") + name="argus-atp52b" + ;; + *"BR6524N") + name="br6524n" + ;; + *"Asus WL-330N") + name="wl-330n" + ;; + *"Asus WL-330N3G") + name="wl-330n3g" + ;; + *"Aztech HW550-3G") + name="hw550-3g" + ;; + *"DIR-300 B1") + name="dir-300-b1" + ;; + *"DIR-600 B1") + name="dir-600-b1" + ;; + *"DIR-600 B2") + name="dir-600-b2" + ;; + *"DIR-620 A1") + name="dir-620-a1" + ;; + *"DIR-615 H1") + name="dir-615-h1" + ;; + *"DIR-615 D") + name="dir-615-d" + ;; + *"DIR-645") + name="dir-645" + ;; + *"DAP-1350") + name="dap-1350" + ;; + *"ESR-9753") + name="esr-9753" + ;; + *"F5D8235 v1") + name="f5d8235-v1" + ;; + *"F5D8235 v2") + name="f5d8235-v2" + ;; + *"Hauppauge Broadway") + name="broadway" + ;; + *"La Fonera 2.0N") + name="fonera20n" + ;; + *"Asus RT-N13U") + name="rt-n13u" + ;; + *"MoFi Network MOFI3500-3GN") + name="mofi3500-3gn" + ;; + *"NBG-419N") + name="nbg-419n" + ;; + *"NexAira BC2") + name="bc2" + ;; + *"NW718") + name="nw718" + ;; + *"Omnima EMB HPM") + name="omni-emb-hpm" + ;; + *"Omnima MiniEMBWiFi") + name="omni-emb" + ;; + *"Petatel PSR-680W"*) + name="psr-680w" + ;; + *"Planex MZK-W300NH2"*) + name="mzk-w300nh2" + ;; + *"PWH2004") + name="pwh2004" + ;; + *"RT-G32 B1") + name="rt-g32-b1" + ;; + *"RT-N10+") + name="rt-n10-plus" + ;; + *"RT-N15") + name="rt-n15" + ;; + *"RT-N56U") + name="rt-n56u" + ;; + *"Skyline SL-R7205"*) + name="sl-r7205" + ;; + *"Sparklan WCR-150GN") + name="wcr-150gn" + ;; + *"V22RW-2X2") + name="v22rw-2x2" + ;; + *"W502U") + name="w502u" + ;; + *"WHR-G300N") + name="whr-g300n" + ;; + *"Sitecom WL-341 v3") + name="wl341v3" + ;; + *"Sitecom WL-351 v1 002") + name="wl-351" + ;; + *"Tenda 3G300M") + name="3g300m" + ;; + *"Tenda W306R V2.0") + name="w306r-v20" + ;; + *"TEW-691GR") + name="tew-691gr" + ;; + *"TEW-692GR") + name="tew-692gr" + ;; + *"Ralink V11ST-FE") + name="v11st-fe" + ;; + *"WLI-TX4-AG300N") + name="wli-tx4-ag300n" + ;; + *"WZR-AGL300NH") + name="wzr-agl300nh" + ;; + *"WR512-3GN-like router") + name="wr512-3gn" + ;; + *"UR-326N4G Wireless N router") + name="ur-326n4g" + ;; + *"UR-336UN Wireless N router") + name="ur-336un" + ;; + *"AWB WR6202") + name="wr6202" + ;; + *"XDX RN502J") + name="xdxrn502j" + ;; + *) + name="generic" + ;; + esac + + case "$machine" in + *"Allnet ALL5002/ALL5003") + all500x_board_detect + ;; + esac + + [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name" + [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$RAMIPS_MODEL" > /tmp/sysinfo/model +} + +ramips_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/ramips/base-files/lib/preinit/.svn/entries b/target/linux/ramips/base-files/lib/preinit/.svn/entries new file mode 100644 index 0000000..bf46dff --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/target/linux/ramips/base-files/lib/preinit +svn://svn.openwrt.org/openwrt + + + +2013-03-03T12:47:02.440277Z +35850 +juhosg + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +03_preinit_do_ramips.sh +file + + + + +2013-03-17T12:12:46.000000Z +be863146c3e1fa1d1f0d61b92be310f1 +2013-03-03T12:47:02.440277Z +35850 +juhosg + + + + + + + + + + + + + + + + + + + + + +105 + +06_set_iface_mac +file + + + + +2013-03-17T12:12:46.000000Z +c08558292850cc633c7bd532eaaaee2f +2013-02-16T11:50:25.188717Z +35615 +juhosg + + + + + + + + + + + + + + + + + + + + + +1522 + +05_ramips_load-input_drivers +file + + + + +2013-03-17T12:12:46.000000Z +155cc5c94b53b6d821d22e11e65243d2 +2012-02-11T20:37:34.973611Z +30463 +juhosg + + + + + + + + + + + + + + + + + + + + + +229 + diff --git a/target/linux/ramips/base-files/lib/preinit/.svn/text-base/03_preinit_do_ramips.sh.svn-base b/target/linux/ramips/base-files/lib/preinit/.svn/text-base/03_preinit_do_ramips.sh.svn-base new file mode 100644 index 0000000..31ef5f8 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/.svn/text-base/03_preinit_do_ramips.sh.svn-base @@ -0,0 +1,9 @@ +#!/bin/sh + +do_ramips() { + . /lib/ramips.sh + + ramips_board_detect +} + +boot_hook_add preinit_main do_ramips diff --git a/target/linux/ramips/base-files/lib/preinit/.svn/text-base/05_ramips_load-input_drivers.svn-base b/target/linux/ramips/base-files/lib/preinit/.svn/text-base/05_ramips_load-input_drivers.svn-base new file mode 100644 index 0000000..fbd4c83 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/.svn/text-base/05_ramips_load-input_drivers.svn-base @@ -0,0 +1,12 @@ +# +# Copyright (C) 2011 OpenWrt.org +# + +preinit_ramips_load_input_drivers() { + insmod input-core + insmod input-polldev + insmod gpio_keys_polled + insmod button-hotplug +} + +boot_hook_add preinit_main preinit_ramips_load_input_drivers diff --git a/target/linux/ramips/base-files/lib/preinit/.svn/text-base/06_set_iface_mac.svn-base b/target/linux/ramips/base-files/lib/preinit/.svn/text-base/06_set_iface_mac.svn-base new file mode 100644 index 0000000..fcfb86b --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/.svn/text-base/06_set_iface_mac.svn-base @@ -0,0 +1,79 @@ +# +# Copyright (C) 2011 OpenWrt.org +# + +preinit_set_mac_address() { + local mac + + . /lib/functions.sh + . /lib/ramips.sh + + case $(ramips_board_name) in + 3g-6200n |\ + 3g300m | \ + mzk-w300nh2 |\ + wl-330n |\ + wl-330n3g) + mac=$(mtd_get_mac_binary factory 4) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + bc2 |\ + broadway |\ + dir-620-a1 |\ + esr-9753 |\ + freestation5 |\ + nw718 |\ + psr-680w |\ + rt-n56u |\ + sl-r7205) + mac=$(mtd_get_mac_binary factory 4) + mac=$(macaddr_setbit_la "$mac") + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dir-300-b1 |\ + dir-300-b2 |\ + dir-600-b1) + mac=$(mtd_get_mac_binary devdata 16388) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dir-645) + mac=$(mtd_get_mac_ascii nvram lanmac) + mac=$(macaddr_setbit_la "$mac") + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dap-1350) + mac=$(mtd_get_mac_binary devdata 46) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + all0239-3g |\ + all0256n |\ + all5002 |\ + carambola |\ + dir-615-h1 |\ + fonera20n |\ + rt-n13u |\ + hw550-3g |\ + nbg-419n |\ + omni-emb |\ + omni-emb-hpm |\ + tew-691gr |\ + tew-692gr |\ + w306r-v20 |\ + w502u |\ + wr6202 |\ + xdxrn502j) + mac=$(mtd_get_mac_binary factory 40) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + wl341v3) + mac=$(mtd_get_mac_binary board-nvram 65440) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + rt-n10-plus) + mac=$(mtd_get_mac_binary devconf 4) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + esac +} + +boot_hook_add preinit_main preinit_set_mac_address diff --git a/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh b/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh new file mode 100644 index 0000000..31ef5f8 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +do_ramips() { + . /lib/ramips.sh + + ramips_board_detect +} + +boot_hook_add preinit_main do_ramips diff --git a/target/linux/ramips/base-files/lib/preinit/05_ramips_load-input_drivers b/target/linux/ramips/base-files/lib/preinit/05_ramips_load-input_drivers new file mode 100644 index 0000000..fbd4c83 --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/05_ramips_load-input_drivers @@ -0,0 +1,12 @@ +# +# Copyright (C) 2011 OpenWrt.org +# + +preinit_ramips_load_input_drivers() { + insmod input-core + insmod input-polldev + insmod gpio_keys_polled + insmod button-hotplug +} + +boot_hook_add preinit_main preinit_ramips_load_input_drivers diff --git a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac new file mode 100644 index 0000000..fcfb86b --- /dev/null +++ b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac @@ -0,0 +1,79 @@ +# +# Copyright (C) 2011 OpenWrt.org +# + +preinit_set_mac_address() { + local mac + + . /lib/functions.sh + . /lib/ramips.sh + + case $(ramips_board_name) in + 3g-6200n |\ + 3g300m | \ + mzk-w300nh2 |\ + wl-330n |\ + wl-330n3g) + mac=$(mtd_get_mac_binary factory 4) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + bc2 |\ + broadway |\ + dir-620-a1 |\ + esr-9753 |\ + freestation5 |\ + nw718 |\ + psr-680w |\ + rt-n56u |\ + sl-r7205) + mac=$(mtd_get_mac_binary factory 4) + mac=$(macaddr_setbit_la "$mac") + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dir-300-b1 |\ + dir-300-b2 |\ + dir-600-b1) + mac=$(mtd_get_mac_binary devdata 16388) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dir-645) + mac=$(mtd_get_mac_ascii nvram lanmac) + mac=$(macaddr_setbit_la "$mac") + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + dap-1350) + mac=$(mtd_get_mac_binary devdata 46) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + all0239-3g |\ + all0256n |\ + all5002 |\ + carambola |\ + dir-615-h1 |\ + fonera20n |\ + rt-n13u |\ + hw550-3g |\ + nbg-419n |\ + omni-emb |\ + omni-emb-hpm |\ + tew-691gr |\ + tew-692gr |\ + w306r-v20 |\ + w502u |\ + wr6202 |\ + xdxrn502j) + mac=$(mtd_get_mac_binary factory 40) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + wl341v3) + mac=$(mtd_get_mac_binary board-nvram 65440) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + rt-n10-plus) + mac=$(mtd_get_mac_binary devconf 4) + ifconfig eth0 hw ether $mac 2>/dev/null + ;; + esac +} + +boot_hook_add preinit_main preinit_set_mac_address diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh new file mode 100755 index 0000000..6638b0a --- /dev/null +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -0,0 +1,234 @@ +#!/bin/sh +# +# Copyright (C) 2010-2013 OpenWrt.org +# + +RAMIPS_BOARD_NAME= +RAMIPS_MODEL= + +all500x_board_detect() { + local systype + + systype=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo) + case "$systype" in + *"RT5350"*) + RAMIPS_MODEL="Allnet ALL5003" + ;; + *"RT3352"*) + RAMIPS_MODEL="Allnet ALL5002" + ;; + esac +} + +ramips_board_detect() { + local machine + local name + + machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo) + + case "$machine" in + *"8devices Carambola") + name="carambola" + ;; + *"Edimax 3g-6200n") + name="3g-6200n" + ;; + *"AirLive Air3GII") + name="air3gii" + ;; + *"Edimax BR-6425") + name="br6425" + ;; + *"Allnet ALL0239-3G") + name="all0239-3g" + ;; + *"Allnet ALL0256N") + name="all0256n" + ;; + *"Allnet ALL5002/ALL5003") + name="all5002" + ;; + *"ARC FreeStation5") + name="freestation5" + ;; + *"Argus ATP-52B") + name="argus-atp52b" + ;; + *"BR6524N") + name="br6524n" + ;; + *"Asus WL-330N") + name="wl-330n" + ;; + *"Asus WL-330N3G") + name="wl-330n3g" + ;; + *"Aztech HW550-3G") + name="hw550-3g" + ;; + *"DIR-300 B1") + name="dir-300-b1" + ;; + *"DIR-600 B1") + name="dir-600-b1" + ;; + *"DIR-600 B2") + name="dir-600-b2" + ;; + *"DIR-620 A1") + name="dir-620-a1" + ;; + *"DIR-615 H1") + name="dir-615-h1" + ;; + *"DIR-615 D") + name="dir-615-d" + ;; + *"DIR-645") + name="dir-645" + ;; + *"DAP-1350") + name="dap-1350" + ;; + *"ESR-9753") + name="esr-9753" + ;; + *"F5D8235 v1") + name="f5d8235-v1" + ;; + *"F5D8235 v2") + name="f5d8235-v2" + ;; + *"Hauppauge Broadway") + name="broadway" + ;; + *"La Fonera 2.0N") + name="fonera20n" + ;; + *"Asus RT-N13U") + name="rt-n13u" + ;; + *"MoFi Network MOFI3500-3GN") + name="mofi3500-3gn" + ;; + *"NBG-419N") + name="nbg-419n" + ;; + *"NexAira BC2") + name="bc2" + ;; + *"NW718") + name="nw718" + ;; + *"Omnima EMB HPM") + name="omni-emb-hpm" + ;; + *"Omnima MiniEMBWiFi") + name="omni-emb" + ;; + *"Petatel PSR-680W"*) + name="psr-680w" + ;; + *"Planex MZK-W300NH2"*) + name="mzk-w300nh2" + ;; + *"PWH2004") + name="pwh2004" + ;; + *"RT-G32 B1") + name="rt-g32-b1" + ;; + *"RT-N10+") + name="rt-n10-plus" + ;; + *"RT-N15") + name="rt-n15" + ;; + *"RT-N56U") + name="rt-n56u" + ;; + *"Skyline SL-R7205"*) + name="sl-r7205" + ;; + *"Sparklan WCR-150GN") + name="wcr-150gn" + ;; + *"V22RW-2X2") + name="v22rw-2x2" + ;; + *"W502U") + name="w502u" + ;; + *"WHR-G300N") + name="whr-g300n" + ;; + *"Sitecom WL-341 v3") + name="wl341v3" + ;; + *"Sitecom WL-351 v1 002") + name="wl-351" + ;; + *"Tenda 3G300M") + name="3g300m" + ;; + *"Tenda W306R V2.0") + name="w306r-v20" + ;; + *"TEW-691GR") + name="tew-691gr" + ;; + *"TEW-692GR") + name="tew-692gr" + ;; + *"Ralink V11ST-FE") + name="v11st-fe" + ;; + *"WLI-TX4-AG300N") + name="wli-tx4-ag300n" + ;; + *"WZR-AGL300NH") + name="wzr-agl300nh" + ;; + *"WR512-3GN-like router") + name="wr512-3gn" + ;; + *"UR-326N4G Wireless N router") + name="ur-326n4g" + ;; + *"UR-336UN Wireless N router") + name="ur-336un" + ;; + *"AWB WR6202") + name="wr6202" + ;; + *"XDX RN502J") + name="xdxrn502j" + ;; + *) + name="generic" + ;; + esac + + case "$machine" in + *"Allnet ALL5002/ALL5003") + all500x_board_detect + ;; + esac + + [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name" + [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine" + + [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/" + + echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name + echo "$RAMIPS_MODEL" > /tmp/sysinfo/model +} + +ramips_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/ramips/base-files/lib/upgrade/.svn/entries b/target/linux/ramips/base-files/lib/upgrade/.svn/entries new file mode 100644 index 0000000..1b73523 --- /dev/null +++ b/target/linux/ramips/base-files/lib/upgrade/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/target/linux/ramips/base-files/lib/upgrade +svn://svn.openwrt.org/openwrt + + + +2013-03-11T21:02:43.602648Z +35971 +juhosg + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +platform.sh +file + + + + +2013-03-17T12:12:46.000000Z +dfb9586a22583e5e30ee319a72463829 +2013-03-11T21:02:43.602648Z +35971 +juhosg +has-props + + + + + + + + + + + + + + + + + + + + +1515 + diff --git a/target/linux/ramips/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base b/target/linux/ramips/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/target/linux/ramips/base-files/lib/upgrade/.svn/prop-base/platform.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/target/linux/ramips/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base b/target/linux/ramips/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base new file mode 100644 index 0000000..97cc382 --- /dev/null +++ b/target/linux/ramips/base-files/lib/upgrade/.svn/text-base/platform.sh.svn-base @@ -0,0 +1,101 @@ +# +# Copyright (C) 2010 OpenWrt.org +# + +. /lib/ramips.sh + +PART_NAME=firmware +RAMFS_COPY_DATA=/lib/ramips.sh + +platform_check_image() { + local board=$(ramips_board_name) + local magic="$(get_magic_long "$1")" + + [ "$ARGC" -gt 1 ] && return 1 + + case "$board" in + 3g-6200n | \ + 3g300m | \ + air3gii | \ + all0239-3g | \ + all0256n | \ + all5002 | \ + bc2 | \ + broadway | \ + carambola | \ + dir-300-b1 | \ + dir-600-b1 | \ + dir-600-b2 | \ + dir-615-h1 | \ + dir-615-d | \ + dir-620-a1 | \ + dap-1350 | \ + esr-9753 | \ + fonera20n | \ + rt-n13u | \ + freestation5 | \ + hw550-3g | \ + mofi3500-3gn | \ + mzk-w300nh2 | \ + nbg-419n | \ + nw718 | \ + omni-emb | \ + omni-emb-hpm | \ + psr-680w | \ + rt-g32-b1 | \ + rt-n10-plus | \ + rt-n15 | \ + rt-n56u | \ + sl-r7205 | \ + tew-691gr | \ + tew-692gr | \ + w306r-v20 |\ + w502u |\ + wr6202 |\ + v22rw-2x2 | \ + wl341v3 | \ + wl-330n | \ + wl-351 | \ + wli-tx4-ag300n | \ + whr-g300n |\ + ur-326n4g |\ + ur-336un |\ + wr512-3gn) + [ "$magic" != "27051956" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + dir-645) + [ "$magic" != "5ea3a417" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_do_upgrade() { + local board=$(ramips_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/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000..97cc382 --- /dev/null +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -0,0 +1,101 @@ +# +# Copyright (C) 2010 OpenWrt.org +# + +. /lib/ramips.sh + +PART_NAME=firmware +RAMFS_COPY_DATA=/lib/ramips.sh + +platform_check_image() { + local board=$(ramips_board_name) + local magic="$(get_magic_long "$1")" + + [ "$ARGC" -gt 1 ] && return 1 + + case "$board" in + 3g-6200n | \ + 3g300m | \ + air3gii | \ + all0239-3g | \ + all0256n | \ + all5002 | \ + bc2 | \ + broadway | \ + carambola | \ + dir-300-b1 | \ + dir-600-b1 | \ + dir-600-b2 | \ + dir-615-h1 | \ + dir-615-d | \ + dir-620-a1 | \ + dap-1350 | \ + esr-9753 | \ + fonera20n | \ + rt-n13u | \ + freestation5 | \ + hw550-3g | \ + mofi3500-3gn | \ + mzk-w300nh2 | \ + nbg-419n | \ + nw718 | \ + omni-emb | \ + omni-emb-hpm | \ + psr-680w | \ + rt-g32-b1 | \ + rt-n10-plus | \ + rt-n15 | \ + rt-n56u | \ + sl-r7205 | \ + tew-691gr | \ + tew-692gr | \ + w306r-v20 |\ + w502u |\ + wr6202 |\ + v22rw-2x2 | \ + wl341v3 | \ + wl-330n | \ + wl-351 | \ + wli-tx4-ag300n | \ + whr-g300n |\ + ur-326n4g |\ + ur-336un |\ + wr512-3gn) + [ "$magic" != "27051956" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + dir-645) + [ "$magic" != "5ea3a417" ] && { + echo "Invalid image type." + return 1 + } + return 0 + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_do_upgrade() { + local board=$(ramips_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 |