mtk official openwrt method to modify switch
On the newly made board, P0 is set as the WAN port. After programming the firmware, the wan port has been unable to obtain an IP address; it
is useless to configure the switch in /etc/config/network.
【The final solution】
Modify # work for 7620 and 7621 in package/ramips/applications/switch/files/switch.sh
to WLLLL or LLLLW according to your own situation.
setup_switch()
{ # config6855Esw LLLLW config6855Esw WLLLL }
Or
modify it in package/ramips/applications/switch/files/switch-7621.sh
setup_switch()
{
echo "7621 use an independent gmac as lan, LLLLW"
restore6855Esw
config6855Esw LLLLW
}
reset_switch()
{
echo "7621 use an independent gmac as lan & wan"
restore6855Esw
}
Note:
1) If you set p0 as wan port, you don’t need make kernel_menuconfig to change the switch to WLLLL;
Even if it is LLLLW partition, after modifying "config6855Esw WLLLL" according to the previous method, the wan port can work normally.
[ 16.940000] change HW-TRAP to 0x17ccd
[ 16.944000] set LAN/WAN LLLLW
In addition: you can see that the setup_switch() function will be called when /etc/init.t/network start/restart;
package/network/config/netifd/files/etc/init.d/network
init_switch() {
setup_switch() { return 0; }
include /lib/network
setup_switch
}
start_service() {
init_switch
procd_open_instance
procd_set_param command /sbin/netifd
procd_set_param respawn
procd_set_param watch network.interface
[ -e /proc/sys/kernel/core_pattern ] && {
procd_set_param limits core="unlimited"
echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
}
procd_close_instance
}
reload_service() {
init_switch
ubus call network reload
/sbin/wifi reload_legacy
}
2) If you want to set it to other switch modes, such as multiple wan ports, you should refer to the relevant functions in source\user\rt2880_app\scripts\config_vlan.sh in the native sdk.