SMSC 95xx chips and MAC addresses
Keith Dunlop (214) 162 posts |
As some of you will know the USB/Ethernet chip used in the PandaBoard, BeagleBoard xM and the Raspberry Pi don’t come with hard coded MAC addresses. If you have more than one of these boards on your network running RISC OS all sorts of crazy things can happen. You need to manually set the machines MAC address by putting an obey file in predesk. The purpose of this thread is to discuss how best to manage the MAC addresses that I will be either buying a full range or tapping up one of the ex-RISC OS companies that have a range (after all I don’t think ROOL will need 16million entries, we’re only going to need a few hundred at best!). An idea that I have had is to somehow link it to your user account here on these forums which would then lead to a download of a skeleton !Boot folder containing the aforementioned obey file with the needed unique MAC address setting command for EtherUSB. Thoughts please? |
Steve Pampling (1551) 8172 posts |
Good idea. I was just contemplating cloning the MAC of a scrap NIC (I have more than a few I ought to ditch) Lets assume that half of the registered users on these forums will at some time have a machine that needs the facility. If we have that many beagle/panda/pandora/pi machines around it may need a rethink, but I doubt it will arise. |
Leo (448) 82 posts |
Don’t the boards themselves come with a MAC address already assigned to them? So isn’t it just a case of working out what that is (I know some STBs may come with it printed on them) and setting that up for RISC OS to use? I’ve checked my two RPi’s (in Linux) and they have different MAC addresses, so the information must be stored in there somewhere (With a Broadcom SoC I’d expect to see it towards the end of flash, although as there isn’t any flash that I’m aware of on the RPi it must be stored somewhere else. Does this chip support OTP?) |
Keith Dunlop (214) 162 posts |
Leo: Any ideas where the linux builds are getting their MAC addresses from? |
Steve Pampling (1551) 8172 posts |
Leo, try a reboot in Linux. neither decodes as a registered MAC in various on line look up systems, nor do the other MACs that randomly appear. |
Holger Palmroth (487) 115 posts |
According to this: Do we need to buy or nick offical allocated addresses at all? As long as we keep bit 1 of the first byte of the MAC address set to 1, we can use any MAC address that comes to our mind. At least, that’s my understandung of this wikipedia entry: |
Trevor Johnson (329) 1645 posts |
On the Raspberry Pi it’s supposed to be related to the serial number. I’ve not checked the BB mailing list. |
Tom Nicholls (266) 2 posts |
It seems that the Linux driver tries to read a MAC address from EEPROM. Failing that, it generates a random one. The latter approach doesn’t seem unreasonable: given the size of the space from which they could be generated, a clash is extremely unlikely. The following code is from Linux’s smsc95xx.c:
|
James Peacock (318) 129 posts |
There is already a function in EtherUSB to generate a consistent MAC address based on the machine’s unique ID, it didn’t get finished so it isn’t hooked in anywhere yet and hasn’t been tested. See net_default_mac() in net.c. You’ll see it takes a ‘unit’ argument to generate different MAC addresses for different devices. Originally this was to be the DCI unit number, but this can’t work as the it can depend on the MAC address via a system variable. This optional MAC → unit mapping is pretty much essential if you have multiple devices being plugged in and removed continuously, e.g. when testing EtherUSB. See the !ReadMe. I did wonder if using the numeric USB ‘address’ which DeviceFS provides. IIRC this is based on which USB port something is plugged into. I never got around to investigating this though. |
Leo (448) 82 posts |
Hmm, I’ll have to try that when I get home, although the number certainly looked similar to the last time I checked it (As I copied it for my RISC OS setup).
All the dev boards we get at work have MAC Addresses on them, so no reason why any other dev board wouldn’t. |
Chris Evans (457) 1614 posts |
Oops just seen Trevor has already quoted the thread I quote below! I extra piece of information is: Dom is part of the rpi foundation so knows what he’s talking about! Linux on the Raspberry Pi generates its MAC from the Pis serial no. In debian, boot up can show: The last 3 bytes of MAC address should match last 3 bytes of serial number. |