summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-15 00:03:22 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-15 00:03:22 +0200
commit21e43093670b22302fc4d7166544290498a991b4 (patch)
tree4010e5b2880163890a1014becff925a8d5a7d084 /target
parentde1230ab3be91cea8e4a51211b0d1ce24cc85d81 (diff)
downloadmtk-20170518-21e43093670b22302fc4d7166544290498a991b4.zip
mtk-20170518-21e43093670b22302fc4d7166544290498a991b4.tar.gz
mtk-20170518-21e43093670b22302fc4d7166544290498a991b4.tar.bz2
target/linux/mediatek: add all base-files
Diffstat (limited to 'target')
-rw-r--r--target/linux/mediatek/base-files/etc/config/fstab16
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/diag.sh213
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom50
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/hotplug.d/usb/10-motion1
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/inittab3
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/uci-defaults/01_leds217
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/uci-defaults/02_network322
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/uci-defaults/03_dat2uci11
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/uci-defaults/09_fix-seama-header21
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/udhcpd.config9
-rwxr-xr-xtarget/linux/mediatek/base-files/etc/wireless/mt7615e2/mt7615e2.dat427
-rwxr-xr-xtarget/linux/mediatek/base-files/lib/preinit/03_preinit_do_ramips.sh9
-rwxr-xr-xtarget/linux/mediatek/base-files/lib/ramips.sh396
-rwxr-xr-xtarget/linux/mediatek/base-files/lib/upgrade/platform.sh151
-rwxr-xr-xtarget/linux/mediatek/base-files/usr/sbin/interface_config.sh20
-rwxr-xr-xtarget/linux/mediatek/base-files/usr/sbin/nat_router_config.sh11
-rwxr-xr-xtarget/linux/mediatek/base-files/usr/sbin/rps_config.sh12
-rwxr-xr-xtarget/linux/mediatek/base-files/usr/sbin/setsmp.sh9
-rwxr-xr-xtarget/linux/mediatek/base-files/usr/sbin/switch-llllw.sh42
19 files changed, 1940 insertions, 0 deletions
diff --git a/target/linux/mediatek/base-files/etc/config/fstab b/target/linux/mediatek/base-files/etc/config/fstab
new file mode 100644
index 0000000..c984b93
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/config/fstab
@@ -0,0 +1,16 @@
+config 'global'
+ option anon_swap '0'
+ option anon_mount '1'
+ option auto_swap '1'
+ option auto_mount '1'
+ option delay_root '5'
+ option check_fs '0'
+
+config 'mount'
+ option target '/mnt/sd*'
+ option enabled '1'
+
+config 'mount'
+ option target '/mnt/mmcblk*'
+ option enabled '1'
+
diff --git a/target/linux/mediatek/base-files/etc/diag.sh b/target/linux/mediatek/base-files/etc/diag.sh
new file mode 100755
index 0000000..74b8867
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/diag.sh
@@ -0,0 +1,213 @@
+#!/bin/sh
+# Copyright (C) 2010-2013 OpenWrt.org
+
+. /lib/functions/leds.sh
+. /lib/ramips.sh
+
+get_status_led() {
+ case $(ramips_board_name) in
+ 3g-6200n)
+ status_led="edimax:green:power"
+ ;;
+ 3g300m | w150m)
+ status_led="tenda:blue:ap"
+ ;;
+ ar725w)
+ status_led="ar725w:green:power"
+ ;;
+ awapn2403)
+ status_led="asiarf:green:wps"
+ ;;
+ argus-atp52b)
+ status_led="argus-atp52b:green:run"
+ ;;
+ asl26555)
+ status_led="asl26555:green:power"
+ ;;
+ br6524n)
+ status_led="edimax:blue:power"
+ ;;
+ br6425 | br-6475nd)
+ status_led="edimax:green:power"
+ ;;
+ cy-swr1100)
+ status_led="samsung:blue:wps"
+ ;;
+ d105)
+ status_led="d105:red:power"
+ ;;
+ dcs-930 | dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-610-a1 | dir-615-h1 | dir-615-d | dir-620-a1| dir-620-d1| dir-300-b7| dir-320-b1)
+ status_led="d-link:green:status"
+ ;;
+ dir-645)
+ status_led="d-link:green:wps"
+ ;;
+ dap-1350)
+ status_led="d-link:blue:power"
+ ;;
+ esr-9753)
+ status_led="esr-9753:orange:power"
+ ;;
+ f5d8235-v2)
+ status_led="f5d8235v2:blue:router"
+ ;;
+ fonera20n)
+ status_led="fonera20n:green:power"
+ ;;
+ ip2202)
+ status_led="ip2202:green:run"
+ ;;
+ rt-n13u)
+ status_led="rt-n13u:power"
+ ;;
+ hlk-rm04)
+ status_led="hlk-rm04:red:power"
+ ;;
+ all0239-3g|\
+ hw550-3g)
+ status_led="hw550-3g:green:status"
+ ;;
+ m3)
+ status_led="m3:blue:status"
+ ;;
+ m4)
+ status_led="m4:blue:status"
+ ;;
+ mlw221|\
+ mlwg2)
+ status_led="kingston:blue:system"
+ ;;
+ mofi3500-3gn)
+ status_led="mofi3500-3gn:green:status"
+ ;;
+ mpr-a1)
+ status_led="hame:red:power"
+ ;;
+ mpr-a2)
+ status_led="hame:red:power"
+ ;;
+ nbg-419n)
+ status_led="nbg-419n:green:power"
+ ;;
+ nw718)
+ status_led="nw718:amber:cpu"
+ ;;
+ omni-emb|\
+ omni-emb-hpm)
+ status_led="emb:green:status"
+ ;;
+ psr-680w)
+ status_led="psr-680w:red:wan"
+ ;;
+ pwh2004)
+ status_led="pwh2004:green:power"
+ ;;
+ px4885)
+ status_led="7links:orange:wifi"
+ ;;
+ rt-n15)
+ status_led="rt-n15:blue:power"
+ ;;
+ rt-n10-plus)
+ status_led="asus:green:wps"
+ ;;
+ rt-n56u | wl-330n | wl-330n3g)
+ status_led="asus:blue:power"
+ ;;
+ rut5xx)
+ status_led="rut5xx:green:status"
+ ;;
+ sl-r7205)
+ status_led="sl-r7205:green:status"
+ ;;
+ tew-691gr|\
+ tew-692gr)
+ status_led="trendnet:green:wps"
+ ;;
+ v11st-fe)
+ status_led="v11st-fe:green:status"
+ ;;
+ v22rw-2x2)
+ status_led="v22rw-2x2:green:security"
+ ;;
+ vocore)
+ status_led="vocore:green:status"
+ ;;
+ w306r-v20)
+ status_led="w306r-v20:green:sys"
+ ;;
+ w502u)
+ status_led="alfa:blue:wps"
+ ;;
+ wcr-150gn)
+ status_led="wcr150gn:amber:power"
+ ;;
+ whr-g300n)
+ status_led="whr-g300n:green:router"
+ ;;
+ wmr300 | \
+ whr-300hp2 | \
+ whr-600d)
+ status_led="buffalo:green:status"
+ ;;
+ wli-tx4-ag300n)
+ status_led="buffalo:blue:power"
+ ;;
+ wl-351)
+ status_led="wl-351:amber:power"
+ ;;
+ wr512-3gn)
+ status_led="wr512:green:wps"
+ ;;
+ wr8305rt)
+ status_led="wr8305rt:sys"
+ ;;
+ wnce2001)
+ status_led="netgear:green:power"
+ ;;
+ mzk-w300nh2)
+ status_led="mzkw300nh2:green:power"
+ ;;
+ ur-326n4g)
+ status_led="ur326:green:wps"
+ ;;
+ ur-336un)
+ status_led="ur336:green:wps"
+ ;;
+ x5)
+ status_led="x5:green:power"
+ ;;
+ x8)
+ status_led="x8:green:power"
+ ;;
+ xdxrn502j)
+ status_led="xdxrn502j:green:power"
+ ;;
+ f7c027)
+ status_led="belkin:orange:status"
+ ;;
+ na930)
+ status_led="na930:blue:power"
+ ;;
+ y1 | \
+ y1s)
+ status_led="lenovo:blue:power"
+ ;;
+ esac
+}
+
+set_state() {
+ get_status_led
+
+ case "$1" in
+ preinit)
+ status_led_blink_preinit
+ ;;
+ failsafe)
+ status_led_blink_failsafe
+ ;;
+ done)
+ status_led_on
+ ;;
+ esac
+}
diff --git a/target/linux/mediatek/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/mediatek/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
new file mode 100755
index 0000000..2a5a80c
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+rt2x00_eeprom_die() {
+ echo "rt2x00 eeprom: " "$*"
+ exit 1
+}
+
+rt2x00_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+
+ . /lib/functions.sh
+
+ mtd=$(find_mtd_part $part)
+ [ -n "$mtd" ] || \
+ rt2x00_eeprom_die "no mtd device found for partition $part"
+
+ dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
+ rt2x00_eeprom_die "failed to extract from $mtd"
+}
+
+FW="/lib/firmware/$FIRMWARE"
+[ -e "$FW" ] && exit 0
+
+. /lib/ramips.sh
+
+board=$(ramips_board_name)
+
+case "$FIRMWARE" in
+"soc_wmac.eeprom")
+ case $board in
+ *)
+ rt2x00_eeprom_die "Please define mtd-eeprom in $board DTS file!"
+ ;;
+ esac
+ ;;
+
+"rt2x00pci_1_0.eeprom")
+ case $board in
+ cy-swr1100)
+ rt2x00_eeprom_extract "factory" 8192 512
+ ;;
+ rt-n56u | whr-600d | whr-1166d)
+ rt2x00_eeprom_extract "factory" 32768 512
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/mediatek/base-files/etc/hotplug.d/usb/10-motion b/target/linux/mediatek/base-files/etc/hotplug.d/usb/10-motion
new file mode 100755
index 0000000..557698b
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/hotplug.d/usb/10-motion
@@ -0,0 +1 @@
+[ "$ACTION" == "motion" ] && logger webcam motion event
diff --git a/target/linux/mediatek/base-files/etc/inittab b/target/linux/mediatek/base-files/etc/inittab
new file mode 100755
index 0000000..7817185
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/inittab
@@ -0,0 +1,3 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+::askconsole:/bin/ash --login
diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/01_leds b/target/linux/mediatek/base-files/etc/uci-defaults/01_leds
new file mode 100755
index 0000000..5d6ed2b
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/uci-defaults/01_leds
@@ -0,0 +1,217 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+. /lib/ramips.sh
+
+set_usb_led() {
+ ucidef_set_led_usbdev "usb" "USB" "$1" "1-1"
+}
+
+set_wifi_led() {
+ ucidef_set_led_netdev "wifi_led" "wifi" "$1" "wlan0"
+}
+
+board=$(ramips_board_name)
+
+case $board in
+ 3g-6200n)
+ set_wifi_led "edimax:amber:wlan"
+ set_usb_led "edimax:blue:3g"
+ ;;
+ 3g-6200nl)
+ set_wifi_led "edimax:green:wlan"
+ ;;
+ 3g300m)
+ set_usb_led "tenda:blue:3g"
+ ;;
+ air3gii)
+ set_wifi_led "airlive:green:wlan"
+ set_usb_led "airlive:green:mobile"
+ ;;
+ all0256n)
+ ucidef_set_rssimon "wlan0" "40000" "1"
+ ucidef_set_led_rssi "rssilow" "RSSILOW" "all0256n:green:rssilow" "wlan0" "1" "40" "0" "6"
+ ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "all0256n:green:rssimed" "wlan0" "30" "80" "-29" "5"
+ ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "all0256n:green:rssihigh" "wlan0" "70" "100" "-69" "8"
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ awapn2403)
+ set_wifi_led "rt2800soc-phy0::radio"
+ ;;
+ ar725w)
+ set_wifi_led "rt2800soc-phy0::radio"
+ ;;
+ asl26555)
+ ucidef_set_led_default "power" "POWER" "asl26555:green:power" "1"
+ ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0"
+ set_wifi_led "asl26555:green:wlan"
+ set_usb_led "asl26555:green:3g"
+ ;;
+ bc2)
+ set_usb_led "bc2:blue:usb"
+ ;;
+ br6425)
+ set_wifi_led "edimax:orange:wlan"
+ ;;
+ br-6475nd)
+ set_wifi_led "edimax:amber:wlan"
+ ;;
+ broadway)
+ set_usb_led "red:diskmounted"
+ set_wifi_led "red:wps_active"
+ ;;
+ br6524n)
+ set_wifi_led "edimax:blue:wlan"
+ ;;
+ cy-swr1100)
+ ucidef_set_led_default "wps" "WPS" "samsung:blue:wps" "0"
+ set_usb_led "samsung:blue:usb"
+ ;;
+ d105)
+ ucidef_set_led_default "power" "POWER" "d105:red:power" "1"
+ set_usb_led "d105:green:usb"
+ ;;
+ dir-300-b1|\
+ dir-600-b1|\
+ dir-600-b2|\
+ dir-620-a1)
+ # ANDed with vlan switch port 4 led state
+ ucidef_set_led_default "wan" "WAN LED (amber)" "d-link:amber:wan" "1"
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ dir-615-d|\
+ dir-615-h1)
+ ucidef_set_led_default "status" "Status LED (amber)" "d-link:amber:status" "0"
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ dir-620-d1)
+ set_wifi_led "d-link:green:wifi"
+ ;;
+ dir-810l)
+ ucidef_set_led_default "power" "POWER" "dlink:green:power" "1"
+ ;;
+ dir-610-a1 |\
+ dir-300-b7 |\
+ dir-320-b1 |\
+ esr-9753)
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ f5d8235-v1)
+ set_usb_led "f5d8235-v1:blue:storage"
+ ;;
+ f5d8235-v2)
+ set_usb_led "f5d8235v2:blue:storage"
+ ;;
+ fonera20n)
+ set_usb_led "fonera20n:orange:usb"
+ set_wifi_led "fonera20n:orange:wifi"
+ ;;
+ hlk-rm04)
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ all0239-3g|\
+ hw550-3g)
+ set_usb_led "hw550-3g:green:usb"
+ ;;
+ mlw221|\
+ mlwg2)
+ set_wifi_led "kingston:blue:wifi"
+ ucidef_set_led_default "system" "system" "kingston:blue:system" "1"
+ ;;
+ mofi3500-3gn)
+ set_usb_led "mofi3500-3gn:green:usb"
+ ;;
+ mpr-a1)
+ set_wifi_led "hame:blue:system"
+ ;;
+ mpr-a2)
+ set_wifi_led "hame:blue:system"
+ ;;
+ mzk-w300nh2)
+ set_wifi_led "mzkw300nh2:amber:wlan"
+ ;;
+ na930)
+ set_usb_led "na930:blue:status"
+ ;;
+ nw718)
+ set_usb_led "nw718:amber:usb"
+ ;;
+ omni-emb-hpm)
+ ucidef_set_led_default "power" "POWER" "emb:orange:power" "1"
+ ucidef_set_led_netdev "eth" "ETH" "emb:green:eth" "eth0"
+ set_wifi_led "emb:green:wifi"
+ ;;
+ omni-plug)
+ set_wifi_led "miniplug:green:wlan"
+ set_usb_led "miniplug:green:mobile"
+ ;;
+ px4885)
+ set_wifi_led "7links:orange:wifi"
+ set_usb_led "7links:blue:storage"
+ ;;
+ sl-r7205)
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ v11st-fe)
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ vocore)
+ ucidef_set_led_netdev "eth" "ETH" "vocore:orange:eth" "eth0"
+ set_wifi_led "vocore:green:status"
+ ;;
+ w306r-v20)
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ w502u)
+ set_usb_led "alfa:blue:usb"
+ set_wifi_led "rt2800pci-phy0::radio"
+ ;;
+ wcr-150gn)
+ set_usb_led "wcr150gn:amber:user"
+ ;;
+ hg255d)
+ set_wifi_led "hg255d:wlan"
+ set_usb_led "hg255d:usb"
+ ucidef_set_led_netdev "eth" "Internet" "hg255d:internet" "eth0.2"
+ ;;
+ wnce2001)
+ set_wifi_led "netgear:green:wlan"
+ ;;
+ rt-n14u)
+ ucidef_set_led_default "power" "power" "asus:blue:power" "1"
+ ucidef_set_led_netdev "lan" "lan" "asus:blue:lan" "eth0.1"
+ ucidef_set_led_netdev "wan" "wan" "asus:blue:wan" "eth0.2"
+ set_wifi_led "asus:blue:air"
+ set_usb_led "asus:blue:usb"
+ ;;
+ rp-n53)
+ ucidef_set_led_netdev "eth" "Network" "asus:white:back" "eth0"
+ set_wifi_led "asus:blue:wifi"
+ ;;
+ whr-300hp2 |\
+ whr-600d |\
+ whr-1166d)
+ ucidef_set_led_default "power" "power" "buffalo:green:power" "1"
+ ucidef_set_led_default "router" "router" "buffalo:green:router" "1"
+ ;;
+ zbt-wa05)
+ ucidef_set_led_default "power" "power" "zbtlink:blue:power" "1"
+ set_wifi_led "zbtlink:blue:air"
+ set_usb_led "zbtlink:blue:usb"
+ ;;
+ wr8305rt)
+ ucidef_set_led_default "power" "power" "wr8305rt:sys" "1"
+ set_usb_led "wr8305rt:usb"
+ set_wifi_led "wr8305rt:wifi"
+ ;;
+ y1 |\
+ y1s)
+ ucidef_set_led_default "power" "power" "lenovo:blue:power" "1"
+ set_usb_led "lenovo:blue:usb"
+ set_wifi_led "lenovo:blue:wifi"
+ ;;
+esac
+
+ucidef_commit_leds
+
+exit 0
diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/02_network b/target/linux/mediatek/base-files/etc/uci-defaults/02_network
new file mode 100755
index 0000000..f3d6e87
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/uci-defaults/02_network
@@ -0,0 +1,322 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/ramips.sh
+. /lib/functions/uci-defaults.sh
+. /lib/functions/system.sh
+
+ramips_setup_rt3x5x_vlans()
+{
+ if [ ! -x /sbin/swconfig ]; then
+ # legacy default
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ return
+ fi
+ local wanports=""
+ local lanports=""
+ for port in 5 4 3 2 1 0; do
+ if [ `swconfig dev rt305x port $port get disable` = "1" ]; then
+ continue
+ fi
+ if [ `swconfig dev rt305x port $port get lan` = "0" ]; then
+ wanports="$port $wanports"
+ else
+ lanports="$port $lanports"
+ fi
+ done
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "rt305x" "1" "1"
+ ucidef_add_switch_vlan "rt305x" "1" "$lanports 6t"
+ ucidef_add_switch_vlan "rt305x" "2" "$wanports 6t"
+}
+
+ramips_setup_interfaces()
+{
+ local board="$1"
+
+ ucidef_set_interface_loopback
+
+ case $board in
+ 3g300m | \
+ w150m | \
+ all0256n | \
+ all5002 | \
+ all5003 | \
+ broadway | \
+ dcs-930| \
+ ncs601w | \
+ wnce2001)
+ ucidef_add_switch "switch0" "1" "0"
+ ucidef_set_interface_lan "eth0"
+ ;;
+
+ 3g-6200nl | \
+ mlw221)
+ ucidef_set_interface_lan "eth0.2"
+ ;;
+
+ mlwg2 | \
+ wl-330n | \
+ wmr300)
+ ucidef_set_interface_lan "eth0.1"
+ ;;
+
+ b2c | \
+ nw718 | \
+ psr-680w | \
+ sl-r7205 | \
+ w502u | \
+ wr6202)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ;;
+
+ awapn2403)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 6t"
+ ucidef_add_switch_vlan "switch0" "2" "1 6t"
+ ;;
+
+ br-6475nd)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
+ ucidef_add_switch_vlan "switch0" "2" "0 9t"
+ ;;
+
+ asl26555)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
+ ;;
+
+ cy-swr1100)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 9t"
+ ucidef_add_switch_vlan "switch0" "2" "4 9t"
+ ;;
+
+ 3g-6200n | \
+ dir-610-a1 | \
+ dir-300-b7 | \
+ dir-320-b1 | \
+ dir-615-h1 | \
+ hlk-rm04 | \
+ mzk-w300nh2 | \
+ mzk-750dhp)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
+ ucidef_add_switch_vlan "switch0" "2" "4 6t"
+ ;;
+
+ awm002-evb | \
+ awm003-evb | \
+ argus-atp52b | \
+ dir-645 | \
+ f5d8235-v1 | \
+ f5d8235-v2 | \
+ hg255d | \
+ rt-n14u | \
+ wrtnode | \
+ ur-326n4g | \
+ zbt-wa05)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
+ ucidef_add_switch_vlan "switch0" "2" "0 6t"
+ ;;
+
+ ur-336un)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ;;
+
+ br6524n | \
+ v11st-fe)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
+ ucidef_add_switch_vlan "switch0" "2" "0 5t"
+ ;;
+
+ ar725w | \
+ rt-n15 | \
+ wl-351)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
+ ucidef_add_switch_vlan "switch0" "2" "4 5t"
+ ;;
+
+ rt-n56u)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
+ ucidef_add_switch_vlan "switch0" "2" "4 8t"
+ ;;
+
+ tew-691gr|\
+ tew-692gr)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
+ ucidef_add_switch_vlan "switch0" "2" "0t 5"
+ ;;
+
+ vocore)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 4 6t"
+ ;;
+
+ wcr-150gn)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 6t"
+ ucidef_add_switch_vlan "switch0" "2" "6t"
+ ;;
+
+ wr8305rt)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 6t"
+ ucidef_add_switch_vlan "switch0" "2" "4 6t"
+ ;;
+
+ y1 |\
+ y1s)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
+ ucidef_add_switch_vlan "switch0" "2" "0 6t"
+ ;;
+ d105 | \
+ na930 | \
+ omni-emb-hpm|\
+ wli-tx4-ag300n)
+ ucidef_set_interface_lan "eth0"
+ ;;
+
+ ralink-soc)
+ ucidef_set_interface_lan "eth0"
+ ucidef_set_interface_wan "eth1"
+ ;;
+
+ *)
+ RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
+ if [ -n "${RT3X5X}" ]; then
+ ramips_setup_rt3x5x_vlans
+ else
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ fi
+ ;;
+ esac
+}
+
+ramips_setup_macs()
+{
+ local board="$1"
+ local lan_mac=""
+ local wan_mac=""
+
+ case $board in
+ br-6475nd)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wan_mac=$(mtd_get_mac_binary devdata 7)
+ ;;
+
+ w306r-v20)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wan_mac=$(macaddr_add "$lan_mac" 5)
+ ;;
+
+ tew-691gr)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wan_mac=$(macaddr_add "$lan_mac" 3)
+ ;;
+
+ tew-692gr)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wan_mac=$(macaddr_add "$lan_mac" 4)
+ ;;
+
+ m3 |\
+ m4 |\
+ x5 |\
+ x8)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ lan_mac=$(macaddr_add "$lan_mac" -2)
+ ;;
+
+ bc2 |\
+ broadway |\
+ d105 |\
+ dir-620-a1 |\
+ esr-9753 |\
+ freestation5 |\
+ hlk-rm04 | \
+ mpr-a1 | \
+ mpr-a2 | \
+ dir-300-b7 | \
+ dir-320-b1 | \
+ psr-680w |\
+ sl-r7205 |\
+ y1 |\
+ y1s)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ lan_mac=$(macaddr_setbit_la "$lan_mac")
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+
+ cy-swr1100 | \
+ dir-645)
+ lan_mac=$(mtd_get_mac_ascii nvram lanmac)
+ wan_mac=$(mtd_get_mac_ascii nvram wanmac)
+ ;;
+
+ wcr-150gn)
+ wan_mac=$(mtd_get_mac_binary factory 40)
+ ;;
+
+ rt-n56u)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ lan_mac=$(macaddr_setbit_la "$lan_mac")
+ wan_mac=$(mtd_get_mac_binary factory 32772)
+ ;;
+
+ all0239-3g | \
+ carambola | \
+ freestation5 | \
+ w502u | \
+ wnce2001)
+ wan_mac=$(mtd_get_mac_binary factory 46)
+ ;;
+ ralink-soc)
+ lan_mac=$(eth_mac r lan)
+ wan_mac=$(eth_mac r wan)
+ ;;
+
+ *)
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+
+ esac
+
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+}
+
+[ -e /etc/config/network ] && exit 0
+
+touch /etc/config/network
+
+board=$(ramips_board_name)
+
+ramips_setup_interfaces $board
+ramips_setup_macs $board
+
+uci commit network
+
+exit 0
diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/03_dat2uci b/target/linux/mediatek/base-files/etc/uci-defaults/03_dat2uci
new file mode 100755
index 0000000..dec16f7
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/uci-defaults/03_dat2uci
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+
+
+echo "update uci config with dat file" > /tmp/dat2uci.log
+#[ -e /etc/config/wireless ] && rm /etc/config/wireless
+for dat in /etc/wireless/*/*.dat
+do
+ echo $dat
+ #dat2uci $dat >> /tmp/dat2uci.log
+done
+
diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/09_fix-seama-header b/target/linux/mediatek/base-files/etc/uci-defaults/09_fix-seama-header
new file mode 100755
index 0000000..a6c392c
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/uci-defaults/09_fix-seama-header
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+. /lib/ramips.sh
+
+fix_seama_header() {
+ local part=$1
+
+ mtd fixseama $part
+}
+
+board=$(ramips_board_name)
+
+case "$board" in
+cy-swr1100 | \
+dir-645)
+ fix_seama_header kernel
+ ;;
+esac
diff --git a/target/linux/mediatek/base-files/etc/udhcpd.config b/target/linux/mediatek/base-files/etc/udhcpd.config
new file mode 100755
index 0000000..7efc787
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/udhcpd.config
@@ -0,0 +1,9 @@
+start 192.168.1.100
+end 192.168.1.200
+interface br-lan
+option subnet 255.255.255.0
+option dns 192.168.1.251 168.95.1.1
+option router 192.168.1.1
+option lease 86400
+lease_file /var/udhcpd.leases
+
diff --git a/target/linux/mediatek/base-files/etc/wireless/mt7615e2/mt7615e2.dat b/target/linux/mediatek/base-files/etc/wireless/mt7615e2/mt7615e2.dat
new file mode 100755
index 0000000..77e6a4b
--- /dev/null
+++ b/target/linux/mediatek/base-files/etc/wireless/mt7615e2/mt7615e2.dat
@@ -0,0 +1,427 @@
+
+#The word of "Default" must not be removed
+Default
+CountryRegion=5
+CountryRegionABand=7
+CountryCode=
+AutoChannelSkipList=
+DBDC_MODE=0
+IcapMode=0
+BssidNum=1
+SSID=
+SSID1=MT7623_AP
+SSID2=
+SSID3=
+SSID4=
+SSID5=
+SSID6=
+SSID7=
+SSID8=
+SSID9=
+SSID10=
+SSID11=
+SSID12=
+SSID13=
+SSID14=
+SSID15=
+SSID16=
+WirelessMode=9
+FixedTxMode=
+EthConvertMode=dongle
+TxRate=0
+Channel=6
+BasicRate=15
+BeaconPeriod=100
+DtimPeriod=1
+TxPower=100
+SKUenable=0
+PERCENTAGEenable=0
+BFBACKOFFenable=0
+CalCacheApply=0
+DisableOLBC=0
+BGProtection=0
+TxAntenna=
+RxAntenna=
+TxPreamble=0
+RTSThreshold=2347
+FragThreshold=2346
+TxBurst=1
+PktAggregate=1
+AutoProvisionEn=0
+FreqDelta=0
+TurboRate=0
+WmmCapable=1
+APAifsn=3;7;1;1
+APCwmin=4;4;3;2
+APCwmax=6;10;4;3
+APTxop=0;0;94;47
+APACM=0;0;0;0
+BSSAifsn=3;7;2;2
+BSSCwmin=4;4;3;2
+BSSCwmax=10;10;4;3
+BSSTxop=0;0;94;47
+BSSACM=0;0;0;0
+AckPolicy=0;0;0;0
+APSDCapable=0
+DLSCapable=0
+NoForwarding=0
+NoForwardingBTNBSSID=0
+HideSSID=0
+ShortSlot=1
+AutoChannelSelect=0
+IEEE8021X=0
+IEEE80211H=1
+CarrierDetect=0
+ITxBfEn=0
+PreAntSwitch=
+PhyRateLimit=0
+DebugFlags=0
+ETxBfEnCond=0
+MUTxRxEnable=0
+ITxBfTimeout=0
+ETxBfTimeout=0
+ETxBfNoncompress=0
+ETxBfIncapable=0
+FineAGC=0
+StreamMode=0
+StreamModeMac0=
+StreamModeMac1=
+StreamModeMac2=
+StreamModeMac3=
+CSPeriod=6
+RDRegion=
+StationKeepAlive=0
+DfsCalibration=0
+DfsEnable=0
+DfsZeroWait=0
+DfsZeroWaitCacTime=255
+DfsLowerLimit=0
+DfsUpperLimit=0
+DfsOutdoor=0
+SymRoundFromCfg=0
+BusyIdleFromCfg=0
+DfsRssiHighFromCfg=0
+DfsRssiLowFromCfg=0
+DFSParamFromConfig=0
+FCCParamCh0=
+FCCParamCh1=
+FCCParamCh2=
+FCCParamCh3=
+CEParamCh0=
+CEParamCh1=
+CEParamCh2=
+CEParamCh3=
+JAPParamCh0=
+JAPParamCh1=
+JAPParamCh2=
+JAPParamCh3=
+JAPW53ParamCh0=
+JAPW53ParamCh1=
+JAPW53ParamCh2=
+JAPW53ParamCh3=
+FixDfsLimit=0
+LongPulseRadarTh=0
+AvgRssiReq=0
+DFS_R66=0
+BlockCh=
+GreenAP=0
+PreAuth=0
+AuthMode=OPEN
+EncrypType=NONE
+WapiPsk1=
+WapiPsk2=
+WapiPsk3=
+WapiPsk4=
+WapiPsk5=
+WapiPsk6=
+WapiPsk7=
+WapiPsk8=
+WapiPsk9=
+WapiPsk10=
+WapiPsk11=
+WapiPsk12=
+WapiPsk13=
+WapiPsk14=
+WapiPsk15=
+WapiPsk16=
+WapiPskType=
+Wapiifname=
+WapiAsCertPath=
+WapiUserCertPath=
+WapiAsIpAddr=
+WapiAsPort=
+BssidNum=1
+RekeyMethod=DISABLE
+RekeyInterval=3600
+PMKCachePeriod=10
+MeshAutoLink=0
+MeshAuthMode=
+MeshEncrypType=
+MeshDefaultkey=0
+MeshWEPKEY=
+MeshWPAKEY=
+MeshId=
+WPAPSK=
+WPAPSK1=12345678
+WPAPSK2=
+WPAPSK3=
+WPAPSK4=
+WPAPSK5=
+WPAPSK6=
+WPAPSK7=
+WPAPSK8=
+WPAPSK9=
+WPAPSK10=
+WPAPSK11=
+WPAPSK12=
+WPAPSK13=
+WPAPSK14=
+WPAPSK15=
+WPAPSK16=
+DefaultKeyID=1
+Key1Type=0
+Key1Str=
+Key1Str1=
+Key1Str2=
+Key1Str3=
+Key1Str4=
+Key1Str5=
+Key1Str6=
+Key1Str7=
+Key1Str8=
+Key1Str9=
+Key1Str10=
+Key1Str11=
+Key1Str12=
+Key1Str13=
+Key1Str14=
+Key1Str15=
+Key1Str16=
+Key2Type=0
+Key2Str=
+Key2Str1=
+Key2Str2=
+Key2Str3=
+Key2Str4=
+Key2Str5=
+Key2Str6=
+Key2Str7=
+Key2Str8=
+Key2Str9=
+Key2Str10=
+Key2Str11=
+Key2Str12=
+Key2Str13=
+Key2Str14=
+Key2Str15=
+Key2Str16=
+Key3Type=0
+Key3Str=
+Key3Str1=
+Key3Str2=
+Key3Str3=
+Key3Str4=
+Key3Str5=
+Key3Str6=
+Key3Str7=
+Key3Str8=
+Key3Str9=
+Key3Str10=
+Key3Str11=
+Key3Str12=
+Key3Str13=
+Key3Str14=
+Key3Str15=
+Key3Str16=
+Key4Type=0
+Key4Str=
+Key4Str1=
+Key4Str2=
+Key4Str3=
+Key4Str4=
+Key4Str5=
+Key4Str6=
+Key4Str7=
+Key4Str8=
+Key4Str9=
+Key4Str10=
+Key4Str11=
+Key4Str12=
+Key4Str13=
+Key4Str14=
+Key4Str15=
+Key4Str16=
+HSCounter=0
+HT_HTC=1
+HT_RDG=1
+HT_LinkAdapt=0
+HT_OpMode=0
+HT_MpduDensity=5
+HT_EXTCHA=1
+HT_BW=1
+HT_AutoBA=1
+HT_BADecline=0
+HT_AMSDU=0
+HT_BAWinSize=64
+HT_GI=1
+HT_STBC=1
+HT_MCS=33
+HT_TxStream=2
+HT_RxStream=2
+HT_PROTECT=1
+HT_DisallowTKIP=1
+HT_BSSCoexistence=0
+HT_LDPC=0
+GreenAP=0
+VHT_BW=1
+VHT_Sec80_Channel=0
+VHT_STBC=0
+VHT_SGI=0
+VHT_BW_SIGNAL=0
+VHT_LDPC=0
+G_BAND_256QAM=1
+WscConfMode=0
+WscConfStatus=2
+WCNTest=0
+AccessPolicy0=0
+AccessControlList0=
+AccessPolicy1=0
+AccessControlList1=
+AccessPolicy2=0
+AccessControlList2=
+AccessPolicy3=0
+AccessControlList3=
+AccessPolicy4=0
+AccessControlList4=
+AccessPolicy5=0
+AccessControlList5=
+AccessPolicy6=0
+AccessControlList6=
+AccessPolicy7=0
+AccessControlList7=
+AccessPolicy8=0
+AccessControlList8=
+AccessPolicy9=0
+AccessControlList9=
+AccessPolicy10=0
+AccessControlList10=
+AccessPolicy11=0
+AccessControlList11=
+AccessPolicy12=0
+AccessControlList12=
+AccessPolicy13=0
+AccessControlList13=
+AccessPolicy14=0
+AccessControlList14=
+AccessPolicy15=0
+AccessControlList15=
+WdsEnable=0
+WdsPhyMode=
+WdsEncrypType=NONE
+WdsList=
+Wds0Key=
+Wds1Key=
+Wds2Key=
+Wds3Key=
+RADIUS_Server=0
+RADIUS_Port=1812
+RADIUS_Key1=
+RADIUS_Key2=
+RADIUS_Key3=
+RADIUS_Key4=
+RADIUS_Key5=
+RADIUS_Key6=
+RADIUS_Key7=
+RADIUS_Key8=
+RADIUS_Key9=
+RADIUS_Key10=
+RADIUS_Key11=
+RADIUS_Key12=
+RADIUS_Key13=
+RADIUS_Key14=
+RADIUS_Key15=
+RADIUS_Key16=
+RADIUS_Acct_Server=
+RADIUS_Acct_Port=1813
+RADIUS_Acct_Key=
+own_ip_addr=192.168.1.1
+Ethifname=
+EAPifname=br-lan
+PreAuthifname=br-lan
+session_timeout_interval=0
+idle_timeout_interval=0
+WiFiTest=0
+TGnWifiTest=0
+ApCliEnable=
+ApCliSsid=
+ApCliBssid=
+ApCliAuthMode=
+ApCliEncrypType=
+ApCliWPAPSK=
+ApCliDefaultKeyID=
+ApCliKey1Type=
+ApCliKey1Str=
+ApCliKey2Type=
+ApCliKey2Str=
+ApCliKey3Type=
+ApCliKey3Str=
+ApCliKey4Type=
+ApCliKey4Str=
+MACRepeaterEn=
+MACRepeaterOuiMode=2
+ApCliWirelessMode=
+ApCliWPAPSK1=
+ApCliKey1Str1=
+ApCliKey2Str1=
+ApCliKey3Str1=
+ApCliKey4Str1=
+EfuseBufferMode=0
+E2pAccessMode=2
+PMFMFPC=1
+PMFMFPR=0
+PMFSHA256=0
+RadioOn=1
+BW_Enable=0
+BW_Root=0
+BW_Priority=
+BW_Guarantee_Rate=
+BW_Maximum_Rate=
+VOW_BW_Ctrl=
+VOW_Airtime_Fairness_En=1
+VOW_RX_En=
+VOW_Refill_Period=
+VOW_Sta_VO_DWRR_Quantum=
+VOW_Sta_VI_DWRR_Quantum=
+VOW_Sta_BE_DWRR_Quantum=
+VOW_Sta_BK_DWRR_Quantum=
+VOW_WMM_Search_Rule_Band0=
+VOW_WMM_Search_Rule_Band1=
+VOW_Sta_DWRR_Max_Wait_Time=
+VOW_Group_DWRR_Max_Wait_Time=
+VOW_Group_Min_Rate=
+VOW_Group_Max_Rate=
+VOW_Group_Min_Ratio=
+VOW_Group_Max_Ratio=
+VOW_Airtime_Ctrl_En=
+VOW_Rate_Ctrl_En=
+VOW_Group_Min_Rate_Bucket_Size=
+VOW_Group_Max_Rate_Bucket_Size=
+VOW_Group_Min_Airtime_Bucket_Size=
+VOW_Group_Max_Airtime_Bucket_Size=
+VOW_Group_Backlog=
+VOW_Group_Max_Wait_Time=
+VOW_Group_DWRR_Quantum=
+VOW_WATF_Enable=
+VOW_WATF_Q_LV0=
+VOW_WATF_Q_LV1=
+VOW_WATF_Q_LV2=
+VOW_WATF_Q_LV3=
+VOW_WATF_MAC_LV0=
+VOW_WATF_MAC_LV1=
+VOW_WATF_MAC_LV2=
+VOW_WATF_MAC_LV3=
+RED_Enable=1
+CP_SUPPORT=2
+BgndScanSkipCh=
+EDCCAEnable=
+BandSteering=0
diff --git a/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_ramips.sh b/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_ramips.sh
new file mode 100755
index 0000000..31ef5f8
--- /dev/null
+++ b/target/linux/mediatek/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/mediatek/base-files/lib/ramips.sh b/target/linux/mediatek/base-files/lib/ramips.sh
new file mode 100755
index 0000000..2691247
--- /dev/null
+++ b/target/linux/mediatek/base-files/lib/ramips.sh
@@ -0,0 +1,396 @@
+#!/bin/sh
+#
+# Copyright (C) 2010-2013 OpenWrt.org
+#
+
+RAMIPS_BOARD_NAME=
+RAMIPS_MODEL=
+
+ramips_board_detect() {
+ local machine
+ local name
+
+ machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
+
+ case "$machine" in
+ *"7Links PX-4885")
+ name="px4885"
+ ;;
+ *"8devices Carambola")
+ name="carambola"
+ ;;
+ *"Edimax 3g-6200n")
+ name="3g-6200n"
+ ;;
+ *"Edimax 3g-6200nl")
+ name="3g-6200nl"
+ ;;
+ *"Airlink101 AR725W")
+ name="ar725w"
+ ;;
+ *"AirLive Air3GII")
+ name="air3gii"
+ ;;
+ *"Edimax BR-6425")
+ name="br6425"
+ ;;
+ *"Allnet ALL0239-3G")
+ name="all0239-3g"
+ ;;
+ *"Allnet ALL0256N")
+ name="all0256n"
+ ;;
+ *"Allnet ALL5002")
+ name="all5002"
+ ;;
+ *"Allnet ALL5003")
+ name="all5003"
+ ;;
+ *"ARC FreeStation5")
+ name="freestation5"
+ ;;
+ *"Argus ATP-52B")
+ name="argus-atp52b"
+ ;;
+ *"AsiaRF AWM002 EVB")
+ name="awm002-evb"
+ ;;
+ *"AsiaRF AWM003 EVB")
+ name="awm003-evb"
+ ;;
+ *"AsiaRF AWAPN2403")
+ name="awapn2403"
+ ;;
+ *"Asus WL-330N")
+ name="wl-330n"
+ ;;
+ *"Asus WL-330N3G")
+ name="wl-330n3g"
+ ;;
+ *"Alpha ASL26555")
+ name="asl26555"
+ ;;
+ *"Aztech HW550-3G")
+ name="hw550-3g"
+ ;;
+ *"CY-SWR1100")
+ name="cy-swr1100"
+ ;;
+ *"DCS-930")
+ name="dcs-930"
+ ;;
+ *"DIR-300 B1")
+ name="dir-300-b1"
+ ;;
+ *"DIR-300 B7")
+ name="dir-300-b7"
+ ;;
+ *"DIR-320 B1")
+ name="dir-320-b1"
+ ;;
+ *"DIR-600 B1")
+ name="dir-600-b1"
+ ;;
+ *"DIR-600 B2")
+ name="dir-600-b2"
+ ;;
+ *"DIR-610 A1")
+ name="dir-610-a1"
+ ;;
+ *"DIR-620 A1")
+ name="dir-620-a1"
+ ;;
+ *"DIR-620 D1")
+ name="dir-620-d1"
+ ;;
+ *"DIR-615 H1")
+ name="dir-615-h1"
+ ;;
+ *"DIR-615 D")
+ name="dir-615-d"
+ ;;
+ *"DIR-645")
+ name="dir-645"
+ ;;
+ *"DIR-810L")
+ name="dir-810l"
+ ;;
+ *"DAP-1350")
+ name="dap-1350"
+ ;;
+ *"ESR-9753")
+ name="esr-9753"
+ ;;
+ *"Edimax BR-6475nD")
+ name="br-6475nd"
+ ;;
+ *"F7C027")
+ name="f7c027"
+ ;;
+ *"F5D8235 v1")
+ name="f5d8235-v1"
+ ;;
+ *"F5D8235 v2")
+ name="f5d8235-v2"
+ ;;
+ *"Hauppauge Broadway")
+ name="broadway"
+ ;;
+ *"Huawei D105")
+ name="d105"
+ ;;
+ *"La Fonera 2.0N")
+ name="fonera20n"
+ ;;
+ *"Asus RT-N14U")
+ name="rt-n14u"
+ ;;
+ *"Asus RT-N13U")
+ name="rt-n13u"
+ ;;
+ *"MoFi Network MOFI3500-3GN")
+ name="mofi3500-3gn"
+ ;;
+ *"HILINK HLK-RM04")
+ name="hlk-rm04"
+ ;;
+ *"HAME MPR-A1")
+ name="mpr-a1"
+ ;;
+ *"HAME MPR-A2")
+ name="mpr-a2"
+ ;;
+ *"Kingston MLW221")
+ name="mlw221"
+ ;;
+ *"Kingston MLWG2")
+ name="mlwg2"
+ ;;
+ *"Planex MZK-750DHP")
+ name="mzk-750dhp"
+ ;;
+ *"NBG-419N")
+ name="nbg-419n"
+ ;;
+ *"Netgear WNCE2001")
+ name="wnce2001"
+ ;;
+ *"NexAira BC2")
+ name="bc2"
+ ;;
+ *"NW718")
+ name="nw718"
+ ;;
+ *"Omnima EMB HPM")
+ name="omni-emb-hpm"
+ ;;
+ *"Omnima MiniEMBWiFi")
+ name="omni-emb"
+ ;;
+ *"Omnima MiniPlug")
+ name="omni-plug"
+ ;;
+ *"Petatel PSR-680W"*)
+ name="psr-680w"
+ ;;
+ *"Planex MZK-W300NH2"*)
+ name="mzk-w300nh2"
+ ;;
+ *"Poray IP2202")
+ name="ip2202"
+ ;;
+ *"Poray M3")
+ name="m3"
+ ;;
+ *"Poray M4")
+ name="m4"
+ ;;
+ *"Poray X5")
+ name="x5"
+ ;;
+ *"Poray X8")
+ name="x8"
+ ;;
+ *"PWH2004")
+ name="pwh2004"
+ ;;
+ *"Asus RP-N53")
+ name="rp-n53"
+ ;;
+ *"RT-G32 B1")
+ name="rt-g32-b1"
+ ;;
+ *"RT-N10+")
+ name="rt-n10-plus"
+ ;;
+ *"RT-N15")
+ name="rt-n15"
+ ;;
+ *"RT-N56U")
+ name="rt-n56u"
+ ;;
+ *"RUT5XX")
+ name="rut5xx"
+ ;;
+ *"Skyline SL-R7205"*)
+ name="sl-r7205"
+ ;;
+ *"Sparklan WCR-150GN")
+ name="wcr-150gn"
+ ;;
+ *"V22RW-2X2")
+ name="v22rw-2x2"
+ ;;
+ *"VoCore")
+ name="vocore"
+ ;;
+ *"W502U")
+ name="w502u"
+ ;;
+ *"WMR-300")
+ name="wmr300"
+ ;;
+ *"WHR-300HP2")
+ name="whr-300hp2"
+ ;;
+ *"WHR-600D")
+ name="whr-600d"
+ ;;
+ *"WHR-1166D")
+ name="whr-1166d"
+ ;;
+ *"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"
+ ;;
+ *"Tenda W150M")
+ name="w150m"
+ ;;
+ *"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"
+ ;;
+ *"HG255D")
+ name="hg255d"
+ ;;
+ *"V22SG")
+ name="v22sg"
+ ;;
+ *"WRTNODE")
+ name="wrtnode"
+ ;;
+ *"Wansview NCS601W")
+ name="ncs601w"
+ ;;
+ *"Sercomm NA930")
+ name="na930"
+ ;;
+ *"Zbtlink ZBT-WA05")
+ name="zbt-wa05"
+ ;;
+ *"ZBT WR8305RT")
+ name="wr8305rt"
+ ;;
+ *"Lenovo Y1")
+ name="y1"
+ ;;
+ *"Lenovo Y1S")
+ name="y1s"
+ ;;
+ *)
+ name="generic"
+ ;;
+ esac
+
+ if [ "$name" == "generic" ]; then
+ machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo)
+ case "$machine" in
+ *"Ralink SoC")
+ name="ralink-soc"
+ ;;
+ *"MT7620")
+ name="ralink-soc"
+ ;;
+ *"MT7620a")
+ name="ralink-soc"
+ ;;
+ *"MT7621")
+ name="ralink-soc"
+ ;;
+ *"MT7628")
+ name="ralink-soc"
+ ;;
+ *"MT7688")
+ name="ralink-soc"
+ ;;
+ *"MT7615")
+ name="ralink-soc"
+ ;;
+ *"MT7623")
+ name="ralink-soc"
+ ;;
+ esac
+
+ machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /Hardware/ {print $2}' /proc/cpuinfo)
+ case $machine in
+ *"MT7623")
+ name="ralink-soc"
+ ;;
+ esac
+ fi
+
+ [ -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/mediatek/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/base-files/lib/upgrade/platform.sh
new file mode 100755
index 0000000..58d6c82
--- /dev/null
+++ b/target/linux/mediatek/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,151 @@
+#
+# 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")"
+
+ [ "$#" -gt 1 ] && return 1
+
+ case "$board" in
+ ralink-soc | \
+ 3g-6200n | \
+ 3g-6200nl | \
+ 3g300m | \
+ w150m | \
+ air3gii | \
+ all0239-3g | \
+ all0256n | \
+ all5002 | \
+ all5003 | \
+ ar725w | \
+ asl26555 | \
+ awm002-evb | \
+ awm003-evb | \
+ awapn2403 | \
+ bc2 | \
+ broadway | \
+ carambola | \
+ d105 | \
+ dcs-930 | \
+ dir-300-b1 | \
+ dir-300-b7 | \
+ dir-320-b1 | \
+ dir-600-b1 | \
+ dir-600-b2 | \
+ dir-615-h1 | \
+ dir-615-d | \
+ dir-620-a1 | \
+ dir-620-d1 | \
+ dir-810l | \
+ dap-1350 | \
+ esr-9753 | \
+ f7c027 | \
+ fonera20n | \
+ rt-n13u | \
+ freestation5 | \
+ hw550-3g | \
+ hg255d | \
+ hlk-rm04 | \
+ ip2202 | \
+ m3 | \
+ m4 | \
+ mlw221 | \
+ mlwg2 | \
+ mofi3500-3gn | \
+ mpr-a1 | \
+ mpr-a2 | \
+ mzk-w300nh2 | \
+ nbg-419n | \
+ nw718 | \
+ omni-emb | \
+ omni-emb-hpm | \
+ omni-plug | \
+ psr-680w | \
+ px4885 | \
+ rp-n53 | \
+ rt-g32-b1 | \
+ rt-n10-plus | \
+ rt-n14u | \
+ rt-n15 | \
+ rt-n56u | \
+ rut5xx | \
+ sl-r7205 | \
+ tew-691gr | \
+ tew-692gr | \
+ w306r-v20 |\
+ w502u |\
+ wr6202 |\
+ v22rw-2x2 | \
+ vocore | \
+ wl341v3 | \
+ wl-330n | \
+ wl-330n3g | \
+ wl-351 | \
+ wnce2001 | \
+ wli-tx4-ag300n | \
+ whr-g300n |\
+ ur-326n4g |\
+ ur-336un |\
+ wr512-3gn |\
+ wmr300 |\
+ wr8305rt |\
+ wrtnode |\
+ x5 |\
+ x8 |\
+ zbt-wa05 |\
+ y1 |\
+ y1s)
+ [ "$magic" != "27051956" ] && {
+ echo "Invalid image type."
+ return 1
+ }
+ return 0
+ ;;
+ cy-swr1100 |\
+ dir-610-a1 |\
+ dir-645)
+ [ "$magic" != "5ea3a417" ] && {
+ echo "Invalid image type."
+ return 1
+ }
+ return 0
+ ;;
+ br-6475nd)
+ [ "$magic" != "43535953" ] && {
+ 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/mediatek/base-files/usr/sbin/interface_config.sh b/target/linux/mediatek/base-files/usr/sbin/interface_config.sh
new file mode 100755
index 0000000..9b28b4b
--- /dev/null
+++ b/target/linux/mediatek/base-files/usr/sbin/interface_config.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+ echo "interface config"
+ brctl addbr br-lan
+ modprobe /lib/modules/3.10.20/mt7615e.ko
+ ifconfig ra0 up
+ ifconfig rai0 up
+ ifconfig eth0 up
+ ifconfig eth1 up
+ switch-llllw.sh
+ brctl addif br-lan eth0
+ brctl addif br-lan rai0
+ brctl addif br-lan ra0
+ ifconfig br-lan up
+ ifconfig br-lan 192.168.1.1
+ ifconfig eth1 192.168.3.1
+
+ nat_router_config.sh
+ rps_config.sh
+ udhcpd -f /etc/udhcpd.config &
diff --git a/target/linux/mediatek/base-files/usr/sbin/nat_router_config.sh b/target/linux/mediatek/base-files/usr/sbin/nat_router_config.sh
new file mode 100755
index 0000000..6ca0776
--- /dev/null
+++ b/target/linux/mediatek/base-files/usr/sbin/nat_router_config.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+ echo "nat modules load"
+ modprobe /lib/modules/3.10.20/ip_tables.ko
+ modprobe /lib/modules/3.10.20/ipt_MASQUERADE.ko
+ modprobe /lib/modules/3.10.20/ipt_REJECT.ko
+ modprobe /lib/modules/3.10.20/iptable_nat.ko
+ modprobe /lib/modules/3.10.20/nf_conntrack_ipv4.ko
+ modprobe /lib/modules/3.10.20/iptable_nat.ko
+ iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth1 -j MASQUERADE
+ echo 1 > /proc/sys/net/ipv4/ip_forward \ No newline at end of file
diff --git a/target/linux/mediatek/base-files/usr/sbin/rps_config.sh b/target/linux/mediatek/base-files/usr/sbin/rps_config.sh
new file mode 100755
index 0000000..f48d4de
--- /dev/null
+++ b/target/linux/mediatek/base-files/usr/sbin/rps_config.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+ echo "irq/rps config"
+ echo 1 > /proc/irq/231/smp_affinity
+ echo 2 > /proc/irq/230/smp_affinity
+ echo 4 > /proc/irq/225/smp_affinity
+ echo 8 > /proc/irq/226/smp_affinity
+
+ echo 3 > /sys/class/net/ra0/queues/rx-0/rps_cpus
+ echo 3 > /sys/class/net/rai0/queues/rx-0/rps_cpus
+ echo 5 > /sys/class/net/eth0/queues/rx-0/rps_cpus
+ echo 5 > /sys/class/net/eth1/queues/rx-0/rps_cpus \ No newline at end of file
diff --git a/target/linux/mediatek/base-files/usr/sbin/setsmp.sh b/target/linux/mediatek/base-files/usr/sbin/setsmp.sh
new file mode 100755
index 0000000..71a7699
--- /dev/null
+++ b/target/linux/mediatek/base-files/usr/sbin/setsmp.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ -e /tmp/smb.flag ];
+then
+ smp.sh storage
+else
+ smp.sh wifi
+fi
+
diff --git a/target/linux/mediatek/base-files/usr/sbin/switch-llllw.sh b/target/linux/mediatek/base-files/usr/sbin/switch-llllw.sh
new file mode 100755
index 0000000..d09812d
--- /dev/null
+++ b/target/linux/mediatek/base-files/usr/sbin/switch-llllw.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+ echo "restore GSW to dump switch mode"
+ #port matrix mode
+ switch reg w 2004 ff0000 #port0
+ switch reg w 2104 ff0000 #port1
+ switch reg w 2204 ff0000 #port2
+ switch reg w 2304 ff0000 #port3
+ switch reg w 2404 ff0000 #port4
+ switch reg w 2504 ff0000 #port5
+ switch reg w 2604 ff0000 #port6
+ switch reg w 2704 ff0000 #port7
+
+ #LAN/WAN ports as transparent mode
+ switch reg w 2010 810000c0 #port0
+ switch reg w 2110 810000c0 #port1
+ switch reg w 2210 810000c0 #port2
+ switch reg w 2310 810000c0 #port3
+ switch reg w 2410 810000c0 #port4
+ switch reg w 2510 810000c0 #port5
+ switch reg w 2610 810000c0 #port6
+ switch reg w 2710 810000c0 #port7
+
+ #clear mac table if vlan configuration changed
+ switch clear
+ switch vlan clear
+
+
+ #VLAN member port
+ switch vlan set 1 1 11110011
+ switch vlan set 2 2 00001100
+ #set PVID
+ switch pvid 4 2
+ switch pvid 5 2
+ #LAN/WAN ports as security mode
+ switch reg w 2004 ff0003 #port0
+ switch reg w 2104 ff0003 #port1
+ switch reg w 2204 ff0003 #port2
+ switch reg w 2304 ff0003 #port3
+ switch reg w 2404 ff0003 #port4
+ switch reg w 2504 ff0003 #port5
+ switch reg w 2604 ff0003 #port6 \ No newline at end of file