rfi
Posts: 3
Joined: Mon Feb 11, 2013 9:49 am

Changing MAC address passed to kernel

Mon Feb 11, 2013 9:58 am

Hi,

From the /var/log/kern.log it seems that the MAC address for the on-board LAN is set as a kernel parameter. However, it's not in /boot/config.txt.

We have our own OUI and would like to use it. I figure this kernel param is being set by the closed source broadcom code (start.elf or so). I see a few possibilities:

- Hack the Broadcom binaries (took a quick look in a hex editor and the kernel parameters were not obvious)
- Hack the smsc95x driver source and recompile
- Change the MAC address with a script in /etc/init.d (need to make sure this happens before any higher level networking initialization)

None of these seem particularly good.. does anyone have any other suggestions?

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Changing MAC address passed to kernel

Mon Feb 11, 2013 1:26 pm

rfi wrote:Hi,

- Change the MAC address with a script in /etc/init.d (need to make sure this happens before any higher level networking initialization)
That's probably your best option.
But I'd do it in the /etc/network/interfaces file
pre-up ifconfig eth0 hw ether 00:00:00:00:00:00
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5378
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Changing MAC address passed to kernel

Mon Feb 11, 2013 1:29 pm

If you include
smsc95xx.macaddr=B8:27:EB:59:EB:25
in your own cmdline.txt then start.elf won't set the default one.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Changing MAC address passed to kernel

Mon Feb 11, 2013 1:34 pm

dom wrote:If you include
smsc95xx.macaddr=B8:27:EB:59:EB:25
in your own cmdline.txt then start.elf won't set the default one.
Learn something new every day :D
Out of curiosity, is there any real use for doing that ?
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

rfi
Posts: 3
Joined: Mon Feb 11, 2013 9:49 am

Re: Changing MAC address passed to kernel

Tue Feb 12, 2013 1:19 am

Thanks for the replies - that's useful to know about the kernel parameter.

I was hoping to change just the vendor code and keep using the last three octets from the pi's serial number. It seems like that we could do that in our config script (which is already writing /etc/network/interfaces) using the pre-up option (I didn't know about that one). I guess that way the MAC address will be initialised before Linux sends any data including ARPs or DHCP requests?

Thanks for the help!

Return to “Raspbian”