aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2020-11-28 11:44:44 +0100
committerJohn Crispin <john@phrozen.org>2020-12-02 07:53:21 +0100
commit9aa449050297b58a41843bceaff6179458b64003 (patch)
treeef36913f9c77e609b036931bd24874510b1a291b
parent9290539ca9c7b296891b1b386052c0fe308e9a62 (diff)
downloadupstream-9aa449050297b58a41843bceaff6179458b64003.tar.gz
upstream-9aa449050297b58a41843bceaff6179458b64003.tar.bz2
upstream-9aa449050297b58a41843bceaff6179458b64003.zip
realtek: clean up board.json generation
In this new setup the switch is treated as wan, lan1.100 is used as our mgmt vlan. The board mac is applied to eth0, switch and switch.1 The board mac is assigned with the LA bit set to all lan ports while incrementing it. Signed-off-by: John Crispin <john@phrozen.org>
-rwxr-xr-xtarget/linux/realtek/base-files/etc/board.d/02_network78
1 files changed, 47 insertions, 31 deletions
diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index dc1465661b..84980c8982 100755
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -4,40 +4,56 @@
. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh
-rtl838x_setup_switch()
-{
- local lan lan_list
-
- for lan in /sys/class/net/lan*; do
- lan_list="$lan_list $(basename $lan)"
- done
- ucidef_set_bridge_device switch
- ucidef_set_interface_lan "$lan_list"
+ucidef_set_poe() {
+ json_select_object poe
+ json_add_string "budget" "$1"
+ json_select_array ports
+ for port in $2; do
+ json_add_string "" "$port"
+ done
+ json_select ..
+ json_select ..
}
-rtl838x_setup_macs()
-{
- local board="$1"
- local lan_mac
- local wan_mac
- local label_mac
-
- case $board in
- allnet,all-sg8208m|\
- netgear,gs110tpp-v1)
- lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
- label_mac=$lan_mac
- esac
-
- [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
- [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
- [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
-}
-
-board_config_update
board=$(board_name)
-rtl838x_setup_switch
-rtl838x_setup_macs $board
+board_config_update
+
+lan_list=""
+for lan in /sys/class/net/lan*; do
+ lan_list="$lan_list $(basename $lan)"
+done
+ucidef_set_bridge_device switch
+ucidef_set_interface_wan "$lan_list"
+ucidef_set_interface "lan" ifname "lan1:t" protocol "static" vlan 100
+
+lan_mac=""
+wan_mac=""
+label_mac=""
+case $board in
+*)
+ wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
+ label_mac=$lan_mac
+ ;;
+esac
+
+lan_mac=$(macaddr_setbit_la $wan_mac)
+
+ucidef_set_interface_macaddr "lan" $lan_mac
+ucidef_set_interface_macaddr "wan" $wan_mac
+ucidef_set_bridge_mac "$wan_mac"
+ucidef_set_network_device_mac eth0 $wan_mac
+for lan in $lan_list; do
+ ucidef_set_network_device_mac $lan $lan_mac
+ lan_mac=$(macaddr_add $lan_mac 1)
+done
+[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+
+case $board in
+netgear,gs110tpp-v1)
+ ucidef_set_poe 130 "$lan_list"
+ ;;
+esac
+
board_config_flush
exit 0