Compile swconfig for r64

(Frank W.) #1


i’m trying to compile swconfig for r64, but i’m stuck

i take source from openwrt (seems the only source for it):

and rewrote makefile

there are many type-mismatches and still some missing files…

is it compatible with kernel 4.19 or is it kernel-independed and needs only additional sources e.g. from

tried also to clone openwrt directly and build only swconfig/src

[16:26:47]$ make
Makefile:8: / No such file or directory
Makefile:16: / No such file or directory
Makefile:17: / No such file or directory
make: *** No rule to make target '/'.  Stop.
[16:26:50]$ cd 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

anyone has an idea?

(August) #2

Copy to /usr/include/linux/ on the build machine

(Frank W.) #3

same as after i copied id to local source:

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>

seems it requires libnl


i created include-dir in src and copied libnl-tiny/src/include/netlink to it…

[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>

i don’t find an uci.h in openwrt-source

(moore liu) #4

I’ll suggest …

  1. download openwrt 18.06 stable branch, and build image (it can boot to shell without network support)
  2. refer to below github to add missing network parts and enable swconfig in menuconfig

(Frank W.) #5

Isn’t there a way to compile sw-config outside openwrt? I want to use it in debian…

(moore liu) #6

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.

(Frank W.) #7

I only know dsa to configure separate ports and switchconfig…as there is no dsa-driver for r64 i tried to get swconfig working

(moore liu) #8

there is no need to enable DSA or swconfig tool, just use below code base with ifconfig command to enable ethernet, thanks.

notes: swconfig is advanced feature to help hou set vlan member, pvid…etc easily.

(Frank W.) #9

I have ethernet working, but lan-ports are 1 nic so i cannot configure them separately…currently it works like r2 with kernel 4.4

(moore liu) #10

I will suggest you can verify other parts first, and wait until new switch ic with DSA driver to meet your requirement. :wink:

(Frank W.) #11

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)