1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Kernel 5.4 RUTX support

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-08-14 17:47:02 +02:00
parent 839fcf1cab
commit cfce9f52b2
7376 changed files with 3902 additions and 546 deletions

View file

@ -1249,6 +1249,7 @@ CONFIG_DEBUG_KERNEL=y
# CONFIG_DECNET is not set # CONFIG_DECNET is not set
CONFIG_DEFAULT_CUBIC=y CONFIG_DEFAULT_CUBIC=y
CONFIG_DEFAULT_DEADLINE=y CONFIG_DEFAULT_DEADLINE=y
# CONFIG_DEFAULT_ECF is not set
CONFIG_DEFAULT_HOSTNAME="(none)" CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120 CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
CONFIG_DEFAULT_IOSCHED="deadline" CONFIG_DEFAULT_IOSCHED="deadline"
@ -3174,6 +3175,7 @@ CONFIG_MODULE_UNLOAD=y
# CONFIG_MPL115_SPI is not set # CONFIG_MPL115_SPI is not set
# CONFIG_MPL3115 is not set # CONFIG_MPL3115 is not set
# CONFIG_MPLS is not set # CONFIG_MPLS is not set
# CONFIG_MPTCP_DEBUG_LOCK is not set
# CONFIG_MPU3050_I2C is not set # CONFIG_MPU3050_I2C is not set
# CONFIG_MQ_IOSCHED_DEADLINE is not set # CONFIG_MQ_IOSCHED_DEADLINE is not set
# CONFIG_MQ_IOSCHED_KYBER is not set # CONFIG_MQ_IOSCHED_KYBER is not set
@ -3876,6 +3878,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13
# CONFIG_NVMEM_IMX_OCOTP is not set # CONFIG_NVMEM_IMX_OCOTP is not set
# CONFIG_NVMEM_REBOOT_MODE is not set # CONFIG_NVMEM_REBOOT_MODE is not set
# CONFIG_NVMEM_SYSFS is not set # CONFIG_NVMEM_SYSFS is not set
# CONFIG_NVMEM_U_BOOT_ENV is not set
# CONFIG_NVME_FC is not set # CONFIG_NVME_FC is not set
# CONFIG_NVME_TARGET is not set # CONFIG_NVME_TARGET is not set
# CONFIG_NVME_TCP is not set # CONFIG_NVME_TCP is not set

View file

