tried also to clone openwrt directly and build only swconfig/src
frank@frank-N56VZ:/media/data_ext/openwrt/package/network/config/swconfig
[16:26:47]$ make
Makefile:8: /rules.mk: No such file or directory
Makefile:16: /package.mk: No such file or directory
Makefile:17: /kernel.mk: No such file or directory
make: *** No rule to make target '/kernel.mk'. Stop.
frank@frank-N56VZ:/media/data_ext/openwrt/package/network/config/swconfig
[16:26:50]$ cd src
frank@frank-N56VZ:/media/data_ext/openwrt/package/network/config/swconfig/src
[16:27:06]$ make
cc -O2 -g -I ../src -fPIC -c -o swlib.o swlib.c
swlib.c:26:10: fatal error: linux/switch.h: No such file or directory
#include <linux/switch.h>
^~~~~~~~~~~~~~~~
compilation terminated.
Makefile:9: recipe for target 'swlib.o' failed
make: *** [swlib.o] Error 1
cc -O2 -g -I ../src -fPIC -c -o swlib.o swlib.c
In file included from swlib.c:26:0:
/usr/include/linux/switch.h:25:10: fatal error: netlink/netlink.h: No such file or directory
#include <netlink/netlink.h>
^~~~~~~~~~~~~~~~~~~
i created include-dir in src and copied libnl-tiny/src/include/netlink to it…
frank@frank-N56VZ:/media/data_ext/openwrt/package/network/config/swconfig/src
[16:53:14]$ CFLAGS=-Iinclude make
cc -Iinclude -fPIC -c -o swlib.o swlib.c
In file included from include/netlink/genl/genl.h:16:0,
from /usr/include/linux/switch.h:26,
from swlib.c:26:
include/netlink/msg.h:52:16: error: field 'nm_creds' has incomplete type
struct ucred nm_creds;
^~~~~~~~
include/netlink/msg.h: In function 'nlmsg_set_creds':
include/netlink/msg.h:207:39: error: dereferencing pointer to incomplete type 'struct ucred'
memcpy(&msg->nm_creds, creds, sizeof(*creds));
^~~~~~
it seems that “struct ucred;” is only forward-declared in msg.h but nowhere declared with fields
tried to build it like this (only with crosscompiler, currently arm-linux-gnueabihf-gcc):
but make in swconfig failes on
make: libsw.a: Command not found
libsw.a exists in swconfig/src
currently hang here:
cli.c:26:10: fatal error: uci.h: No such file or directory
#include <uci.h>
^~~~~~~
swconfig / uci are openwrt proprietary way to configure device, it needs patch kernel and prepare related library/app as well. I will suggest you use normal way to configure network in debian.
wifi-driver is actually not compilable with gcc >6 so i’m stuck here (tried to compile full r64-bsp-repo on ubuntu 18.4 with all available gcc cross-compilers, on ubuntu 14.4 it works)
@moore, I built openwrt 18.06 stable branch but “swconfig list” does not see switch. Kernel has driver as I can see switch logs (List 1). Could you say what is a problem?
root@OpenWrt:/# swconfig
swconfig list
swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show)
root@OpenWrt:/#
root@OpenWrt:/# swconfig list
root@OpenWrt:/#
root@OpenWrt:/# uname -a
Linux OpenWrt 4.19.76 #0 SMP Sun Oct 6 20:42:30 2019 aarch64 GNU/Linux
root@OpenWrt:/# cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='SNAPSHOT'
DISTRIB_REVISION='r11167-273a6cb'
DISTRIB_TARGET='mediatek/mt7622'
DISTRIB_ARCH='aarch64_cortex-a53'
DISTRIB_DESCRIPTION='OpenWrt SNAPSHOT r11167-273a6cb'
DISTRIB_TAINTS='no-all'
root@OpenWrt:/# cat /etc/openwrt_version
r11167-273a6cb
List 1
[ 1.749439] mt753x gsw@0: LAN/WAN VLAN setting=wllll
[ 1.755031] mt753x gsw@0: Switch is MediaTek MT7531BE rev 0
[ 4.444568] mt753x gsw@0: >>>>>>>>>>>>>>>>>>>>>>>>>>>>> START CALIBRATION:
[ 4.453661] mt753x gsw@0: -------- gephy-calbration (port:0) --------
[ 4.476896] CALDLY = 40
[ 4.822980] GE Rext AnaCal Saturation!
[ 4.827197] GE Rxet cal something wrong2
[ 5.117938] GE R50 AnaCal Saturation!
[ 5.122076] GE R50 AnaCal Done! (32) (0x0)(0x80)
[ 5.404892] GE R50 AnaCal Saturation!
[ 5.409020] GE R50 AnaCal Done! (32) (0x0)(0x80)
[ 5.691807] GE R50 AnaCal Saturation!
[ 5.695936] GE R50 AnaCal Done! (32) (0x0)(0x80)
[ 5.978759] GE R50 AnaCal Saturation!
[ 5.982897] GE R50 AnaCal Done! (32) (0x0)(0x80)
[ 5.993140] GE 1e_174(0x8080), 1e_175(0x8080)
[ 6.064762] GE Tx offset AnaCal Done! (pair-0)(3)(0x22) 0x1e_172=0x2220
[ 6.120677] GE Tx offset AnaCal Done! (pair-1)(4)(0x23) 0x1e_172=0x2223
[ 6.168419] GE Tx offset AnaCal Done! (pair-2)(3)(0x22) 0x1e_173=0x2220
[ 6.224329] GE Tx offset AnaCal Done! (pair-3)(4)(0x23) 0x1e_173=0x2223
[ 6.332597] GE Tx amp AnaCal Done! (pair-0)(1e_12 = 0x5415)
[ 6.416871] GE Tx amp AnaCal Done! (pair-1)(1e_17 = 0x1313)
[ 6.507328] GE Tx amp AnaCal Done! (pair-2)(1e_19 = 0x1b23)
[ 6.618115] GE Tx amp AnaCal Done! (pair-3)(1e_21 = 0x1018)
.....
[ 619.913583] mt753x gsw@0: Port 0 Link is Down
[ 623.824121] mt753x gsw@0: Port 0 Link is Up - 100Mbps/Full
I found vlan set up via swconfig on the ethernet port as untagged works as port-based vlan. Means ports can be separated each other like at List 2. So if vlans are port-based, every portX can be used independently (for example List 2a)
List 2 (Make LAN ports separated each other)
root@client1:~# swconfig dev switch0 vlan 1 set ports ''
root@client1:~# swconfig dev switch0 vlan 11 set vid 11
root@client1:~# swconfig dev switch0 vlan 11 set ports '1 6t'
root@client1:~# swconfig dev switch0 vlan 12 set vid 12
root@client1:~# swconfig dev switch0 vlan 12 set ports '2 6t'
root@client1:~# swconfig dev switch0 vlan 13 set vid 13
root@client1:~# swconfig dev switch0 vlan 13 set ports '3 6t'
root@client1:~# swconfig dev switch0 vlan 14 set vid 14
root@client1:~# swconfig dev switch0 vlan 14 set ports '4 6t'
root@client1:~# swconfig dev switch0 set apply
root@client1:~# swconfig dev switch0 show
...
VLAN 2:
vid: 2
ports: 0 5
VLAN 11:
vid: 11
ports: 1 6t
VLAN 12:
vid: 12
ports: 2 6t
VLAN 13:
vid: 13
ports: 3 6t
VLAN 14:
vid: 14
ports: 4 6t
root@client1:~# ip link add link eth0 name port1 type vlan id 11
root@client1:~# ip link add link eth0 name port2 type vlan id 12
root@client1:~# ip link add link eth0 name port3 type vlan id 13
root@client1:~# ip link add link eth0 name port4 type vlan id 14
root@client1:~# for i in 1 2 3 4; do ip link set port$i up; done
List 2a
root@client1:~# ip link add link port1 name port1-100 type vlan id 100
root@client1:~# ip link add link port2 name port2-100 type vlan id 100
root@client1:~# ip link set port1-100 up; ip link set port2-100 up
root@client1:~# ip link
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc fq_codel master ovs-system state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff
...
22: port1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff
23: port2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff
24: port3@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff
25: port4@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff
26: port1-100@port1: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff
27: port2-100@port2: <BROADCAST,MULTICAST,UP,LOWER_UP,80000> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 62:8b:b1:46:89:4a brd ff:ff:ff:ff:ff:ff