summaryrefslogtreecommitdiff
path: root/target/linux/mediatek/base-files/usr/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mediatek/base-files/usr/sbin')
-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
5 files changed, 94 insertions, 0 deletions
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