@ -20,6 +20,18 @@ strstr() {
print_array() { print_array() {
json_add_array $1 json_add_array $1
case "$1" in case "$1" in
5G_NSA)
for element in $2
do
json_add_string "" "$(echo $element)"
done
;;
5G_SA)
for element in $2
do
json_add_string "" "$(echo $element)"
done
;;
4G) 4G)
for element in $2 for element in $2
do do
@ -210,6 +222,28 @@ gather_band_capabilities() {
lte_bands="" lte_bands=""
trysg_bands="850 1900" trysg_bands="850 1900"
dug_bands="" dug_bands=""
###################### EC200A #########################
elif strstr $revision_from_unhandler "EC200AAU"; then #EC200AAU
lte_bands="1 2 3 4 5 7 8 28 40 66"
trysg_bands="850 900 1700 1900 2100"
dug_bands="850 900 1800 1900"
elif strstr $revision_from_unhandler "EC200AEU"; then #EC200AEU
lte_bands="1 3 5 7 8 20 28 38 40 41"
trysg_bands="850 900 2100"
dug_bands="900 1800"
####################### RG501QEU #######################
elif strstr $revision_from_unhandler "RG501QEU"; then #5G module
nsa_nr5g_bands="1 3 5 7 8 20 28 38 40 41 77 78"
sa_nr5g_bands="1 3 5 7 8 20 28 38 40 41 77 78"
lte_bands="1 3 5 7 8 20 28 32 38 40 41 42 43"
trysg_bands="2100 850 900"
dug_bands=""
elif strstr $revision_from_unhandler "RG520NEU"; then #5G module
nsa_nr5g_bands="1 3 5 7 8 20 28 38 40 41 75 76 77 78"
sa_nr5g_bands="1 3 5 7 8 20 28 38 40 41 75 76 77 78"
lte_bands="1 3 5 7 8 20 28 32 38 40 41 42 43"
trysg_bands="2100 850 900"
dug_bands=""
else else
lte_bands="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28" lte_bands="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28"
trysg_bands="700 800 850 900 1500 1700 2600" trysg_bands="700 800 850 900 1500 1700 2600"
@ -249,6 +283,8 @@ setup_modem() {
validate_service_modes && { validate_service_modes && {
gather_band_capabilities gather_band_capabilities
json_select_object service_modes json_select_object service_modes
[ -z "$nsa_nr5g_bands" ] || print_array "5G_NSA" "$nsa_nr5g_bands"
[ -z "$sa_nr5g_bands" ] || print_array "5G_SA" "$sa_nr5g_bands"
[ -z "$lte_bands" ] || print_array "4G" "$lte_bands" [ -z "$lte_bands" ] || print_array "4G" "$lte_bands"
[ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands" [ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands"
[ -z "$dug_bands" ] || print_array "2G" "$dug_bands" [ -z "$dug_bands" ] || print_array "2G" "$dug_bands"
@ -280,7 +316,10 @@ setup_modem() {
json_add_string type "$type" json_add_string type "$type"
json_add_string desc "$desc" json_add_string desc "$desc"
json_add_string control "$control" json_add_string control "$control"
json_add_string revision "${revision_from_unhandler::-2}"
json_add_object service_modes json_add_object service_modes
[ -z "$nsa_nr5g_bands" ] || print_array "5G_NSA" "$nsa_nr5g_bands"
[ -z "$sa_nr5g_bands" ] || print_array "5G_SA" "$sa_nr5g_bands"
[ -z "$lte_bands" ] || print_array "4G" "$lte_bands" [ -z "$lte_bands" ] || print_array "4G" "$lte_bands"
[ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands" [ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands"
[ -z "$dug_bands" ] || print_array "2G" "$dug_bands" [ -z "$dug_bands" ] || print_array "2G" "$dug_bands"

View file

@ -10,24 +10,33 @@ CFG=/etc/board.json
[ -s /etc/config/system ] && \ [ -s /etc/config/system ] && \
[ -s /etc/config/hwinfo ] && \ [ -s /etc/config/hwinfo ] && \
[ -s /etc/config/blesem ] && \ [ -s /etc/config/blesem ] && \
[ -s /etc/config/poe ] && \
exit 0 exit 0
generate_bridge() {
local name=$1
local macaddr=$2
uci -q batch <<-EOF
set network.$name=device
set network.$name.name=$name
set network.$name.type=bridge
EOF
if [ -n "$macaddr" ]; then
uci -q batch <<-EOF
set network.$name.macaddr=$macaddr
EOF
fi
}
generate_static_network() { generate_static_network() {
uci -q batch <<-EOF uci -q batch <<-EOF
delete network.loopback delete network.loopback
set network.loopback='interface' set network.loopback='interface'
set network.loopback.ifname='lo' set network.loopback.device='lo'
set network.loopback.proto='static' set network.loopback.proto='static'
set network.loopback.ipaddr='127.0.0.1' set network.loopback.ipaddr='127.0.0.1'
set network.loopback.netmask='255.0.0.0' set network.loopback.netmask='255.0.0.0'
EOF EOF
[ -e /proc/sys/net/ipv6 ] && {
uci -q batch <<-EOF
delete network.globals
set network.globals='globals'
set network.globals.ula_prefix='auto'
EOF
}
if json_is_a dsl object; then if json_is_a dsl object; then
json_select dsl json_select dsl
@ -65,9 +74,30 @@ generate_static_network() {
fi fi
} }
ip6assign=
disable_vlan=
apply_network_options() {
json_select network_options && {
json_get_vars ip6assign ula disable_vlan
json_select ..
}
[ -z "$ip6assign" ] && ip6assign=1
[ -z "$ula" ] && ula=1
[ -e /proc/sys/net/ipv6 ] && [ "$ula" = 1 ] && {
uci -q batch <<-EOF
delete network.globals
set network.globals='globals'
set network.globals.ula_prefix='auto'
EOF
}
}
metric=1
addr_offset=2 addr_offset=2
generate_network() { generate_network() {
local keys var val ifname macaddr proto type ipaddr netmask local ports device macaddr proto type ipaddr netmask vlan no_metric
local bridge=$2
uci -q batch <<-EOF uci -q batch <<-EOF
delete "network.$1" delete "network.$1"
@ -76,46 +106,88 @@ generate_network() {
json_select network json_select network
json_select "$1" json_select "$1"
json_get_keys keys json_get_vars device macaddr proto ipaddr netmask vlan ipv6 guest type
for var in $keys; do json_get_values ports ports
json_get_var val "$var"
[ "${var#_*}" = "$var" ] && {
eval "$var=\"\$val\""
uci -q set "network.$1.$var=$val"
}
done
json_select .. json_select ..
json_select .. json_select ..
#~ [ -n "$ifname" ] || return
# force bridge for multi-interface devices (and lan) json_select network_options && {
case "$1:$ifname" in json_get_vars no_metric
*\ * | lan:*) json_select ..
type="bridge" }
uci -q set "network.$1.type=$type"
;; # Force bridge for "lan" as it may have other devices (e.g. wireless)
esac # bridged
[ "$1" = "lan" ] && [ -z "$ports" ] && {
ports="$device"
}
[ -n "$ports" ] && [ -z "$bridge" ] && {
[ -n "$macaddr" ] && {
for port in $ports; do
uci -q batch <<-EOF
add network device
set network.@device[-1].name='$port'
set network.@device[-1].macaddr='$macaddr'
EOF
done
}
uci -q batch <<-EOF
add network device
rename network.@device[-1]='br_$1'
set network.@device[-1].name='br-$1'
set network.@device[-1].type='bridge'
EOF
[ -n "$device" ] && uci add_list network.@device[-1].ports="$device" || {
for port in $ports; do
uci add_list network.@device[-1].ports="$port"
done
}
device=br-$1
type=
macaddr=""
json_select hwinfo
json_get_vars dsa
json_select ..
}
if [ -n "$macaddr" ]; then if [ -n "$macaddr" ]; then
for name in $ifname; do uci -q batch <<-EOF
uci -q batch <<-EOF add network device
delete network.$1_${name/./_}_dev set network.@device[-1].name='$device'
set network.$1_${name/./_}_dev='device' set network.@device[-1].macaddr='$macaddr'
set network.$1_${name/./_}_dev.name='$name' EOF
set network.$1_${name/./_}_dev.macaddr='$macaddr'
EOF
done
fi fi
uci -q batch <<-EOF
delete network.$1
set network.$1='interface'
set network.$1.type='$type'
set network.$1.device='$device'
set network.$1.proto='none'
EOF
[ "$1" != "lan" ] && metric=$((metric+1))
[ "$guest" = "1" ] && uci set network.$1.guest='1'
case "$proto" in case "$proto" in
static) static)
local ipad local ipad metr
case "$1" in case "$1" in
lan) lan)
ipad=${ipaddr:-"192.168.100.1"} ipad="192.168.100.1"
metr=1
;;
*)
ipad=${ipaddr:-"192.168.$((addr_offset++)).1"}
metr="$metric"
;; ;;
*) ipad=${ipaddr:-"192.168.$((addr_offset++)).1"} ;;
esac esac
netm=${netmask:-"255.255.255.0"} netm=${netmask:-"255.255.255.0"}
@ -124,26 +196,33 @@ generate_network() {
set network.$1.proto='static' set network.$1.proto='static'
set network.$1.ipaddr='$ipad' set network.$1.ipaddr='$ipad'
set network.$1.netmask='$netm' set network.$1.netmask='$netm'
set network.$1.metric='$metr'
EOF EOF
[ -e /proc/sys/net/ipv6 ] && uci set network.$1.ip6assign='60'
[ "$ipv6" = "1" ] && uci set network.$1.ipv6="$ipv6"
[ -e /proc/sys/net/ipv6 ] && [ "$ip6assign" = 1 ] && \
uci set network.$1.ip6assign='60'
;; ;;
dhcp) dhcp)
# fixup IPv6 slave interface if parent is a bridge # fixup IPv6 slave interface if parent is a bridge
[ "$type" = "bridge" ] && ifname="br-$1" [ "$type" = "bridge" ] && device="br-$1"
uci set network.$1.proto='dhcp' uci -q batch <<-EOF
uci set network.$1.metric='1' set network.$1.proto='dhcp'
set network.$1.metric='$metric'
#[ -e /proc/sys/net/ipv6 ] && { EOF
# uci -q batch <<-EOF [ -e /proc/sys/net/ipv6 ] && {
# delete network.${1}6 metric=$((metric+1))
# set network.${1}6='interface' uci -q batch <<-EOF
# set network.${1}6.device='$ifname' delete network.${1}6
# set network.${1}6.proto='dhcpv6' set network.${1}6='interface'
# set network.${1}6.metric='1' set network.${1}6.device='$device'
# EOF set network.${1}6.proto='dhcpv6'
#} set network.${1}6.metric='$metric'
EOF
[ "$ip6assign" != 1 ] && uci set network.${1}6.delegate='0'
}
;; ;;
pppoe) pppoe)
@ -157,12 +236,17 @@ generate_network() {
set network.$1.ipv6='1' set network.$1.ipv6='1'
delete network.${1}6 delete network.${1}6
set network.${1}6='interface' set network.${1}6='interface'
set network.${1}6.ifname='@${1}' set network.${1}6.device='@${1}'
set network.${1}6.proto='dhcpv6' set network.${1}6.proto='dhcpv6'
EOF EOF
} }
;; ;;
esac esac
[ -n "$no_metric" ] && {
uci -q delete network.${1}.metric
[ -e /proc/sys/net/ipv6 ] && uci -q delete network.${1}6.metric
}
} }
add_modem_section() { add_modem_section() {
@ -170,35 +254,40 @@ add_modem_section() {
local num="$2" local num="$2"
local simcount="$3" local simcount="$3"
local builtin="$4" local builtin="$4"
local custom_proto custom_ifname
json_select ..
json_get_vars custom_proto custom_ifname
json_select modems
for count in $(seq "$simcount"); do for count in $(seq "$simcount"); do
interface="mob${num}s${count}a1" interface="mob${num}s${count}a1"
local proto="wwan" local proto="wwan"
# just like this for now # if needed, use custom proto for rmnet/other devices
# probably we should merge connm with wwan [ -n "${custom_proto}" ] && proto="${custom_proto}"
[ -e /dev/smd9 ] && {
proto="connm"
}
uci -q batch <<-EOF metric=$((metric+1))
delete network.$interface
set network.$interface='interface'
set network.$interface.proto='$proto'
set network.$interface.modem='$id'
set network.$interface.metric='$((num+1))'
set network.$interface.sim='${count}'
set network.$interface.pdp='1'
EOF
# just like this for now uci_remove network "${interface}"
# probably we should merge connm with wwan uci_add network interface "${interface}"
[ -e /dev/smd9 ] && { uci_set network "${interface}" proto "$proto"
uci set network.$interface.ifname='rmnet0' uci_set network "${interface}" modem "$id"
} uci_set network "${interface}" metric "$metric"
uci_set network "${interface}" sim "${count}"
uci_set network "${interface}" dhcpv6 "0"
uci_set network "${interface}" pdptype "ip"
uci_set network "${interface}" method "nat"
uci_set network "${interface}" auth "none"
uci_set network "${interface}" auto_apn "1"
# if needed, use custom ifname for rmnet/other devices
[ -n "${custom_ifname}" ] && \
uci_set network "${interface}" device "${custom_ifname}"
uci_commit network
update_firewall_zone "wan" "$interface" update_firewall_zone "wan" "$interface"
create_multiwan_iface "$interface" "$num" create_multiwan_iface "$interface" "$metric"
add_simcard_config "$id" "${count}" "${count}" "$builtin" add_simcard_config "$id" "${count}" "${count}" "$builtin"
add_sim_switch_config "$id" "${count}" add_sim_switch_config "$id" "${count}"
add_quota_limit_config "$interface" add_quota_limit_config "$interface"
@ -243,6 +332,7 @@ generate_dynamic_lte() {
product=$(cat "/sys/bus/usb/devices/$a/idProduct") product=$(cat "/sys/bus/usb/devices/$a/idProduct")
[ -f "/lib/network/wwan/${vendor}:${product}" ] && { [ -f "/lib/network/wwan/${vendor}:${product}" ] && {
add_simcard_config "$a" "1" "0" "" add_simcard_config "$a" "1" "0" ""
add_sms_storage_config "$a"
} }
done done
} }
@ -268,6 +358,7 @@ generate_switch_vlans_ports() {
add network switch_vlan add network switch_vlan
set network.@switch_vlan[-1].device='$switch' set network.@switch_vlan[-1].device='$switch'
set network.@switch_vlan[-1].vlan='$role' set network.@switch_vlan[-1].vlan='$role'
set network.@switch_vlan[-1].vid='$role'
set network.@switch_vlan[-1].ports='$ports' set network.@switch_vlan[-1].ports='$ports'
EOF EOF
done done
@ -319,6 +410,7 @@ generate_switch() {
json_get_vars enable reset blinkrate cpu_port \ json_get_vars enable reset blinkrate cpu_port \
ar8xxx_mib_type ar8xxx_mib_poll_interval ar8xxx_mib_type ar8xxx_mib_poll_interval
[ "$disable_vlan" = 1 ] && enable=0
uci -q batch <<-EOF uci -q batch <<-EOF
add network switch add network switch
set network.@switch[-1].name='$key' set network.@switch[-1].name='$key'
@ -342,14 +434,16 @@ generate_static_system() {
uci -q batch <<-EOF uci -q batch <<-EOF
delete system.@system[0] delete system.@system[0]
set system.system='system' set system.system='system'
set system.@system[-1].hostname='OpenMPTCProuter' set system.@system[-1].hostname='$hostname'
set system.@system[-1].timezone='UTC' set system.@system[-1].timezone='UTC'
set system.@system[-1].ttylogin='0' set system.@system[-1].ttylogin='0'
set system.@system[-1].log_size='128' set system.@system[-1].log_buffer_size='128'
set system.@system[-1].log_size='200'
set system.@system[-1].urandom_seed='0' set system.@system[-1].urandom_seed='0'
delete system.ntp delete system.ntp
set system.ntp='timeserver' set system.ntp='timeserver'
set system.ntp.zoneName='UTC'
set system.ntp.enabled='0' set system.ntp.enabled='0'
set system.ntp.enable_server='0' set system.ntp.enable_server='0'
add_list system.ntp.server='0.pool.ntp.org' add_list system.ntp.server='0.pool.ntp.org'
@ -365,9 +459,9 @@ generate_static_system() {
if json_is_a system object; then if json_is_a system object; then
json_select system json_select system
local hostname local hostname
#if json_get_var hostname hostname; then if json_get_var hostname hostname; then
# uci -q set "system.@system[-1].hostname=$hostname" uci -q set "system.@system[-1].hostname=$hostname"
#fi fi
if json_is_a ntpserver array; then if json_is_a ntpserver array; then
local keys key local keys key
@ -542,6 +636,66 @@ generate_hwinfo() {
EOF EOF
} }
set_poe_ports() {
json_select "$1"
json_get_vars name class budget
uci -q batch <<-EOF
set poe.port$1='port$1'
set poe.port$1.name='$name'
set poe.port$1.poe_enable='1'
set poe.port$1.class='$class'
set poe.port$1.budget='$budget'
EOF
json_select ..
}
set_poe_chips(){
local keys key
uci -q set poe.chip$1=chip$1
json_get_keys keys "$1"
json_select "$1"
for key in $keys; do
json_get_var var "$key"
uci -q set poe.chip$1.$key="$var"
done
json_select ..
}
generate_poe_config(){
if json_is_a poe object; then
json_select poe
json_get_vars chip_count budget poe_ports
uci -q batch <<-EOF
set poe.poe='poe'
set poe.poe.chip_count='$chip_count'
set poe.poe.budget='$budget'
set poe.poe.poe_ports='$poe_ports'
EOF
if json_is_a ports array; then
#json_for_each_item "set_poe_ports" ports
json_select ports
idx=1
while json_is_a ${idx} object
do
"set_poe_ports" $idx
idx=$(( idx + 1 ))
done
json_select ..
fi
if json_is_a poe_chips array; then
json_select poe_chips
idx=1
while json_is_a ${idx} object
do
"set_poe_chips" $idx
idx=$(( idx + 1 ))
done
json_select ..
fi
json_select ..
fi
}
generate_bluetooth() { generate_bluetooth() {
uci -q batch <<-EOF uci -q batch <<-EOF
set blesem.general='section' set blesem.general='section'
@ -552,15 +706,15 @@ generate_bluetooth() {
} }
add_firewall_zone() { add_firewall_zone() {
local ifname local device
json_select network json_select network
json_select "$1" json_select "$1"
json_get_vars ifname json_get_vars device
json_select .. json_select ..
json_select .. json_select ..
fw3 -q network "$1" || fw3 -q device "$ifname" && return fw3 -q network "$1" || fw3 -q device "$device" && return
uci -q batch <<-EOF uci -q batch <<-EOF
add firewall zone add firewall zone
@ -599,7 +753,7 @@ add_dhcp() {
json_select .. json_select ..
json_select .. json_select ..
[ "$_dhcp" = "1" ] || return [ "$_dhcp" = "true" ] || return
uci -q batch <<-EOF uci -q batch <<-EOF
set dhcp.$1='dhcp' set dhcp.$1='dhcp'
set dhcp.$1.interface='$1' set dhcp.$1.interface='$1'
@ -617,11 +771,11 @@ umask 077
if [ ! -s /etc/config/network ]; then if [ ! -s /etc/config/network ]; then
touch /etc/config/network touch /etc/config/network
generate_static_network generate_static_network
apply_network_options
json_get_keys keys network json_get_keys keys network
for key in $keys; do for key in $keys; do
generate_network $key generate_network $key
add_firewall_zone "$key"
add_dhcp "$key" add_dhcp "$key"
done done
@ -651,6 +805,11 @@ if [ ! -s /etc/config/hwinfo ]; then
for key in $keys; do generate_hwinfo $key; done for key in $keys; do generate_hwinfo $key; done
fi fi
if [ ! -s /etc/config/poe ]; then
touch /etc/config/poe
generate_poe_config
fi
if [ ! -s /etc/config/blesem ]; then if [ ! -s /etc/config/blesem ]; then
bluetooth="" bluetooth=""
json_select hwinfo json_select hwinfo

View file

@ -8,6 +8,9 @@
. /lib/functions/teltonika-defaults.sh . /lib/functions/teltonika-defaults.sh
. /lib/functions/system.sh . /lib/functions/system.sh
[ -f /lib/functions/target-defaults.sh ] && \
. /lib/functions/target-defaults.sh
setup_json() { setup_json() {
local model="$1" local model="$1"
@ -16,96 +19,155 @@ setup_json() {
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan" "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_set_hwinfo usb ethernet ios ucidef_set_hwinfo usb ethernet ios
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX09*) RUTX09*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan" "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
ucidef_add_static_modem_info "$model" "3-1" "2" "gps_out" ucidef_add_static_modem_info "$model" "3-1" "2" "primary" "gps_out"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_set_hwinfo dual_sim usb gps mobile ethernet ios ucidef_set_hwinfo dual_sim usb gps mobile ethernet ios
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX10*) RUTX10*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan" "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_add_wlan_bssid_limit "wlan1" 16
ucidef_set_hwinfo bluetooth usb wifi dual_band_ssid ethernet ios ucidef_set_hwinfo bluetooth usb wifi dual_band_ssid ethernet ios
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX11*) RUTX11*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan" "0u@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "0u@eth1" "5:wan"
ucidef_add_static_modem_info "$model" "3-1" "2" "gps_out" ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_add_wlan_bssid_limit "wlan1" 16
ucidef_add_static_modem_info "$model" "3-1" "2" "primary" "gps_out"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_set_hwinfo dual_sim usb gps mobile wifi dual_band_ssid bluetooth ethernet ios ucidef_set_hwinfo dual_sim usb gps mobile wifi dual_band_ssid bluetooth ethernet ios
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTXR1*) RUTXR1*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
ucidef_add_static_modem_info "$model" "3-1" "2" ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_set_hwinfo dual_sim usb mobile wifi dual_band_ssid ethernet sfp_port ucidef_add_wlan_bssid_limit "wlan1" 16
ucidef_add_static_modem_info "$model" "3-1" "2" "primary"
ucidef_set_hwinfo dual_sim usb mobile wifi dual_band_ssid ethernet sfp_port sfp_switch console rs232
ucidef_set_usb_jack "/usb1/1-1/1-1.2/"
ucidef_add_serial_capabilities "rs232" \
"300 600 1200 2400 4800 9600 19200 38400 57600 115200" \
"7 8" \
"rts/cts xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/usb1/1-1/1-1.3/"
ucidef_set_release_version "2.3.1" ucidef_set_release_version "2.3.1"
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX12*) RUTX12*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_add_wlan_bssid_limit "wlan1" 16
# builtin and primary should be first modem # builtin and primary should be first modem
ucidef_add_static_modem_info "$model" "3-1" "1" "primary" "gps_out" ucidef_add_static_modem_info "$model" "3-1" "1" "primary" "gps_out"
ucidef_add_static_modem_info "$model" "1-1.2" "1" ucidef_add_static_modem_info "$model" "1-1.2" "1"
ucidef_set_hwinfo usb gps mobile wifi dual_band_ssid bluetooth ethernet ios ucidef_set_usb_jack "/usb1/1-1/1-1.3/"
ucidef_set_hwinfo usb gps mobile wifi dual_band_ssid bluetooth ethernet ios dual_modem
ucidef_set_release_version "2.3.1" ucidef_set_release_version "2.3.1"
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX14*) RUTX14*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
ucidef_add_static_modem_info "$model" "1-1" "2" "gps_out" ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_add_wlan_bssid_limit "wlan1" 16
ucidef_add_static_modem_info "$model" "1-1" "2" "primary" "gps_out"
ucidef_set_usb_jack "/usb3/3-1/"
ucidef_set_hwinfo usb gps dual_sim mobile wifi dual_band_ssid bluetooth ethernet ios at_sim ucidef_set_hwinfo usb gps dual_sim mobile wifi dual_band_ssid bluetooth ethernet ios at_sim
ucidef_set_release_version "2.6.1" ucidef_set_release_version "2.6.1"
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX18*) RUTX18*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
ucidef_add_static_modem_info "$model" "2-1" "2" "gps_out" ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_add_wlan_bssid_limit "wlan1" 16
ucidef_add_static_modem_info "$model" "2-1" "2" "primary" "gps_out"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_set_hwinfo usb gps dual_sim mobile wifi dual_band_ssid bluetooth ethernet ios ucidef_set_hwinfo usb gps dual_sim mobile wifi dual_band_ssid bluetooth ethernet ios
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
RUTX50*) RUTX50*)
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan" "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "0u@eth1" "5:wan"
ucidef_add_static_modem_info "$model" "2-1" "2" "gps_out" ucidef_add_wlan_bssid_limit "wlan0" 16
ucidef_add_wlan_bssid_limit "wlan1" 16
ucidef_add_static_modem_info "$model" "2-1" "2" "primary" "gps_out"
ucidef_set_usb_jack "/usb3/3-1/"
ucidef_set_hwinfo dual_sim usb gps mobile wifi dual_band_ssid ethernet ios at_sim ucidef_set_hwinfo dual_sim usb gps mobile wifi dual_band_ssid ethernet ios at_sim
ucidef_set_release_version "7.2.8"
ucidef_set_network_options "vlans" 128 "readonly_vlans" 2
;; ;;
TRB2*) TRB2*)
ucidef_set_led_switch "lan" "LAN" "eth_led" "switch0" "0x04" ucidef_set_led_switch "lan" "LAN" "eth_led" "switch0" "0x04"
ucidef_set_interface_lan "eth0" ucidef_set_interface_lan "eth0"
ucidef_add_static_modem_info "$model" "1-1.4" "2" "gps_out" ucidef_add_static_modem_info "$model" "1-1.4" "2" "primary" "gps_out"
ucidef_add_serial_capabilities "rs232 rs485" \ ucidef_add_serial_capabilities "rs232" \
"300 600 1200 2400 4800 9600 14400 19200 38400 56000 57600 115200 \ "300 600 1200 2400 4800 9600 19200 38400 57600 115200" \
"7 8" \
"rts/cts xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/usb1/1-1/1-1.3/"
ucidef_add_serial_capabilities "rs485" \
"300 600 1200 2400 4800 9600 19200 38400 57600 115200 \
230400 460800 921600 1000000 3000000" \ 230400 460800 921600 1000000 3000000" \
"7 8" "7 8" \
ucidef_set_hwinfo dual_sim mobile gps ethernet ios "none" \
"1 2" \
"even odd mark space none" \
"/usb1/1-1/1-1.2/"
ucidef_set_hwinfo dual_sim mobile gps ethernet ios rs232 rs485
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
;; ;;
RUT361* |\
RUT200* |\ RUT200* |\
RUT241*) RUT241* |\
RUT260*)
ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x2" ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x2"
ucidef_set_led_switch "wan" "WAN" "eth2_led" "switch0" "0x1" ucidef_set_led_switch "wan" "WAN" "eth2_led" "switch0" "0x1"
ucidef_add_switch "switch0" "1:lan" "0:wan" "6@eth0" ucidef_add_switch "switch0" "1:lan" "0:wan:2" "6@eth0"
ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary config 0x0)" ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_set_interface_macaddr "wan" "$(macaddr_add "$(mtd_get_mac_binary config 0x0)" 1)" ucidef_set_interface_default_macaddr "lan" "$(mtd_get_mac_binary config 0x0)"
ucidef_add_static_modem_info "$model" "1-1" "1" ucidef_set_interface_default_macaddr "wan" "$(macaddr_add "$(mtd_get_mac_binary config 0x0)" 1)"
[ "${model:7:1}" = "1" ] && ucidef_set_hwinfo mobile wifi \ ucidef_add_static_modem_info "$model" "1-1" "1" "primary"
[ "${model:6:1}" = "1" ] && ucidef_set_hwinfo mobile wifi \
ethernet || ucidef_set_hwinfo mobile wifi ethernet ios ethernet || ucidef_set_hwinfo mobile wifi ethernet ios
[ "${model:4:2}" = "60" ] && ucidef_set_release_version "7.4.2"
ucidef_set_network_options "vlans" 16 "readonly_vlans" 2
;; ;;
RUT2*) RUT2*)
ucidef_set_led_switch "lan" "LAN" "lan_led" "switch0" "0x04" ucidef_set_led_switch "lan" "LAN" "lan_led" "switch0" "0x04"
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1" ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_static_modem_info "$model" "1-1" "1" ucidef_add_wlan_bssid_limit "wlan0" 8
ucidef_add_static_modem_info "$model" "1-1" "1" "primary"
[ "${model:6:1}" = "1" ] && ucidef_set_hwinfo mobile wifi \ [ "${model:6:1}" = "1" ] && ucidef_set_hwinfo mobile wifi \
ethernet || ucidef_set_hwinfo mobile wifi ethernet ios ethernet || ucidef_set_hwinfo mobile wifi ethernet ios
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
;; ;;
RUT300*) RUT300*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x02" ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x02"
@ -114,16 +176,34 @@ setup_json() {
ucidef_set_led_switch "lan4" "LAN4" "eth4_led" "switch0" "0x04" ucidef_set_led_switch "lan4" "LAN4" "eth4_led" "switch0" "0x04"
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1" ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
ucidef_set_interface_wan "eth1" ucidef_set_interface_wan "eth1"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2" "0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
ucidef_set_hwinfo usb ethernet ios ucidef_set_hwinfo usb ethernet ios
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
;;
RUT301*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x01"
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x02"
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
ucidef_set_led_switch "lan4" "LAN4" "eth4_led" "switch0" "0x08"
ucidef_set_led_switch "wan" "WAN" "wan_led" "switch0" "0x10"
ucidef_add_switch "switch0" "0:lan:1" "1:lan:2" "2:lan:3" \
"3:lan:4" "4:wan" "6@eth0"
ucidef_set_usb_jack "/usb2/2-1/"
ucidef_set_interface_default_macaddr "wan" "$(macaddr_add "$(mtd_get_mac_binary config 0x0)" 1)"
ucidef_set_hwinfo usb ethernet ios
ucidef_set_network_options "vlans" 16 "readonly_vlans" 2
;; ;;
RUT360*) RUT360*)
ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x10" ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x10"
ucidef_set_led_netdev "wan" "WAN" "eth2_led" "eth1" ucidef_set_led_netdev "wan" "WAN" "eth2_led" "eth1"
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_static_modem_info "$model" "1-1" "1" ucidef_add_wlan_bssid_limit "wlan0" 8
ucidef_add_wlan_bssid_limit "wlan1" 8
ucidef_add_static_modem_info "$model" "1-1" "1" "primary"
ucidef_set_hwinfo mobile wifi dual_band_ssid ethernet ios ucidef_set_hwinfo mobile wifi dual_band_ssid ethernet ios
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
;; ;;
RUT950*) RUT950*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10" ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10"
@ -131,10 +211,12 @@ setup_json() {
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04" ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1" ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
ucidef_set_interface_wan "eth1" ucidef_set_interface_wan "eth1"
ucidef_add_wlan_bssid_limit "wlan0" 8
ucidef_add_switch "switch0" "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" ucidef_add_switch "switch0" "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
ucidef_add_static_modem_info "$model" "1-1" "2" ucidef_add_static_modem_info "$model" "1-1" "2" "primary"
[ "${model:7:2}" = "06" ] && ucidef_set_hwinfo dual_sim mobile \ [ "${model:7:2}" = "06" ] && ucidef_set_hwinfo dual_sim mobile \
wifi ethernet || ucidef_set_hwinfo dual_sim mobile wifi ethernet ios wifi ethernet || ucidef_set_hwinfo dual_sim mobile wifi ethernet ios
ucidef_set_network_options "vlans" 15 "readonly_vlans" 1
;; ;;
RUT955*) RUT955*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10" ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10"
@ -142,65 +224,284 @@ setup_json() {
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04" ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1" ucidef_set_led_netdev "wan" "WAN" "wan_led" "eth1"
ucidef_set_interface_wan "eth1" ucidef_set_interface_wan "eth1"
ucidef_add_wlan_bssid_limit "wlan0" 8
ucidef_add_switch "switch0" "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" ucidef_add_switch "switch0" "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
ucidef_add_static_modem_info "$model" "1-1.4" "2" "gps_out" ucidef_set_usb_jack "/usb1/1-1/1-1.1/"
[ "${model:7:2}" = "06" ] && ucidef_set_hwinfo dual_sim usb gps \ ucidef_add_static_modem_info "$model" "1-1.4" "2" "primary" "gps_out"
mobile wifi ethernet || ucidef_set_hwinfo dual_sim usb gps \ [ "${model:7:2}" = "06" ] && ucidef_set_hwinfo dual_sim usb gps sd_card \
mobile wifi ethernet ios mobile wifi ethernet rs232 rs485 || ucidef_set_hwinfo dual_sim usb gps sd_card \
mobile wifi ethernet ios rs232 rs485
ucidef_add_serial_capabilities "rs232" \ ucidef_add_serial_capabilities "rs232" \
"200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 \ "300 600 1200 2400 4800 9600 19200 38400 57600 115200" \
230400 460800 500000 576000" \ "5 6 7 8" \
"5 6 7 8" "rts/cts xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/usb1/1-1/1-1.3/"
ucidef_add_serial_capabilities "rs485" \ ucidef_add_serial_capabilities "rs485" \
"300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400 \ "300 600 1200 2400 4800 9600 19200 38400 57600 115200 \
460800 500000 576000 921600 1000000 1152000 1500000 2000000 \ 230400 460800 921600 1000000 3000000" \
2500000 3000000" \ "8" \
"8" "none" \
"1 2" \
"even odd none" \
"/tty/ttyATH1"
ucidef_set_network_options "vlans" 15 "readonly_vlans" 1
;;
RUT901* |\
RUT951*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x01"
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x02"
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
ucidef_set_led_switch "wan" "WAN" "wan_led" "switch0" "0x10"
ucidef_add_switch "switch0" "0:lan:1" "1:lan:2" "2:lan:3" "4:wan" "6@eth0"
ucidef_set_interface_default_macaddr "lan" "$(mtd_get_mac_binary config 0x0)"
ucidef_set_interface_default_macaddr "wan" "$(macaddr_add "$(mtd_get_mac_binary config 0x0)" 1)"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_static_modem_info "$model" "1-1" "2" "primary"
[ "${model:7:1}" = "6" ] && ucidef_set_hwinfo dual_sim mobile \
wifi ethernet || ucidef_set_hwinfo dual_sim mobile wifi ethernet ios
[ "${model:4:2}" = "01" ] && ucidef_set_release_version "7.3.1"
ucidef_set_network_options "vlans" 16 "readonly_vlans" 2
;;
RUT906* |\
RUT956*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x01"
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x02"
ucidef_set_led_switch "lan3" "LAN3" "eth3_led" "switch0" "0x04"
ucidef_set_led_switch "wan" "WAN" "wan_led" "switch0" "0x10"
ucidef_add_switch "switch0" "0:lan:1" "1:lan:2" "2:lan:3" "4:wan" "6@eth0"
ucidef_set_interface_default_macaddr "lan" "$(mtd_get_mac_binary config 0x0)"
ucidef_set_usb_jack "/usb1/1-1/1-1.1/"
ucidef_set_interface_default_macaddr "wan" "$(macaddr_add "$(mtd_get_mac_binary config 0x0)" 1)"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_static_modem_info "$model" "1-1.4" "2" "primary" "gps_out"
[ "${model:7:1}" = "6" ] && ucidef_set_hwinfo dual_sim usb gps \
mobile wifi ethernet rs232 rs485 || ucidef_set_hwinfo dual_sim usb gps \
mobile wifi ethernet ios rs232 rs485
[ "${model:4:2}" = "06" ] && ucidef_set_release_version "7.4.2"
ucidef_add_serial_capabilities "rs232" \
"300 600 1200 2400 4800 9600 19200 38400 57600 115200" \
"5 6 7 8" \
"rts/cts xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/usb1/1-1/1-1.3/"
ucidef_add_serial_capabilities "rs485" \
"300 600 1200 2400 4800 9600 19200 38400 57600 115200 230400" \
"5 6 7 8" \
"xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/tty/ttyS1"
ucidef_set_network_options "vlans" 16 "readonly_vlans" 2
;; ;;
TRB140*) TRB140*)
ucidef_set_interface_lan "eth0 rndis0" ucidef_set_interface_lan "eth0 rndis0"
ucidef_add_trb14x_lte_modem "$model"
ucidef_add_nand_info "$model"
[ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile ethernet || \ [ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile ethernet || \
ucidef_set_hwinfo mobile ethernet ios ucidef_set_hwinfo mobile ethernet ios
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
[ "${model:6:1}" = "4" ] && \
ucidef_set_release_version "7.4.2"
;;
TRB143*)
ucidef_set_interface_lan "eth0 rndis0"
[ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile ethernet || \
ucidef_set_hwinfo mobile ethernet ios
ucidef_add_serial_capabilities "mbus" \
"300 600 1200 2400 4800 9600 19200 38400" \
"5 6 7 8" \
"xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/tty/ttyHS0"
if [ "${model:6:1}" = "4" ]; then
ucidef_set_release_version "7.4.3"
else
ucidef_set_release_version "7.1.7"
fi
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;; ;;
TRB141*) TRB141*)
ucidef_set_interface_lan "rndis0" ucidef_set_interface_lan "rndis0"
ucidef_add_trb14x_lte_modem "$model"
ucidef_add_nand_info "$model"
ucidef_set_hwinfo mobile ios ucidef_set_hwinfo mobile ios
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
[ "${model:6:1}" = "4" ] && \
ucidef_set_release_version "7.4.3"
;;
TRB142*)
ucidef_set_interface_lan "rndis0"
[ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile rs232 || \
ucidef_set_hwinfo mobile ios rs232
ucidef_add_serial_capabilities "rs232" \
"300 600 1200 2400 4800 9600 19200 38400 57600 115200" \
"5 6 7 8" \
"rts/cts xon/xoff none" \
"1 2" \
"even odd mark space none" \
"/tty/ttyHS0"
if [ "${model:6:1}" = "3" ]; then
ucidef_set_release_version "7.1"
elif [ "${model:6:1}" = "4" ]; then
ucidef_set_release_version "7.4.3"
fi
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;; ;;
TRB142* |\
TRB145*) TRB145*)
ucidef_set_interface_lan "rndis0" ucidef_set_interface_lan "rndis0"
ucidef_add_trb14x_lte_modem "$model" [ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile rs485 || \
ucidef_add_nand_info "$model" ucidef_set_hwinfo mobile ios rs485
[ "${model:7:1}" = "2" ] && ucidef_set_hwinfo mobile || \ ucidef_add_serial_capabilities "rs485" \
ucidef_set_hwinfo mobile ios "300 600 1200 2400 4800 9600 19200 38400 57600 115200 \
[ "${model:5:1}" = "2" ] && local rs="rs232" 230400 460800 921600 1000000 3000000" \
ucidef_add_serial_capabilities "${rs:-rs485}" \ "5 6 7 8" \
"300 600 1200 2400 4800 9600 19200 38400 57600 115200 460800" \ "xon/xoff none" \
"5 6 7 8" "1 2" \
[ "${model:5:2}" = "23" -o "${model:5:2}" = "52" ] && \ "even odd mark space none" \
"/tty/ttyHS0"
if [ "${model:6:1}" = "2" ]; then
ucidef_set_release_version "7.1" ucidef_set_release_version "7.1"
elif [ "${model:6:1}" = "4" ]; then
ucidef_set_release_version "7.4.3"
fi
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;; ;;
TCR100*) TCR100*)
ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x10" ucidef_set_led_switch "lan" "LAN" "eth1_led" "switch0" "0x10"
ucidef_set_led_netdev "wan" "WAN" "eth2_led" "eth1" ucidef_set_led_netdev "wan" "WAN" "eth2_led" "eth1"
ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_wlan_bssid_limit "wlan0" 8
ucidef_add_wlan_bssid_limit "wlan1" 8
ucidef_set_interface guest proto static type bridge \ ucidef_set_interface guest proto static type bridge \
guest 1 _wireless true _dhcp true guest 1 _wireless true _dhcp true
ucidef_add_static_modem_info "$model" "1-1" "1" ucidef_add_static_modem_info "$model" "1-1" "1" "primary"
ucidef_set_hwinfo mobile wifi dual_band_ssid wps ethernet ucidef_set_hwinfo mobile wifi dual_band_ssid wps ethernet
ucidef_set_release_version "7.2.4"
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
;;
OTD140*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x10"
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x2"
ucidef_add_switch "switch0" "4:lan:1" "1:lan:2" "6@eth0"
ucidef_set_interface_default_macaddr "lan" "$(mtd_get_mac_binary config 0x0)"
ucidef_set_interface "lan" "default_ip" "%%LAN_IP%%"
ucidef_add_static_modem_info "$model" "1-1" "2" "primary"
ucidef_set_hwinfo ethernet mobile dual_sim poe
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
ucidef_set_poe 2 15400 1 "lan2" "3" 15400
ucidef_set_poe_chip "0X77" "0:lan2"
ucidef_set_poe_chip "0X2F" "1:lan2"
;;
OTD160*)
ucidef_set_led_switch "lan1" "LAN1" "eth1_led" "switch0" "0x04"
ucidef_set_led_switch "lan2" "LAN2" "eth2_led" "switch0" "0x02"
ucidef_set_interface_lan "eth0"
ucidef_add_wlan_bssid_limit "wlan0" 8
ucidef_add_wlan_bssid_limit "wlan1" 8
ucidef_add_static_modem_info "$model" "1-1" "2" "primary"
ucidef_set_hwinfo dual_sim mobile wifi dual_band_ssid ethernet
ucidef_set_network_options "vlans" 16 "readonly_vlans" 1
;;
TAP100*)
ucidef_set_led_switch "lan" "LAN" "eth0_led" "switch0" "0x10"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_set_interface_lan "eth0"
ucidef_set_interface "lan" "ipv6" "1"
ucidef_set_interface_default_macaddr "lan" "$(mtd_get_mac_binary config 0x0)"
ucidef_set_hwinfo wifi ethernet sw_rst_on_init
ucidef_set_network_options "ula" false "disable_vlan" true "ip6assign" false "vlans" 16 "readonly_vlans" 1 "no_metric" true
ucidef_set_interface "dhcp" "device" "@lan" "proto" "dhcp"
;;
TRB500*)
ucidef_set_interface_lan "eth0 ecm0"
ucidef_set_interface_default_macaddr "lan" "$(mtd_get_mac_binary mnf_info 0x0)" \
"$(macaddr_add "$(mtd_get_mac_binary mnf_info 0x0)" 1)"
ucidef_set_hwinfo mobile ethernet ios
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
RUTM50*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
ucidef_set_usb_jack "/usb1/1-2/"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_wlan_bssid_limit "wlan1" 4
ucidef_add_static_modem_info "$model" "2-1" "2" "primary" "gps_out"
ucidef_set_hwinfo usb ethernet ios gps mobile wifi dual_band_ssid dual_sim at_sim dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
RUTM51*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
ucidef_set_usb_jack "/usb1/1-2/"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_wlan_bssid_limit "wlan1" 4
ucidef_add_static_modem_info "$model" "2-1" "2" "primary"
ucidef_set_hwinfo usb ethernet ios mobile wifi dual_band_ssid dual_sim at_sim dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
ucidef_set_release_version "7.4.4"
;;
RUTM08*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_set_hwinfo usb ethernet ios dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
RUTM09*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
ucidef_add_static_modem_info "$model" "1-2" "2" "primary" "gps_out"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_set_hwinfo usb ethernet ios gps mobile dual_sim dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
RUTM10*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_wlan_bssid_limit "wlan1" 4
ucidef_set_hwinfo usb ethernet ios wifi dual_band_ssid dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
RUTM11*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
ucidef_set_usb_jack "/usb1/1-1/"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_wlan_bssid_limit "wlan1" 4
ucidef_add_static_modem_info "$model" "1-2" "2" "primary" "gps_out"
ucidef_set_hwinfo usb ethernet ios gps mobile wifi dual_band_ssid dual_sim dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
RUTM12*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
ucidef_set_usb_jack "/usb1/1-2/1-2.3/"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_wlan_bssid_limit "wlan1" 4
ucidef_add_static_modem_info "$model" "1-1" "1" "primary" "gps_out"
ucidef_add_static_modem_info "$model" "1-2.2" "1"
ucidef_set_hwinfo usb ethernet ios gps mobile wifi dual_band_ssid dual_modem dsa hw_nat
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;;
x86)
ucidef_set_interface_wan "eth0"
ucidef_set_interface_lan "eth1"
ucidef_add_wlan_bssid_limit "wlan0" 4
ucidef_add_wlan_bssid_limit "wlan1" 4
ucidef_set_hwinfo usb wifi dual_band_ssid ethernet
ucidef_set_network_options "vlans" 4094 "readonly_vlans" 1
;; ;;
*) *)
echo "Unsupported hardware. Network interfaces not intialized" echo "Unsupported hardware. Network interfaces not intialized"
;; ;;
esac esac
ucidef_set_interface "lan" "default_ip" "%%LAN_IP%%"
type ucidef_target_defaults &> /dev/null && \
ucidef_target_defaults "$model"
} }
#~ Get model name for RUTX products #~ Get model name for RUTX products
model="$(mnf_info --name)" 2>/dev/null if ! model="$(mnf_info --name)" 2>/dev/null; then
model="$(mnf_info --prod-code)" 2>/dev/null
fi
platform="$(cat /proc/device-tree/platform)" 2>/dev/null platform="$(cat /proc/device-tree/platform)" 2>/dev/null

