I was wondering if someone could help me, you will have to excuse my ignorance!
I am trying to build a custom image for the Netgear DM200 which is based on the lantiq chips. I have managed this find and everything appeared to be ok but I noticed that every time I rebooted the MAC address was changing.
[ 0.964611] libphy: lantiq,xrx200-mdio: probed
[ 0.968743] net-xrx200: invalid MAC, using random
I spent all day trying to find the reason for this but I am really struggling. I found various patches from 2014 and earlier that suggest they fix this but I have no idea if they are part of the stable release or not?
Does anyone know where to begin looking at this? Can I some how change something as part of the build environment to point to the correct mtd location?
I know the MAC address is there it just can't seem to read it?
root@OpenWrt:~# hexdump -C /dev/mtd8 -s 0x1fe00 | head -n 1
00000000 3c 37 86 09 ce d4 3c 37 86 09 ce d5 ff ff ff ff
You can't really change the DTB (compiled DTS) with raw editing.
The first-time build of the tool chain will take 15-40 minutes, depending on your CPU (the latter numbers are for a US$150-class SBC with a J4105 CPU). It seldom needs to be rebuilt. The first-time build of a full image (with, for example LuCI, nginx, OpenSSL) around 10-30 minutes. If you enable ccache under developer options (do this before your first build), subsequent rebuilds typically run 4-8 minutes, even adding a few packages.
No "ignorance" on your part, I only know of this kind of thing from porting a couple of devices. That's the kind of thing I'd try myself. I don't know about the Lantiq drivers (or if reg = <0>; is required), but that would be the first thing I'd try.
The next would be to go with extracting and setting the MAC address in
So a bit of background. I’m trying to build an image that will potentially be used by hundreds of these devices in an ISP environment rather than a single device otherwise I would go with that work around. I’m a network engineer rather than a coder, hence all the questions
I guess I could write something that set this on first boot in the config but would rather something persistent / more permanent if that makes sense. Something that actually is native to the OS/kernel rather than a script written by me.
I guess I’ll try editing those files / understand how device trees work and see if I can get it to map to the correct MAC in the MTD if no one else chimes in
Failing that, I’ll write something that does it on first boot and then kills itself. At least then I don’t have to manually configure the MAC on every device I build!
I will try get a build environment set up, I'll be very surprised if just adding that works but worth a shot! Is there any documentation on how the DTS works, what is mtd-mac-address is this just a variable or something that is standard and known? I guess something must hook into that to actually use it?
So I've managed to get a build environment working. I've made the changes to the DTS faile and 02_Network to no avail.
Trawling through some of the files / scripts I have seen some includes to some libraries which include the functions I think the DTS is referring to, such as mtd_get_mac_binary(), they seem to be in /lib/functions/system.sh
I have gone through these and it looks like ultimately it calls hexdump. I have manually done this using the same syntax as whats in these functions and passed in the offset 00 rather than 0x16 and specified /dev/mtd8 which is the ART partition and it appears to work perfectly:
Does anyone know how this is called and what gets passed to these functions? I can only think the wrong offset is being passed through. I am just in the middle of recompiling now I have updated mtd-mac-address = <&boardconfig 0x16>; to mtd-mac-address = <&boardconfig 0x0>; But not sure if this will achieve what I am looking for.
I could be barking up the wrong tree entirely. Does anyone know how to debug the dts on boot? For example rather than saying invalid mac address in dmesg can I somehow dump what it has parsed to come to that conclusion?
Ha! Don't believe it! That's fixed it! Just tested the latest compile.
Adding in the mtd-mac-address and changing the offset to 0 worked perfectly! Now I guess, how does that get added / fixed permanently in the stable builds, or is it not something that would get included?