How does OpenWrt uses
ethaddr from
uboot?
Until now -for several years on a ZyXEL P-2812HNU-F1 device- I do set the mac-addresses manually in /etc/config/network with
wan_dev &
lan_dev configuration.
Actually the
ethaddr is set within first serial break into
uboot, but that value is NOT (ever) used by OpenWrt?
And I don't know why not.
When 2 (or more) devices without these wan_dev and lan_dev adjustment are used in 1 network, the most weird issues can occure.
As you have 2 devices with the same mac-address in 1 network (this is not what u want).
See:
/phpbb/viewtopic.php?p=241#p241
Now testing with
uboot-envtools on OpenWrt,
fw_printenv returns the right address (last line):
Code: Select all
addconsole=setenv bootargs $bootargs console=$consoledev,$baudrate
addeth=setenv bootargs $bootargs ethaddr=$ethaddr
addip=setenv bootargs $bootargs ip=$ipaddr:$serverip::::$netdev:off
addmachtype=setenv bootargs $bootargs machtype=P-2812HNU-Fx
baudrate=115200
bootcmd=run nboot
bootdelay=2
consoledev=ttyLTQ1
ethact=ltq-eth
ethaddr=B0:B2:DC:20:56:08
Only this is not used / or set by OpenWrt:
Code: Select all
# ifconfig | grep -e 'HWaddr'
br-lan Link encap:Ethernet HWaddr 00:11:22:33:44:55
eth0 Link encap:Ethernet HWaddr 00:11:22:33:44:55
eth0.1 Link encap:Ethernet HWaddr 00:11:22:33:44:55
eth0.2 Link encap:Ethernet HWaddr B0:B2:DC:20:56:0B
wlan0 Link encap:Ethernet HWaddr B0:B2:DC:20:56:0C
(eth0.2 & wlan0 are hard-coded)
eth0, eth0.1 & br-lan always get 00:11:22:33:44:55 as mac instead of the uboot ethaddr value.
Or you have to override this with the lan_dev configuration.
hexdump returns:
Code: Select all
/# hexdump /proc/device-tree/fpi@10000000/eth@e108000/interface@0/mac-address
0000000 0011 2233 4455
0000006
Found out that the ZyXEL P-2812HNU-F1 is not a DT (Device Tree) generic device, as my new Fritz!box 4040 is?
And on the 4040-boxes the mac-addresses are set as desired/required. (no
wan_dev or
lan_dev needed in /etc/config/network)
For now on the P-2812HNU-F1 boxes location: Where -in the build process?- is the pointing to
ethaddr as real value of eth0?
It's not the right one, I presume.
P-2812HNU-F1:
Code: Select all
/# cat /proc/cpuinfo
system type : xRX200 rev 1.1
machine : ZyXEL P-2812HNU-F1
processor : 0
cpu model : MIPS 34Kc V5.5
BogoMIPS : 332.54
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16 dsp mt
Options implemented : tlb 4kex 4k_cache prefetch mcheck ejtag llsc dc_aliases userlocal vint perf_cntr_intr_bit nan_legacy nan_2008 perf
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VPE : 0
VCED exceptions : not available
VCEI exceptions : not available
processor : 1
cpu model : MIPS 34Kc V5.5
BogoMIPS : 333.82
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16 dsp mt
Options implemented : tlb 4kex 4k_cache prefetch mcheck ejtag llsc dc_aliases userlocal vint perf_cntr_intr_bit nan_legacy nan_2008 perf
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VPE : 1
VCED exceptions : not available
VCEI exceptions : not available
Fritz!box4040:
Code: Select all
# cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 30.37
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
processor : 1
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 30.37
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
processor : 2
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 30.37
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
processor : 3
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 30.37
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
Hardware : Generic DT based system
Revision : 0000
Serial : 0000000000000000
And the right mac addresses for the 4040-box (in double-word configuration!):
Code: Select all
# find /proc/device-tree/ -name "*mac-address"
/proc/device-tree/soc/edma@c080000/gmac0/local-mac-address
/proc/device-tree/soc/edma@c080000/gmac1/local-mac-address
root@OpenWrt:/# hexdump /proc/device-tree/soc/edma@c080000/gmac0/local-mac-address
0000000 3a2c 23fd ae14
0000006
root@OpenWrt:/# hexdump /proc/device-tree/soc/edma@c080000/gmac1/local-mac-address
0000000 3a2c 23fd af14
0000006
As
ifconfig shows on the 4040-box:
Code: Select all
/# ifconfig | grep -e 'HWaddr'
br-lan Link encap:Ethernet HWaddr 2C:3A:FD:23:14:AE
eth0 Link encap:Ethernet HWaddr 2C:3A:FD:23:14:AE
eth1 Link encap:Ethernet HWaddr 2C:3A:FD:23:14:AF
DG.