View file

@ -38,3 +38,17 @@ is_builtin_modem() {
echo 0 echo 0
} }
is_dual_modem() {
json_init
json_load_file "/etc/board.json"
json_get_keys hwinfo hwinfo
json_select hwinfo
json_get_vars dual_modem
[ "$dual_modem" = "1" ] && echo 1 || echo 0
json_select ..
}

View file

@ -3,41 +3,6 @@
. /lib/functions.sh . /lib/functions.sh
. /usr/share/libubox/jshn.sh . /usr/share/libubox/jshn.sh
ucidef_add_nand_info() {
local model="$1"
model=${model:0:7}
json_select_object nand
case "$model" in
TRB1412)
json_add_int blocksize 128
json_add_int pagesize 2048
json_add_int subpagesize 2048
;;
TRB1422 |\
TRB1423 |\
TRB1452)
json_add_int blocksize 256
json_add_int pagesize 4096
json_add_int subpagesize 4096
;;
TRB14*0)
json_add_int blocksize 128
json_add_int pagesize 2048
json_add_int subpagesize 2048
;;
TRB14*1)
json_add_int blocksize 256
json_add_int pagesize 4096
json_add_int subpagesize 4096
;;
esac
json_select ..
}
ucidef_add_static_modem_info() { ucidef_add_static_modem_info() {
#Parameters: model usb_id sim_count other_params #Parameters: model usb_id sim_count other_params
local model usb_id count local model usb_id count
@ -74,114 +39,6 @@ ucidef_add_static_modem_info() {
json_select .. json_select ..
} }
ucidef_add_trb14x_lte_modem() {
print_array() {
json_add_array $1
for element in $2
do
json_add_string "" "$(echo $element)"
done
json_close_array
}
#Parameters: model primary
local model vendor product boudrate gps type desc control region modem_counter
modem_counter=1
json_select_array "modems"
model="$1"
model=${model:0:7}
case "$model" in
TRB1422)
vendor=05c6
product=9215
;;
TRB1412 |\
TRB1423 |\
TRB1452 |\
TRB140*)
vendor=2c7c
product=0125
;;
TRB14*)
vendor=2c7c
product=0121
;;
esac
case "$model" in
TRB1412 |\
TRB14*0)
region="EU"
[ "$product" = "0121" ] && {
lte_bands="1 3 7 8 20 28"
trysg_bands="wcdma_2100 wcdma_900"
dug_bands="gsm_1800 gsm_900"
}
[ "$product" = "0125" ] && {
lte_bands="1 3 7 8 20 28 38 40 41"
trysg_bands="wcdma_2100 wcdma_900"
dug_bands="gsm_1800 gsm_900"
}
;;
TRB1422)
region="CE"
lte_bands="1 3 5 8 34 38 39 40 41"
trysg_bands="bc-0-a-system bc-0-b-system wcdma_2100 wcdma_900"
dug_bands="gsm_1800 gsm_900"
;;
TRB1423 |\
TRB1452 |\
TRB14*1)
region="AU"
[ "$product" = "0121" ] && {
lte_bands="1 2 3 4 5 7 8 28 40"
trysg_bands="wcdma_2100 wcdma_1900 wcdma_900 wcdma_850"
dug_bands="gsm_1800 gsm_900 gsm_850 gsm_1900"
}
[ "$product" = "0125" ] && {
lte_bands="1 2 3 4 5 7 8 28 40"
trysg_bands="wcdma_2100 wcdma_1900 wcdma_900 wcdma_850"
dug_bands="gsm_1800 gsm_900 gsm_850 gsm_1900"
}
;;
esac
[ -f "/lib/network/wwan/$vendor:$product" ] && {
devicename="3-1"
json_set_namespace defaults old_cb
json_load "$(cat /lib/network/wwan/$vendor:$product)"
json_get_vars gps boudrate type desc control stop_bits
json_set_namespace $old_cb
[ "${devicename%%:*}" = "$devicename" ] && {
json_add_object
json_add_string id "$devicename"
json_add_string num "$modem_counter"
json_add_string vendor "$vendor"
json_add_string product "$product"
json_add_string stop_bits "$stop_bits"
json_add_string gps "$gps"
json_add_string boudrate "$boudrate"
json_add_string type "$type"
json_add_string desc "$desc"
json_add_string region "$region"
json_add_string control "$control"
json_add_int simcount 1
json_add_boolean builtin 1
[ -n "$2" ] && json_add_boolean primary 1
json_add_object service_modes
[ -z "$lte_bands" ] || print_array "4G" "$lte_bands"
[ -z "$trysg_bands" ] || print_array "3G" "$trysg_bands"
[ -z "$dug_bands" ] || print_array "2G" "$dug_bands"
json_close_object
json_close_object
}
}
json_select ..
}
ucidef_add_serial_capabilities() { ucidef_add_serial_capabilities() {
json_select_array serial json_select_array serial
json_add_object json_add_object
@ -204,81 +61,83 @@ ucidef_add_serial_capabilities() {
json_add_string "" $n json_add_string "" $n
done done
json_select .. json_select ..
json_select_array flow_control
for n in $4; do
json_add_string "" $n
done
json_select ..
json_select_array stop_bits
for n in $5; do
json_add_string "" $n
done
json_select ..
json_select_array parity_types
for n in $6; do
json_add_string "" $n
done
json_select ..
json_add_string "path" $7
json_close_object
json_select ..
}
ucidef_add_wlan_bssid_limit() {
json_select_object wlan
json_add_object "$1"
json_add_int bssid_limit "$2"
json_close_object json_close_object
json_select .. json_select ..
} }
ucidef_set_hwinfo() { ucidef_set_hwinfo() {
local function local args=" $* "
local dual_sim=0 local options='
local wifi=0 dual_sim
local dual_band_ssid=0 at_sim
local wps=0 wifi
local mobile=0 dual_band_ssid
local gps=0 wps
local usb=0 mobile
local bluetooth=0 gps
local ethernet=0 usb
local sfp_port=0 poe
local ios=0 bluetooth
ethernet
for function in "$@"; do sfp_port
case "$function" in ios
dual_sim) sfp_switch
dual_sim=1 rs232
;; rs485
wifi) console
wifi=1 dual_modem
;; sd_card
dual_band_ssid) sw_rst_on_init
dual_band_ssid=1 dsa
;; hw_nat
wps) '
wps=1
;;
mobile)
mobile=1
;;
gps)
gps=1
;;
usb)
usb=1
;;
bluetooth)
bluetooth=1
;;
ethernet)
ethernet=1
;;
sfp_port)
sfp_port=1
;;
ios)
ios=1
;;
at_sim)
at_sim=1
;;
esac
done
json_select_object hwinfo json_select_object hwinfo
json_add_boolean dual_sim "$dual_sim"
json_add_boolean usb "$usb" for opt in $options; do
json_add_boolean bluetooth "$bluetooth" if [[ "$args" =~ " $(echo "$opt" | tr -d '\011\012\015\040') " ]]; then
json_add_boolean wifi "$wifi" json_add_boolean "$opt" 1
json_add_boolean dual_band_ssid "$dual_band_ssid" else
json_add_boolean wps "$wps" json_add_boolean "$opt" 0
json_add_boolean mobile "$mobile" fi
json_add_boolean gps "$gps" done
json_add_boolean ethernet "$ethernet"
json_add_boolean sfp_port "$sfp_port"
json_add_boolean ios "$ios"
json_add_boolean at_sim "$at_sim"
json_select .. json_select ..
} }
ucidef_set_release_version() { ucidef_set_release_version() {
json_add_string release_version "$1" json_add_string release_version "$1"
} }
ucidef_set_usb_jack() {
json_add_string "usb_jack" "$1"
}

