Purpose and logic of /etc/board.json or /tmp/board.json

In my changwang-cw56-58 x86-64-based board i have obtained default

root@ice_nas_new:~# cat /tmp/board.json
{
"model": {
"id": "changwang-cw56-58",
"name": "ChangWang CW56-58"
},
"network": {
"lan": {
"device": "eth0",
"protocol": "static"
},
"wan": {
"device": "eth1",
"protocol": "dhcp"
}
}
}

and it rather meaningles there while system could create properly all for ethernet interfaces

[ 5.606606] igc 0000:01:00.0 eth0: MAC: 1c:83:41:33:ae:ef
[ 5.706001] igc 0000:02:00.0 eth1: MAC: 1c:83:41:33:ae:f0
[ 5.805852] igc 0000:03:00.0 eth2: MAC: 1c:83:41:33:ae:f1
[ 5.906711] igc 0000:04:00.0 eth3: MAC: 1c:83:41:33:ae:f2

root@ice_nas_new:~# ls -la /sys/class/net | grep eth
lrwxrwxrwx 1 root root 0 Dec 31 13:22 eth0 -> ../../devices/pci0000:00/0000:00:01.3/0000:01:00.0/net/eth0
lrwxrwxrwx 1 root root 0 Dec 31 13:22 eth1 -> ../../devices/pci0000:00/0000:00:02.1/0000:02:00.0/net/eth1
lrwxrwxrwx 1 root root 0 Dec 31 13:22 eth2 -> ../../devices/pci0000:00/0000:00:02.2/0000:03:00.0/net/eth2
lrwxrwxrwx 1 root root 0 Dec 31 13:22 eth3 -> ../../devices/pci0000:00/0000:00:02.3/0000:04:00.0/net/eth3

Once i upgrade /etc/board.d/02_network to something meaninglful like

changwang-cw56-58)

ucidef_set_network_device_path "eth0" "pci0000:00/0000:00:01.3/0000:02:00.0"

ucidef_set_network_device_path "eth1" "pci0000:00/0000:00:02.1/0000:03:00.0"

ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:02.2/0000:04:00.0"

ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:02.3/0000:05:00.0"

ucidef_set_interfaces_lan_wan "eth1 eth2 eth3" "eth0"

;;

related to my board and obtained /tmp/board.json like:

{
"model": {
"id": "changwang-cw56-58",
"name": "ChangWang CW56-58"
},
"network_device": {
"eth0": {
"path": "pci0000:00/0000:00:01.3/0000:02:00.0"
},
"eth1": {
"path": "pci0000:00/0000:00:02.1/0000:03:00.0"
},
"eth2": {
"path": "pci0000:00/0000:00:02.2/0000:04:00.0"
},
"eth3": {
"path": "pci0000:00/0000:00:02.3/0000:05:00.0"
}
},
"network": {
"lan": {
"ports": [
"eth1",
"eth2",
"eth3"
],
"protocol": "static"
},
"wan": {
"device": "eth0",
"protocol": "dhcp"
}
}
}

system refuses it in next way:

[ 6.261351] igc 0000:01:00.0 eth0: MAC: 1c:83:41:33:ae:ef
[ 6.371562] igc 0000:02:00.0 eth1: MAC: 1c:83:41:33:ae:f0
[ 6.480844] igc 0000:03:00.0 eth2: MAC: 1c:83:41:33:ae:f1
[ 6.588947] igc 0000:04:00.0 eth3: MAC: 1c:83:41:33:ae:f2
[ 6.737021] igc 0000:01:00.0 eth4: renamed from eth0
[ 6.748247] igc 0000:02:00.0 eth5: renamed from eth1
[ 6.759857] igc 0000:03:00.0 eth6: renamed from eth2
[ 6.770728] igc 0000:04:00.0 eth7: renamed from eth3

and in sys classes net:

lrwxrwxrwx 1 root root 0 Dec 31 13:04 eth4 -> ../../devices/pci0000:00/0000:00:01.3/0000:01:00.0/net/eth4
lrwxrwxrwx 1 root root 0 Dec 31 13:04 eth5 -> ../../devices/pci0000:00/0000:00:02.1/0000:02:00.0/net/eth5
lrwxrwxrwx 1 root root 0 Dec 31 13:04 eth6 -> ../../devices/pci0000:00/0000:00:02.2/0000:03:00.0/net/eth6
lrwxrwxrwx 1 root root 0 Dec 31 13:04 eth7 -> ../../devices/pci0000:00/0000:00:02.3/0000:04:00.0/net/eth7

So, how it works, whats purpose and and how to get proper meaningful board.json without renamings of interfaces?

during adding this post i found error in pci adresses. Fixed it and obtained more proper json like:

{
"model": {
"id": "changwang-cw56-58",
"name": "ChangWang CW56-58"
},
"network_device": {
"eth0": {
"path": "pci0000:00/0000:00:01.3/0000:01:00.0"
},
"eth1": {
"path": "pci0000:00/0000:00:02.1/0000:02:00.0"
},
"eth2": {
"path": "pci0000:00/0000:00:02.2/0000:03:00.0"
},
"eth3": {
"path": "pci0000:00/0000:00:02.3/0000:04:00.0"
}
},
"network": {
"lan": {
"ports": [
"eth1",
"eth2",
"eth3"
],
"protocol": "static"
},
"wan": {
"device": "eth0",
"protocol": "dhcp"
}
}
}

and it works as expected, however went through step of double renamings:

[ 5.656443] igc 0000:01:00.0 eth0: MAC: 1c:83:41:33:ae:ef
[ 5.756528] igc 0000:02:00.0 eth1: MAC: 1c:83:41:33:ae:f0
[ 5.857057] igc 0000:03:00.0 eth2: MAC: 1c:83:41:33:ae:f1
[ 5.956868] igc 0000:04:00.0 eth3: MAC: 1c:83:41:33:ae:f2
[ 6.099936] igc 0000:01:00.0 eth4: renamed from eth0
[ 6.107371] igc 0000:02:00.0 eth5: renamed from eth1
[ 6.114541] igc 0000:03:00.0 eth6: renamed from eth2
[ 6.121764] igc 0000:04:00.0 eth7: renamed from eth3
[ 6.130463] igc 0000:01:00.0 eth0: renamed from eth4
[ 6.138525] igc 0000:02:00.0 eth1: renamed from eth5
[ 6.146843] igc 0000:03:00.0 eth2: renamed from eth6
[ 6.155329] igc 0000:04:00.0 eth3: renamed from eth7

Then you might need to skip the PCI paths, not sure they're required - CloudGenix ion 2000 correct port assignments - #4 by frollic.

OK. But is this config something mandatory or is it just fallback of other default kernel/whatever process?

it's not, it's only assigning the ports.
by default only two will be used, one for wan and one for lan.