From ec7fe85ab6e2278bfbecfeb426ad5e169d95873d Mon Sep 17 00:00:00 2001 From: Christian Dresel Date: Thu, 31 Dec 2015 15:49:55 +0100 Subject: [PATCH] Added support for TL-WA860RE Signed-off-by: Christian Dresel Reviewed-by: Steffen Pankratz --- .../etc/network.tl-wa860re-v1 | 32 +++++++++++++++++++ bsp/board_ar71xx.bsp | 2 ++ bsp/default/root_file_system/etc/network.sh | 14 +++++++- bsp/default/root_file_system/etc/rc.local.tpl | 3 ++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 bsp/ar71xx/root_file_system/etc/network.tl-wa860re-v1 diff --git a/bsp/ar71xx/root_file_system/etc/network.tl-wa860re-v1 b/bsp/ar71xx/root_file_system/etc/network.tl-wa860re-v1 new file mode 100644 index 00000000..d4a5611e --- /dev/null +++ b/bsp/ar71xx/root_file_system/etc/network.tl-wa860re-v1 @@ -0,0 +1,32 @@ +WANDEV=eth0 +SWITCHDEV=eth0 +CLIENT_PORTS="" +WAN_PORTS="" +BATMAN_PORTS="" + +. /etc/network.mode + +CLIENTIF="w2ap" +ETHMESHMAC= +ROUTERMAC=w2mesh + +uci set network.$SWITCHDEV=interface +uci set network.$SWITCHDEV.ifname=$SWITCHDEV +uci set network.mesh.ifname="bat0" + +if [ "$ETHMODE" = "WAN" ] ; then + ## Activate for WAN: + echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf + echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf + echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf + echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf + uci set network.wan.ifname=$WANDEV +elif [ "$ETHMODE" = "CLIENT" ] ; then + ## Activate Client: + CLIENTIF="w2ap eth0" + uci set network.mesh.ifname="bat0 $SWITCHDEV" +else + ## Activate BATMAN: + uci set network.ethmesh.ifname="$SWITCHDEV" + ETH0MAC=1 +fi diff --git a/bsp/board_ar71xx.bsp b/bsp/board_ar71xx.bsp index d6055b23..6e01f03f 100644 --- a/bsp/board_ar71xx.bsp +++ b/bsp/board_ar71xx.bsp @@ -26,6 +26,8 @@ board_postbuild() { cp $target/bin/ar71xx/openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-*.bin ./bin/ cp $target/bin/ar71xx/openwrt-ar71xx-generic-tl-wr1043nd-v2-squashfs-*.bin ./bin/ + + cp $target/bin/ar71xx/openwrt-ar71xx-generic-tl-wa860re-v1-squashfs-*.bin ./bin/ } board_clean() { diff --git a/bsp/default/root_file_system/etc/network.sh b/bsp/default/root_file_system/etc/network.sh index 63d3815c..6c640835 100644 --- a/bsp/default/root_file_system/etc/network.sh +++ b/bsp/default/root_file_system/etc/network.sh @@ -100,4 +100,16 @@ if [[ -n "$ROUTERMAC" ]]; then ifconfig br-mesh up /etc/init.d/network restart fi -fi \ No newline at end of file +fi + +if [[ -n "$ETH0MAC" ]]; then + echo "Fixing MAC on eth0" + sleep 10 + NEW_MACADDR=$(cat /sys/class/net/w2ap/address) + uci set network.eth0.macaddr=$NEW_MACADDR + uci commit + ifconfig eth0 down + ifconfig eth0 hw ether $NEW_MACADDR + ifconfig eth0 up + /etc/init.d/network restart +fi diff --git a/bsp/default/root_file_system/etc/rc.local.tpl b/bsp/default/root_file_system/etc/rc.local.tpl index b115fc17..6f838861 100755 --- a/bsp/default/root_file_system/etc/rc.local.tpl +++ b/bsp/default/root_file_system/etc/rc.local.tpl @@ -23,6 +23,9 @@ case "$BOARD" in nanostation-m) BOARD=ubnt-nano-m ;; + tl-wa860re) + BOARD=tl-wa860re-v1 + ;; esac if ! uci get board.model.name; then