View file

@ -4,7 +4,65 @@
is_ios_enabled() { is_ios_enabled() {
local ios local ios
json_load_file "/etc/board.json" && \ json_load_file "/etc/board.json" &&
json_select hwinfo && \ json_select hwinfo &&
json_get_var ios ios && [ "$ios" = "1" ] json_get_var ios ios && [ "$ios" = "1" ]
}
# set_tty_options <device_path> <baudrate> <databits> <parity> <stopbits> <flowcontrol> <duplex> <echo>
set_tty_options() {
local PARITY_TMP=""
local SBITS_TMP=""
local FCTRL_TMP=""
case "$4" in
"odd") PARITY_TMP="parenb parodd -cmspar" ;;
"even") PARITY_TMP="parenb -parodd -cmspar" ;;
"mark") PARITY_TMP="parenb parodd cmspar";;
"space") PARITY_TMP="parenb -parodd cmspar";;
*) PARITY_TMP="-parenb -parodd -cmspar" ;;
esac
case "$5" in
1) SBITS_TMP="-cstopb" ;;
2) SBITS_TMP="cstopb" ;;
*) SBITS_TMP="-cstopb" ;;
esac
case "$6" in
"none") FCTRL_TMP="-crtscts -ixon -ixoff" ;;
"rts/cts") FCTRL_TMP="crtscts -ixon -ixoff" ;;
"xon/xoff") FCTRL_TMP="-crtscts ixon ixoff" ;;
*) FCTRL_TMP="-crtscts -ixon -ixoff" ;;
esac
case "$7" in
0 | 1)
echo "$7" >/sys/class/gpio/rs485_rx_en/value
;;
esac
if [ "$8" == "1" ]; then
FCTRL_TMP="$FCTRL_TMP echo"
else
FCTRL_TMP="$FCTRL_TMP -echo"
fi
local stty_retries=0
while ! stty -F "$1" "$2" cs"$3" $PARITY_TMP "$SBITS_TMP" $FCTRL_TMP; do
if [ $stty_retries -lt 5 ]; then
stty_retries=$((stty_retries + 1))
echo "stty was unable to set all the parameters, retrying in 10 seconds"
sleep 10
else
echo "stty failed, continuing anyway"
break
fi
done
}
to_lower() {
tr '[A-Z]' '[a-z]' <<-EOF
$@
EOF
} }

