Skip to contentSkip to conversation

Changing Mac address

DISCUSSION Guillaume Dargaud 2 participants 2 messages Jul 28, 2008

lore
Share & tools
lore
#0 lore raw

Hello all,
there's something I miss here. I'd like to setup a MAC address in software at the start of the boot process. I'm trying to figure out where this is done in the kernel code. I'm on a custom variant of a Xilinx ML405 card, still in PPC arch.
So it appears to be going in the arch/ppc/boot/simple/embed_config.c piece of code, but since I don't have I2C, the only 'relevant' code is this one:

#if (!defined(CONFIG_XILINX_MLxxx) || !defined(XPAR_IIC_0_BASEADDR) || !defined(XPAR_PERSISTENT_0_IIC_0_BASEADDR)) int get_cfg_data(unsigned char **cfg_data) {
#warning I2C needed for obtaining the Ethernet MAC address. Using hard-coded MAC address
return 0; /* no cfg data found */
}

Nonetheless, ifconfig (from busybox) gives me a proper MAC address (00:0A:35:01:02:03) and can even change it:
ifconfig eth0 down hw ether 00:0A:35:01:02:10 up
But I want to do that before the network is up.

What is the relevant kernel section to change in order to set the MAC address ? Thanks.

Signature · 2 lines
Guillaume Dargaud
http://www.gdargaud.net/
#1 lore raw
Quoted 6 lines · Guillaume Dargaud

Hello all,
there's something I miss here. I'd like to setup a MAC address in software at the start of the boot process. I'm trying to figure out where this is done in the kernel code.
I'm on a custom variant of a Xilinx ML405 card, still in PPC arch. So it appears to be going in the arch/ppc/boot/simple/embed_config.c

Yes, this is the correct location to set it. Do whatever you need to set a different MAC address.

In arch/powerpc this all goes away and you can just set it in the device tree.

g.