lantiq: move common DSL setup into lantiq.sh

DSL setup consists of the same commands for all subtargets, so move it
into a helper function.

While at it, remove shebang from library file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
master
Adrian Schmutzler 2020-01-14 21:45:43 +01:00
parent 355f0444f3
commit 18e089aaed
6 changed files with 20 additions and 52 deletions

View File

@ -32,16 +32,7 @@ netgear,dgn1000b)
;; ;;
esac esac
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ lantiq_setup_dsl_helper "$annex"
ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"

View File

@ -1,5 +1,18 @@
#!/bin/sh
lantiq_is_vdsl_system() { lantiq_is_vdsl_system() {
grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo
} }
lantiq_setup_dsl_helper() {
local annex="$1"
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \
ucidef_add_atm_bridge "1" "32" "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
}

View File

@ -16,16 +16,7 @@ wan_mac=""
ucidef_set_interface_lan 'eth0' ucidef_set_interface_lan 'eth0'
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ lantiq_setup_dsl_helper "$annex"
ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"

View File

@ -123,16 +123,7 @@ zyxel,p-2812hnu-f3)
;; ;;
esac esac
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ lantiq_setup_dsl_helper "$annex"
ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"

View File

@ -102,16 +102,7 @@ zyxel,p-2601hn)
;; ;;
esac esac
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ lantiq_setup_dsl_helper "$annex"
ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"

View File

@ -32,16 +32,7 @@ arcadyan,arv452cqw)
;; ;;
esac esac
ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ lantiq_setup_dsl_helper "$annex"
ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl"
if lantiq_is_vdsl_system; then
ucidef_add_vdsl_modem "$annex" "av"
else
ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin"
fi
ucidef_set_interface_wan "dsl0" "pppoe"
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"