View file

@ -40,11 +40,14 @@ ucidef_set_interface() {
local val=$1; shift local val=$1; shift
[ -n "$opt" -a -n "$val" ] || break [ -n "$opt" -a -n "$val" ] || break
case "$val" in
true) json_add_boolean "$opt" "1" ;; [ "$opt" = "device" -a "$val" != "${val/ //}" ] && {
false) json_add_boolean "$opt" "0" ;; json_select_array "ports"
*) json_add_string "$opt" "$val" ;; for e in $val; do json_add_string "" "$e"; done
esac json_close_array
} || {
json_add_string "$opt" "$val"
}
done done
if ! json_is_a proto string; then if ! json_is_a proto string; then
@ -59,6 +62,36 @@ ucidef_set_interface() {
json_select .. json_select ..
} }
ucidef_set_interface_default_macaddr() {
local network="$1" ifname
json_select_object 'network'
json_select_object "$network"
if json_is_a ports array; then
json_select_array 'ports'
json_get_keys port_id
for i in $port_id; do
json_get_var port "$i"
ifname="${ifname} $port"
done
json_select ..
else
json_get_var ifname 'device'
fi
json_select ..
json_select ..
for i in $ifname; do
local macaddr="$2"; shift
[ -n "$macaddr" ] || break
json_select_object 'network-device'
json_select_object "$i"
json_add_string 'macaddr' "$macaddr"
json_select ..
json_select ..
done
}
ucidef_set_board_id() { ucidef_set_board_id() {
json_select_object model json_select_object model
json_add_string id "$1" json_add_string id "$1"
@ -84,11 +117,11 @@ ucidef_set_compat_version() {
} }
ucidef_set_interface_lan() { ucidef_set_interface_lan() {
ucidef_set_interface "lan" ifname "$1" proto "${2:-static}" ucidef_set_interface "lan" device "$1" proto "${2:-static}"
} }
ucidef_set_interface_wan() { ucidef_set_interface_wan() {
ucidef_set_interface "wan" ifname "$1" proto "${2:-dhcp}" ucidef_set_interface "wan" device "$1" proto "${2:-dhcp}"
} }
ucidef_set_interfaces_lan_wan() { ucidef_set_interfaces_lan_wan() {
@ -186,14 +219,14 @@ _ucidef_finish_switch_roles() {
json_select_object "$role" json_select_object "$role"
# attach previous interfaces (for multi-switch devices) # attach previous interfaces (for multi-switch devices)
json_get_var devices ifname json_get_var devices device
if ! list_contains devices "$device"; then if ! list_contains devices "$device"; then
devices="${devices:+$devices }$device" devices="${devices:+$devices }$device"
fi fi
json_select .. json_select ..
json_select .. json_select ..
ucidef_set_interface "$role" ifname "$devices" ucidef_set_interface "$role" device "$devices"
done done
} }
@ -210,7 +243,14 @@ ucidef_set_ar8xxx_switch_mib() {
json_select .. json_select ..
} }
ucidef_add_switch() { ucidef_add_switch() {
local enabled=1
if [ "$1" = "enabled" ]; then
shift
enabled="$1"
shift
fi
local name="$1"; shift local name="$1"; shift
local port num role device index need_tag prev_role local port num role device index need_tag prev_role
local cpu0 cpu1 cpu2 cpu3 cpu4 cpu5 local cpu0 cpu1 cpu2 cpu3 cpu4 cpu5
@ -218,7 +258,7 @@ ucidef_add_switch() {
json_select_object switch json_select_object switch
json_select_object "$name" json_select_object "$name"
json_add_boolean enable 1 json_add_boolean enable "$enabled"
json_add_boolean reset 1 json_add_boolean reset 1
for port in "$@"; do for port in "$@"; do
@ -606,6 +646,66 @@ ucidef_set_ntpserver() {
json_select .. json_select ..
} }
ucidef_set_network_options() {
json_add_object "network_options"
n=$#
for i in $(seq $((n / 2))); do
opt="$1"
val="$2"
if [ "$val" -eq "$val" ] 2>/dev/null; then
json_add_int "$opt" "$val"
else
[ "$val" = "true" ] && val=1 || val=0
json_add_boolean "$opt" "$val"
fi
shift; shift
done
json_close_object
}
ucidef_set_poe() {
json_add_object poe
json_add_int "chip_count" "$1"
json_add_int "budget" "$2"
json_add_int "poe_ports" "$3"
shift 3
json_add_array ports
while [ $# -gt 0 ]
do
json_add_object ""
json_add_string "name" "$1"
json_add_string "class" "$2"
json_add_int "budget" "$3"
json_close_object
shift 3
done
json_close_array
json_add_array poe_chips
json_close_array
json_close_object
}
ucidef_set_poe_chip() {
json_select_object poe
json_select_array poe_chips
json_add_object ""
for port in "$@"; do
case "$port" in
0X*)
json_add_string address "$port"
;;
[0-9]:*)
json_add_string chan"${port%%:*}" "${port##*:}"
;;
esac
done
json_close_object
json_select ..
json_select ..
}
board_config_update() { board_config_update() {
json_init json_init
[ -f ${CFG} ] && json_load "$(cat ${CFG})" [ -f ${CFG} ] && json_load "$(cat ${CFG})"

View file

@ -5,13 +5,16 @@ set_state() {
[ -e "/sys/class/gpio/${label}_power/value" ] || return [ -e "/sys/class/gpio/${label}_power/value" ] || return
config_get disable ${label} disable config_get disable ${label} disable
[ "${disable}" -eq 1 ] && \ [ "${disable}" -eq 1 ] && \
/sbin/mctl -s -m "${label}" || \ /sbin/mctl -s -m "${label}" -c || \
/sbin/mctl -p -m "${label}" /sbin/mctl -p -m "${label}" -c
} }
do_power_modem() { do_power_modem() {
/sbin/mctl -p || { [ -f /etc/board.json ] || return
[ -z "$(uci -q get system.modem.disable)" ] && /sbin/mctl -p -a -c || {
config_load system config_load system
config_foreach set_state mctl config_foreach set_state mctl
} }

View file

@ -42,13 +42,22 @@ switch_to_ramfs() {
mtd partx losetup mkfs.ext4 nandwrite flash_erase \ mtd partx losetup mkfs.ext4 nandwrite flash_erase \
ubiupdatevol ubiattach ubiblock ubiformat \ ubiupdatevol ubiattach ubiblock ubiformat \
ubidetach ubirsvol ubirmvol ubimkvol \ ubidetach ubirsvol ubirmvol ubimkvol \
snapshot snapshot_tool date \ snapshot snapshot_tool date jshn dtbtool dtc mkbootimg \
dumpimage $RAMFS_COPY_BIN ubinize-image.sh sysupgrade-tar.sh which ubinize mktemp \
dumpimage ledman fwtool \
$RAMFS_COPY_BIN
do do
local file="$(command -v "$binary" 2>/dev/null)" local file="$(command -v "$binary" 2>/dev/null)"
[ -n "$file" ] && install_bin "$file" [ -n "$file" ] && install_bin "$file"
done done
install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh /lib/upgrade/do_stage2 /usr/share/libubox/jshn.sh $RAMFS_COPY_DATA install_file /etc/resolv.conf \
/lib/*.sh \
/lib/functions/*.sh \
/lib/upgrade/*.sh \
/lib/upgrade/do_stage2 \
/usr/share/libubox/jshn.sh \
/etc/board.json \
$RAMFS_COPY_DATA
[ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64 [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
@ -111,10 +120,14 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
_v _v
} }
indicate_upgrade [ -n "$(pgrep telnetd)" ] && {
killall -9 telnetd
}
[ -n "$(pgrep dropbear)" ] && {
killall -9 dropbear
}
killall -9 telnetd
killall -9 dropbear
killall -9 ash killall -9 ash
kill_remaining TERM kill_remaining TERM
@ -125,10 +138,6 @@ sleep 1
echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches
if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
platform_pre_upgrade "$IMAGE"
fi
if [ -n "$(rootfs_type)" ]; then if [ -n "$(rootfs_type)" ]; then
v "Switching to ramdisk..." v "Switching to ramdisk..."
switch_to_ramfs switch_to_ramfs

View file

@ -0,0 +1,24 @@
#include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ {
model = "RUTX08";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -0,0 +1,26 @@
#include "qcom-ipq4018-rutx-STM32.dtsi"
/ {
model = "RUTX08 STM32";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>;
};
};
};
};

View file

@ -0,0 +1,106 @@
#include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ {
model = "RUTX09";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&shift_io 3 GPIO_ACTIVE_LOW>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpios = <&shift_io 0 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&shift_io 21 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&shift_io 22 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_eth_3";
gpios = <&shift_io 20 GPIO_ACTIVE_HIGH>;
};
led_gen_2 {
label = "mob_gen_2";
gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&shift_io 8 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&shift_io 9 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&shift_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&shift_io 12 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&shift_io 14 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&shift_io 15 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
};
};
};

View file

@ -0,0 +1,108 @@
#include "qcom-ipq4018-rutx-STM32.dtsi"
/ {
model = "RUTX09 STM32";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&stm32_io 22 GPIO_ACTIVE_LOW>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&stm32_io 0 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&stm32_io 1 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_eth_3";
gpios = <&stm32_io 2 GPIO_ACTIVE_HIGH>;
};
led_gen_2 {
label = "mob_gen_2";
gpios = <&stm32_io 4 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&stm32_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&stm32_io 6 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&stm32_io 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&stm32_io 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&stm32_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
};
};
};

View file

@ -1,32 +1,13 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi" #include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ { / {
model = "Teltonika RUTX08/10"; model = "RUTX10";
soc { soc {
gpio-export { gpio-export {
compatible = "gpio-export"; compatible = "gpio-export";
#size-cells = <0>; #size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&shift_io 1 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&shift_io 2 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&shift_io 3 GPIO_ACTIVE_HIGH>;
};
gpio_out_1 { gpio_out_1 {
gpio-export,name = "gpio23"; gpio-export,name = "gpio23";
gpio-export,output = <0>; gpio-export,output = <0>;

View file

@ -0,0 +1,40 @@
#include "qcom-ipq4018-rutx-STM32.dtsi"
/ {
model = "RUTX10 STM32";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&stm32_io 19 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&stm32_io 18 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,8 +1,7 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi" #include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ { / {
model = "Teltonika RUTX09/11"; model = "RUTX11";
soc { soc {
gpio-export { gpio-export {
@ -54,12 +53,12 @@
}; };
led_wan_eth { led_wan_eth {
label = "wan_wifi_4"; // not wan_eth_3 ! label = "wan_eth_3";
gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 13 GPIO_ACTIVE_HIGH>;
}; };
led_wan_wifi { led_wan_wifi {
label = "wan_eth_3"; // not wan_wifi_4 ! label = "wan_wifi_4";
gpios = <&shift_io 20 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 20 GPIO_ACTIVE_HIGH>;
}; };

View file

@ -0,0 +1,123 @@
#include "qcom-ipq4018-rutx-STM32.dtsi"
/ {
model = "RUTX11 STM32";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&stm32_io 22 GPIO_ACTIVE_LOW>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&stm32_io 0 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&stm32_io 1 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_eth_3";
gpios = <&stm32_io 3 GPIO_ACTIVE_HIGH>;
};
led_wan_wifi {
label = "wan_wifi_4";
gpios = <&stm32_io 2 GPIO_ACTIVE_HIGH>;
};
led_gen_2 {
label = "mob_gen_2";
gpios = <&stm32_io 4 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&stm32_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&stm32_io 6 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&stm32_io 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&stm32_io 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&stm32_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&stm32_io 19 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&stm32_io 18 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,8 +1,7 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi" #include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ { / {
model = "Teltonika RUTX12"; model = "RUTX12";
soc { soc {
gpio-export { gpio-export {
@ -10,13 +9,13 @@
#size-cells = <0>; #size-cells = <0>;
gpio_modem_reset { gpio_modem_reset {
gpio-export,name = "modem1_reset"; gpio-export,name = "modem_reset";
gpio-export,output = <0>; gpio-export,output = <0>;
gpios = <&shift_io 16 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 16 GPIO_ACTIVE_HIGH>;
}; };
gpio_modem_power { gpio_modem_power {
gpio-export,name = "modem1_power"; gpio-export,name = "modem_power";
gpio-export,output = <0>; gpio-export,output = <0>;
gpios = <&shift_io 17 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 17 GPIO_ACTIVE_HIGH>;
}; };
@ -60,12 +59,12 @@
}; };
led_wan_eth { led_wan_eth {
label = "wan_wifi_4"; // not wan_eth_3 ! label = "wan_eth_3";
gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 6 GPIO_ACTIVE_HIGH>;
}; };
led_wan_wifi { led_wan_wifi {
label = "wan_eth_3"; // not wan_wifi_4 ! label = "wan_wifi_4";
gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 7 GPIO_ACTIVE_HIGH>;
}; };

View file

@ -1,36 +1,21 @@
#include "qcom-ipq4018-rutx-common.dtsi" #include "qcom-ipq4018-rutx-STM32.dtsi"
#include "qcom-ipq4018-rutx-i2c.dtsi"
/ { / {
model = "Teltonika RUTX STM32"; model = "RUTX12 STM32";
io_expander = "stm32";
soc { soc {
i2c_0: i2c@78b7000 {
stm32_io: stm32@74 {
#gpio-cells = <2>;
compatible = "tlt,stm32v1";
reg = <0x74>;
gpio-controller;
interrupt-parent = <&tlmm>;
interrupts = <5 2>;
interrupt-controller;
#interrupt-cells = <2>;
};
};
gpio-export { gpio-export {
compatible = "gpio-export"; compatible = "gpio-export";
#size-cells = <0>; #size-cells = <0>;
gpio_modem_reset { gpio_modem_reset {
gpio-export,name = "modem1_reset"; gpio-export,name = "modem_reset";
gpio-export,output = <0>; gpio-export,output = <0>;
gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>;
}; };
gpio_modem_power { gpio_modem_power {
gpio-export,name = "modem1_power"; gpio-export,name = "modem_power";
gpio-export,output = <0>; gpio-export,output = <0>;
gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>;
}; };
@ -47,12 +32,6 @@
gpios = <&stm32_io 14 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 14 GPIO_ACTIVE_HIGH>;
}; };
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&stm32_io 22 GPIO_ACTIVE_LOW>;
};
gpio_out_1 { gpio_out_1 {
gpio-export,name = "gpio23"; gpio-export,name = "gpio23";
gpio-export,output = <0>; gpio-export,output = <0>;
@ -83,19 +62,14 @@
led_wan_eth { led_wan_eth {
label = "wan_eth_3"; label = "wan_eth_3";
gpios = <&stm32_io 2 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 3 GPIO_ACTIVE_HIGH>;
}; };
led_wan_wifi { led_wan_wifi {
label = "wan_wifi_4"; label = "wan_wifi_4";
gpios = <&stm32_io 3 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 2 GPIO_ACTIVE_HIGH>;
}; };
led_wan_mob {
label = "wan_mob_5";
gpios = <&stm32_io 16 GPIO_ACTIVE_HIGH>;
};
led_gen_2 { led_gen_2 {
label = "mob_gen_2"; label = "mob_gen_2";
gpios = <&stm32_io 4 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 4 GPIO_ACTIVE_HIGH>;
@ -132,24 +106,12 @@
linux,default-trigger = "timer"; linux,default-trigger = "timer";
}; };
led_ssid_2 {
label = "mob_ssid_2";
gpios = <&stm32_io 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 { led_ssid_3 {
label = "mob_ssid_3"; label = "mob_ssid_3";
gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer"; linux,default-trigger = "timer";
}; };
led_ssid_4 {
label = "mob_ssid_4";
gpios = <&stm32_io 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 { led_ssid_5 {
label = "mob_ssid_5"; label = "mob_ssid_5";
gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>; gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>;

View file

@ -1,8 +1,7 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi" #include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ { / {
model = "Teltonika RUTX14"; model = "RUTX14";
soc { soc {
gpio-export { gpio-export {

View file

@ -0,0 +1,100 @@
#include "qcom-ipq4018-rutx-STM32.dtsi"
/ {
model = "RUTX14 STM32";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>;
};
gpio_out_1 {
gpio-export,name = "gpio23";
gpio-export,output = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 23 GPIO_ACTIVE_HIGH>;
};
gpio_in_1 {
gpio-export,name = "gpio24";
gpio-export,input = <0>;
gpio-export,direction_may_change;
gpios = <&stm32_io 24 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&stm32_io 0 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&stm32_io 1 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_eth_3";
gpios = <&stm32_io 3 GPIO_ACTIVE_HIGH>;
};
led_wan_wifi {
label = "wan_wifi_4";
gpios = <&stm32_io 2 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&stm32_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&stm32_io 6 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&stm32_io 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_wifi_24 {
label = "wifi_gen_2";
gpios = <&stm32_io 19 GPIO_ACTIVE_HIGH>;
};
led_wifi_50 {
label = "wifi_gen_5";
gpios = <&stm32_io 18 GPIO_ACTIVE_HIGH>;
};
};
};
};

View file

@ -1,8 +1,7 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi" #include "qcom-ipq4018-rutx-shiftreg.dtsi"
/ { / {
model = "Teltonika RUTX50"; model = "RUTX50";
soc { soc {

View file

@ -1,9 +1,8 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-shiftreg.dtsi" #include "qcom-ipq4018-rutx-shiftreg.dtsi"
#include "qcom-ipq4018-rutx-i2c.dtsi" // SFP #include "qcom-ipq4018-rutx-i2c.dtsi" // SFP
/ { / {
model = "Teltonika RUTXR1"; model = "RUTXR1";
soc { soc {
gpio-export { gpio-export {
@ -43,7 +42,7 @@
}; };
led_wan_eth { led_wan_eth {
label = "wan_wifi_4"; // not wan_eth_3 ! label = "wan_eth_3";
gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>; gpios = <&shift_io 11 GPIO_ACTIVE_HIGH>;
}; };

View file

@ -0,0 +1,82 @@
#include "qcom-ipq4018-rutx-STM32.dtsi"
/ {
model = "RUTXR1 STM32";
soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
gpio_modem_reset {
gpio-export,name = "modem_reset";
gpio-export,output = <0>;
gpios = <&stm32_io 21 GPIO_ACTIVE_HIGH>;
};
gpio_modem_power {
gpio-export,name = "modem_power";
gpio-export,output = <0>;
gpios = <&stm32_io 20 GPIO_ACTIVE_HIGH>;
};
gpio_sim_select {
gpio-export,name = "sim_sel";
gpio-export,output = <1>;
gpios = <&stm32_io 22 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_wan_sim1 {
label = "wan_sim_1";
gpios = <&stm32_io 0 GPIO_ACTIVE_HIGH>;
};
led_wan_sim2 {
label = "wan_sim_2";
gpios = <&stm32_io 1 GPIO_ACTIVE_HIGH>;
};
led_wan_eth {
label = "wan_eth_3";
gpios = <&stm32_io 3 GPIO_ACTIVE_HIGH>;
};
led_wan_mob {
label = "wan_mob_5";
gpios = <&stm32_io 16 GPIO_ACTIVE_HIGH>;
};
led_gen_3 {
label = "mob_gen_3";
gpios = <&stm32_io 5 GPIO_ACTIVE_HIGH>;
};
led_gen_4 {
label = "mob_gen_4";
gpios = <&stm32_io 6 GPIO_ACTIVE_HIGH>;
};
led_ssid_1 {
label = "mob_ssid_1";
gpios = <&stm32_io 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_3 {
label = "mob_ssid_3";
gpios = <&stm32_io 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
led_ssid_5 {
label = "mob_ssid_5";
gpios = <&stm32_io 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "timer";
};
};
};
};

View file

@ -0,0 +1,21 @@
#include "qcom-ipq4018-rutx-common.dtsi"
#include "qcom-ipq4018-rutx-i2c.dtsi"
/ {
io_expander = "stm32";
soc {
i2c_0: i2c@78b7000 {
stm32_io: stm32@74 {
#gpio-cells = <2>;
compatible = "tlt,stm32v1";
reg = <0x74>;
gpio-controller;
interrupt-parent = <&tlmm>;
interrupts = <5 2>;
interrupt-controller;
#interrupt-cells = <2>;
};
};
};
};

View file

@ -1,3 +1,5 @@
#include "qcom-ipq4018-rutx-common.dtsi"
/ { / {
io_expander = "shiftreg_1"; io_expander = "shiftreg_1";

View file

@ -82,6 +82,19 @@ define Build/UbootFw
fi fi
endef endef
define Build/UbootFw-rutx
$(CP) ./uboot_fw/ $(STAGING_DIR_HOST)/
if [ -e $(STAGING_DIR_HOST)/uboot_fw/tz.mbn ]; then \
$(SED) 's~file\.ubi~$@~g' $(STAGING_DIR_HOST)/uboot_fw/norplusnand-flash.conf; \
$(SED) 's~file\.elf~$(BIN_DIR)/openwrt-ipq40xx-u-boot-stripped.elf~g' $(STAGING_DIR_HOST)/uboot_fw/norplusnand-flash.conf; \
python $(TOPDIR)/target/linux/ipq40xx/image/uboot_fw/pack.py -t norplusnand -B -F boardconfig_premium_tlt -o $@ $(STAGING_DIR_HOST)/uboot_fw; \
else \
$(SED) 's~file\.ubi~$@~g' $(STAGING_DIR_HOST)/uboot_fw/norplusnand-apps-flash.conf; \
$(SED) 's~file\.elf~$(BIN_DIR)/openwrt-ipq40xx-u-boot-stripped.elf~g' $(STAGING_DIR_HOST)/uboot_fw/norplusnand-apps-flash.conf; \
python $(TOPDIR)/target/linux/ipq40xx/image/uboot_fw/pack.py -t norplusnand -B -F appsboardconfig_premium_tlt -o $@ $(STAGING_DIR_HOST)/uboot_fw; \
fi
endef
define Build/mkmylofw_32m define Build/mkmylofw_32m
$(eval device_id=$(word 1,$(1))) $(eval device_id=$(word 1,$(1)))
$(eval revision=$(word 2,$(1))) $(eval revision=$(word 2,$(1)))
@ -840,9 +853,11 @@ define Device/teltonika_rutx
FILESYSTEMS := squashfs FILESYSTEMS := squashfs
KERNEL_IN_UBI := 1 KERNEL_IN_UBI := 1
IMAGES := sysupgrade.bin IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := append-ubi | qsdk-ipq-factory-nand | append-rutx-metadata #IMAGE/sysupgrade.bin := append-ubi | qsdk-ipq-factory-nand | append-rutx-metadata
#IMAGE/sysupgrade.bin := append-ubi | UbootFw-rutx | append-rutx-metadata
IMAGE/sysupgrade.bin := append-ubi | UbootFw-rutx | append-metadata
#DEVICE_PACKAGES := ipq-wifi-teltonika_rutx kmod-bluetooth kmod-r2ec sysupgrade-helper #DEVICE_PACKAGES := ipq-wifi-teltonika_rutx kmod-bluetooth kmod-r2ec sysupgrade-helper
DEVICE_PACKAGES := ipq-wifi-teltonika_rutx kmod-bluetooth sysupgrade-helper DEVICE_PACKAGES := uboot-ipq40xx ipq-wifi-teltonika_rutx kmod-bluetooth sysupgrade-helper
HW_SUPPORT := io_expander%stm32:shiftreg_1 HW_SUPPORT := io_expander%stm32:shiftreg_1
endef endef
TARGET_DEVICES += teltonika_rutx TARGET_DEVICES += teltonika_rutx

View file

@ -0,0 +1,80 @@
[ipq40xx]
dirname=ipq40xx
nand_available=true
nor_available=true
emmc_available=true
spi_nand_available=true
norplusnand_available=true
norplusemmc_available=false
nand_pagesize=2048
nand_pages_per_block=64
nand_total_blocks=4096
nand_partition=nand-partition.xml
nor_pagesize=256
nor_pages_per_block=256
nor_total_blocks=512
nor_partition=nor-partition.xml
bootconfig=bootconfig.xml
nand_bootconfig=nand_bootconfig.bin
nor_bootconfig=nor_bootconfig.bin
bootconfig1=bootconfig1.xml
nand_bootconfig1=nand_bootconfig1.bin
nor_bootconfig1=nor_bootconfig1.bin
emmc_pagesize=512
emmc_blocksize=512
emmc_total_blocks=7634944
emmc_partition=emmc-partition.xml
smem_info=["smem-ipq40xx.xml"]
cdt_info=["pcddr_40xx.xml"]
cdt_info_default=pcddr_40xx.xml
nand_partition_mbn=nand-system-partition-ipq40xx.bin
nor_partition_mbn=nor-system-partition-ipq40xx.bin
emmc_partition_mbn=gpt_main0.bin
nand_flash_conf=nand-apps-flash.conf
nor_flash_conf=nor-apps-flash.conf
emmc_flash_conf=emmc-apps-flash.conf
machid=0x8010000
norplusnand_partition=nor-plus-nand-parition.xml
norplusnand_flash_conf=norplusnand-apps-flash.conf
norplusnand_partition_mbn=norplusnand-system-partition-ipq40xx.bin
[AP.DK01.1-C2]
dirname=AP.DK01.1-C2
nand_available=false
nor_available=false
emmc_available=false
spi_nand_available=true
norplusnand_available=true
norplusemmc_available=false
nand_pagesize=2048
nand_pages_per_block=64
nand_total_blocks=4096
nand_partition=nand-partition.xml
nor_pagesize=256
nor_pages_per_block=256
nor_total_blocks=512
nor_partition=nor-partition.xml
bootconfig=bootconfig.xml
nand_bootconfig=nand_bootconfig.bin
nor_bootconfig=nor_bootconfig.bin
bootconfig1=bootconfig1.xml
nand_bootconfig1=nand_bootconfig1.bin
nor_bootconfig1=nor_bootconfig1.bin
emmc_pagesize=512
emmc_blocksize=512
emmc_total_blocks=7634944
emmc_partition=emmc-partition.xml
smem_info=["smem-AP.DK01.1-C2.xml"]
cdt_info=["pcddr_AP.DK01.1-C2_64M16.xml", "pcddr_AP.DK01.1-C2_128M16.xml", "pcddr_AP.DK01.1-C2_256M16.xml"]
cdt_info_default=pcddr_AP.DK01.1-C2.xml
nand_partition_mbn=nand-system-partition-ipq40xx.bin
nor_partition_mbn=nor-system-partition-ipq40xx.bin
emmc_partition_mbn=gpt_main0.bin
nand_flash_conf=nand-apps-flash.conf
nor_flash_conf=nor-apps-flash.conf
emmc_flash_conf=emmc-apps-flash.conf
machid=0x8010100
norplusnand_partition=nor-plus-nand-parition.xml
norplusnand_flash_conf=norplusnand-apps-flash.conf
norplusnand_partition_mbn=norplusnand-system-partition-ipq40xx.bin

View file

@ -0,0 +1,79 @@
[ipq40xx]
dirname=ipq40xx
nand_available=true
nor_available=true
emmc_available=true
spi_nand_available=true
norplusnand_available=true
norplusemmc_available=false
nand_pagesize=2048
nand_pages_per_block=64
nand_total_blocks=4096
nand_partition=nand-partition.xml
nor_pagesize=256
nor_pages_per_block=256
nor_total_blocks=512
nor_partition=nor-partition.xml
bootconfig=bootconfig.xml
nand_bootconfig=nand_bootconfig.bin
nor_bootconfig=nor_bootconfig.bin
bootconfig1=bootconfig1.xml
nand_bootconfig1=nand_bootconfig1.bin
nor_bootconfig1=nor_bootconfig1.bin
emmc_pagesize=512
emmc_blocksize=512
emmc_total_blocks=7634944
emmc_partition=emmc-partition.xml
smem_info=["smem-ipq40xx.xml"]
cdt_info=["pcddr_40xx.xml"]
cdt_info_default=pcddr_40xx.xml
nand_partition_mbn=nand-system-partition-ipq40xx.bin
nor_partition_mbn=nor-system-partition-ipq40xx.bin
emmc_partition_mbn=gpt_main0.bin
nand_flash_conf=nand-flash.conf
nor_flash_conf=nor-flash.conf
emmc_flash_conf=emmc-flash.conf
machid=0x8010000
norplusnand_partition=nor-plus-nand-parition.xml
norplusnand_flash_conf=norplusnand-flash.conf
norplusnand_partition_mbn=norplusnand-system-partition-ipq40xx.bin
[AP.DK01.1-C2]
dirname=AP.DK01.1-C2
nand_available=false
nor_available=false
emmc_available=false
spi_nand_available=true
norplusnand_available=true
norplusemmc_available=false
nand_pagesize=2048
nand_pages_per_block=64
nand_total_blocks=4096
nand_partition=nand-partition.xml
nor_pagesize=256
nor_pages_per_block=256
nor_total_blocks=512
nor_partition=nor-partition.xml
bootconfig=bootconfig.xml
nand_bootconfig=nand_bootconfig.bin
nor_bootconfig=nor_bootconfig.bin
bootconfig1=bootconfig1.xml
nand_bootconfig1=nand_bootconfig1.bin
nor_bootconfig1=nor_bootconfig1.bin
emmc_pagesize=512
emmc_blocksize=512
emmc_total_blocks=7634944
emmc_partition=emmc-partition.xml
smem_info=["smem-AP.DK01.1-C2.xml"]
cdt_info=["pcddr_AP.DK01.1-C2_64M16.xml", "pcddr_AP.DK01.1-C2_128M16.xml", "pcddr_AP.DK01.1-C2_256M16.xml"]
cdt_info_default=pcddr_AP.DK01.1-C2.xml
nand_partition_mbn=nand-system-partition-ipq40xx.bin
nor_partition_mbn=nor-system-partition-ipq40xx.bin
emmc_partition_mbn=gpt_main0.bin
nand_flash_conf=nand-flash.conf
nor_flash_conf=nor-flash.conf
emmc_flash_conf=emmc-flash.conf
machid=0x8010100
norplusnand_partition=nor-plus-nand-parition.xml
norplusnand_flash_conf=norplusnand-flash.conf
norplusnand_partition_mbn=norplusnand-system-partition-ipq40xx.bin

View file

@ -0,0 +1,17 @@
[ubi]
partition = rootfs
filename = file.ubi
[ubi_1]
partition = rootfs_1
filename = file.ubi
primary = ubi
[u-boot]
partition = 0:APPSBL
filename = file.elf
[u-boot_1]
partition = 0:APPSBL_1
filename = file.elf
primary = u-boot

View file

@ -0,0 +1,53 @@
[mibib]
partition = 0:MIBIB
filename = norplusnand-system-partition-ipq40xx.bin
[sbl1]
partition = 0:SBL1
filename = sbl1_nor.mbn
[bootconfig]
partition = 0:BOOTCONFIG
filename = nor_bootconfig.bin
[bootconfig_1]
partition = 0:BOOTCONFIG1
filename = nor_bootconfig1.bin
[ddr-teltonika,rutx]
partition = 0:CDT
filename = cdt-AP.DK01.1-C2.bin
if_machid = 0x8010100
[ddr-teltonika,rutx_1]
partition = 0:CDT_1
filename = cdt-AP.DK01.1-C2.bin
if_machid = 0x8010100
primary = ddr-teltonika,rutx
[tz]
partition = 0:QSEE
filename = tz.mbn
[tz_1]
partition = 0:QSEE_1
filename = tz.mbn
primary = tz
[u-boot]
partition = 0:APPSBL
filename = file.elf
[u-boot_1]
partition = 0:APPSBL_1
filename = file.elf
primary = u-boot
[ubi]
partition = rootfs
filename = file.ubi
[ubi_1]
partition = rootfs_1
filename = file.ubi
primary = ubi

View file

@ -0,0 +1,21 @@
diff --git a/tools/mkimage.h b/tools/mkimage.h
index f5ca65e2ed..d92a3ff811 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -17,6 +17,7 @@
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <u-boot/sha1.h>
#include "fdt_host.h"
#include "imagetool.h"
@@ -44,7 +45,7 @@ static inline ulong map_to_sysmem(void *ptr)
#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) type name[size]
#define MKIMAGE_TMPFILE_SUFFIX ".tmp"
-#define MKIMAGE_MAX_TMPFILE_LEN 256
+#define MKIMAGE_MAX_TMPFILE_LEN PATH_MAX
#define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500"
#define MKIMAGE_MAX_DTC_CMDLINE_LEN 2 * MKIMAGE_MAX_TMPFILE_LEN + 35

View file

@ -11,9 +11,10 @@ include $(INCLUDE_DIR)/download.mk
PKG_NAME:=uboot PKG_NAME:=uboot
PKG_SOURCE_VERSION:=e9af48b5da6b8b9ddce90bef0097cadbab257c30 #PKG_SOURCE_VERSION:=e9af48b5da6b8b9ddce90bef0097cadbab257c30
DEVICE_VENDOR='teltonika' DEVICE_VENDOR='teltonika'
PKG_VERSION:=teltonika
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk

Some files were not shown because too many files have changed in this diff Show more