[OpenWrt-Devel] Question about custom script at init on Trunk.-

Guillermo Javier Nardoni guillermo at geryon.com.ar
Tue Jan 26 19:19:54 EST 2016


Hello everyone, 

At first, I should say that I’ve been away a long time from openwrt-devel
mailing list. 

I was using Barrier Braker 14.07 to build our custom firmware, usually for
TP-Link WR740/741 v3/v4, but recently we have received TP-Link WR740 v5
(a.k.a. 741 v5) so I figured out that Barrier Braker don’t have support for
it, at least not native one.
Googling I found a solution which I’ve flashed it first with a stripped
custom firmware found on Internet and then, via console, do a beautifull
reflash with WR741 v4 firmware (build by us) and everything Works perfect!.

Since I’m not the one who flashes the devices I did a new git from trunk
versión of OpenWrt (CHAOS CALMER (15.05)) because it has native support for
TP-Link TL-WR740N versión 5 but when I looked into the code I’ve figured
out, again, that the code changed a lot since the BB 14.07 and I don’t know
how to adapt the custom configurations.

The reason I changed those 2 files it is because of the users sometimes (i
mean always) press the reset button and it won’t allow us to remotely
recofigure the device and to use one port of the switch to bridge it with
the WAN port to use them just because we have ATAs devices that don’t
support NAT etc etc.
When a user presses the reset button, it resets the device and configure it
with a standard configuration which let the user to have Telephone (VoIP),
Internet, Wifi and we can Access remotely to reconfigure it as I said
before.

On BB 14.07 I’ve just modified 2 files:
./package/base-files/files/lib/functions/uci-defaults.sh


.

ucidef_add_switch() {
        local name=$1
        local reset=$2
        local enable=$3
        uci batch <<EOF
add network switch
set network. at switch[-1].name='$name'
set network. at switch[-1].reset='$reset'
set network. at switch[-1].enable_vlan='$enable'
EOF
}

ucidef_add_switch_vlan() {
        local device=$1
        local vlan=$2
        local ports=$3
        local device_name=$4
        uci batch <<EOF
set network.$4=switch_vlan
set network.$4.device='$device'
set network.$4.vlan='$vlan'
set network.$4.ports='$ports'

EOF
#add network switch_vlan
#set network.$device_name.device='$device'
#set network.$device_name.vlan='$vlan'
#set network.$device_name.ports='$ports'
}

ucidef_add_switch_port() {
        local device=$1
        local port=$2
        uci batch <<EOF
add network switch_port
set network. at switch_port[-1].device='$device'
set network. at switch_port[-1].port='$port'
EOF
}

And file:
./target/linux/ar71xx/base-files/etc/uci-defaults/02_network

ap121 |\
ap121-mini |\
ap96 |\
airrouter |\
dir-600-a1 |\
dir-615-c1 |\
dir-615-e1 |\
dir-615-e4 |\
hiwifi-hc6361 |\
ja76pf |\
mynet-n600 |\
oolite |\
rb-750 |\
rb-751 |\
tew-632brp |\
tew-712br |\
tl-mr3220 |\
tl-mr3220-v2 |\
tl-mr3420 |\
tl-wdr3500 |\
tl-wr741nd |\
tl-wr741nd-v4 |\
tl-wr841n-v7 |\
tl-wr841n-v9 |\
whr-g301n |\
whr-hp-g300n |\
whr-hp-gn |\
wzr-hp-ag300h)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth1 eth0.2"
        ucidef_add_switch "switch0" "1" "1"
        ucidef_add_switch_vlan "switch0" "1" "1 3 4 0t" "eth0_1"
        ucidef_add_switch_vlan "switch0" "2" "2 0t" "eth0_2"
        ;;

But in new trunk version I found those files but uci-defaults.sh uses json. 
Could you please lend me a hand?.

Would it be a great idea to build a custom package insted of modify the
“upstream” code?

Thanks in advance.

Best Regards,
Guillermo Nardoni.
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list