User avatar
pi3g
Authorised Reseller
Authorised Reseller
Posts: 147
Joined: Mon Nov 05, 2012 9:58 pm
Location: Germany
Contact: Website

Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sat Jan 19, 2019 9:08 pm

Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

@Raspberry Pi Foundation / Trading Ltd., I hope this is the appropriate forum to place the question:

Hi,

we're currently building a Raspberry Pi Compute Module based embedded solution - an industrial carrier board for the compute module, which will include the SMSC LAN 9512 USB Hub & Ethernet chip. It is built for a specific customer, but is going to be available on the broad market. Our goal is to make an affordable solution, which will have interesting industrial features like 24 V, etc. But I digress ...

I am wondering whether we need to acquire our own MAC address space from the IEEE, (and maybe design in an EEPROM for that), or whether we can use the Raspberry Pi provided & set MAC from the Raspberry Pi Foundation MAC pool b8:27:eb:...?

I understand the MAC is set by the Broadcom Firmware (start.elf).

Thank you for your feedback!
Max

P.S: If anyone is interested in the carrier board, please get in touch via https://pi3g.com/kontakt
picockpit.com - tools to make your life with the Pi a little bit easier

User avatar
DougieLawson
Posts: 39608
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sat Jan 19, 2019 9:15 pm

The mac address is not secure. You can easily spoof it.

There's also only 24-bits of uniqueness. First 24-bits are fixed. We've seen address wrap-around as there are already more than 16million pis out there in the wild and with a random assignment wrap-around occurred before the 16million were sold.

You can override it with the kernel cmdline.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

User avatar
pi3g
Authorised Reseller
Authorised Reseller
Posts: 147
Joined: Mon Nov 05, 2012 9:58 pm
Location: Germany
Contact: Website

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sat Jan 19, 2019 10:01 pm

Thank you, very insightful!

I'll look some more into it; at least a design-in of the EEPROM can't hurt, we can always simply not place it.
picockpit.com - tools to make your life with the Pi a little bit easier

incognitum
Posts: 504
Joined: Tue Oct 30, 2018 3:34 pm

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sun Jan 20, 2019 4:22 pm

DougieLawson wrote:
Sat Jan 19, 2019 9:15 pm
You can override it with the kernel cmdline.
Recall you can also program a custom MAC in OTP with the right config.txt option, if you want it more permanent.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1571
Joined: Sat Sep 10, 2011 11:43 am

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sun Jan 20, 2019 4:46 pm

Yes that's correct... program_mac_address is your friend..

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

User avatar
pi3g
Authorised Reseller
Authorised Reseller
Posts: 147
Joined: Mon Nov 05, 2012 9:58 pm
Location: Germany
Contact: Website

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sun Jan 20, 2019 5:46 pm

Thank you very much for the info about program_mac_address ! This sounds very promising.

@Gordon Could you please acknowledge that I am correct in understanding the following:

1) it is not necessary to set up an EEPROM to store a different MAC address in the Pi permanently
* in fact, if we implement such a EEPROM, we are on our own, as Raspberry Pi do not use one in their designs
2) the custom MAC address is set (for the SMSC LAN device) by
* adding to config.txt program_mac_address=xx:xx:xx:xx:xx:xx
* booting the pi, the MAC address will be saved to OTP fields 64/65
* then program_mac_address=xx:xx:xx:xx:xx:xx can be removed from config.txt
3) Once it has been set to the OTP fields, it can't be changed by specifying a different program_mac_address value (as these are one time programmable fields)
4) leaving program_mac_address=xx:xx:xx:xx:xx:xx inside config.txt would be OK as well, it does not need to be removed

I found these references:
picockpit.com - tools to make your life with the Pi a little bit easier

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1571
Joined: Sat Sep 10, 2011 11:43 am

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sun Jan 20, 2019 5:52 pm

1) it is not necessary to set up an EEPROM to store a different MAC address in the Pi permanently
* in fact, if we implement such a EEPROM, we are on our own, as Raspberry Pi do not use one in their designs
Correct
2) the custom MAC address is set (for the SMSC LAN device) by
* adding to config.txt program_mac_address=xx:xx:xx:xx:xx:xx
* booting the pi, the MAC address will be saved to OTP fields 64/65
* then program_mac_address=xx:xx:xx:xx:xx:xx can be removed from config.txt
Correct
3) Once it has been set to the OTP fields, it can't be changed by specifying a different program_mac_address value (as these are one time programmable fields)
Correct
4) leaving program_mac_address=xx:xx:xx:xx:xx:xx inside config.txt would be OK as well, it does not need to be removed
Correct

In the end the result of adding program_mac_address is as you say programming a couple of lines in the OTP. When start.elf boots, it reads these and if they are set adds the address to the device_tree.
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

User avatar
pi3g
Authorised Reseller
Authorised Reseller
Posts: 147
Joined: Mon Nov 05, 2012 9:58 pm
Location: Germany
Contact: Website

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Sun Jan 20, 2019 6:14 pm

Thank you! - Max
picockpit.com - tools to make your life with the Pi a little bit easier

Conner Labs
Posts: 49
Joined: Fri Jan 11, 2013 2:45 pm
Location: Glasgow
Contact: Website

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Thu Feb 28, 2019 4:52 pm

I designed a similar industrial board, but using TWO LAN9512s. I was unaware of the program_mac_address command (maybe it didn't even exist at the time I did the design?) but I found that EEPROMs worked fine.

I used to have to add a malformed MAC address to cmdline.txt to make the Raspberry Pi foundation's code choke on it and fall through to the code in the LAN95xx driver that reads the EEPROM. This doesn't seem to be needed any more in Jessie though.

But anyway, this thread has me wondering what the program_mac_address thing would do with the second LAN9512? Could I save an EEPROM by storing one of the MAC addresses in OTP? Or would it set them both the same, etc...

Steve

incognitum
Posts: 504
Joined: Tue Oct 30, 2018 3:34 pm

Re: Using Raspberry Pi MAC addresses for commercial products based on Compute Module?

Fri Mar 01, 2019 4:43 pm

Conner Labs wrote:
Thu Feb 28, 2019 4:52 pm
But anyway, this thread has me wondering what the program_mac_address thing would do with the second LAN9512? Could I save an EEPROM by storing one of the MAC addresses in OTP? Or would it set them both the same, etc...
Recall firmware sets the local-mac-address property of whatever device has been given the alias ethernet0 in device-tree.
Which with the default device-tree files would be the device at address usb1@1

Also wonder if perhaps you couldn't (ab)use the HAT ID EEPROM interface to specify the addresses for both with a single EEPROM.
Can't that be used to feed the system arbitrary device-tree overlays overriding things?!

Return to “Compute Module”