Skip to contentSkip to conversation

Transfer MAC address from u-boot to Linux kernel

U-Boot-Users Robert Schwebel 3 participants 5 messages Jan 28, 2003 – Jan 29, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I'm wondering what the "correct" way to export a MAC address from u-boot to a Linux kernel. No official driver but the au1000_eth one seems to have support for a "ethaddr=" command line parameter, and I think this does only work with "ethaddr=" being on the kernel commandline, not in the u-boot environment.

How is this intended to work?

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#1 lore raw
Quoted 7 lines · Robert Schwebel

I'm wondering what the "correct" way to export a MAC address from u-boot to a Linux kernel. No official driver but the au1000_eth one seems to have support for a "ethaddr=" command line parameter, and I think this does only work with "ethaddr=" being on the kernel commandline, not in the u-boot environment.

How is this intended to work?

As usual, it depends. On PPCs for example, the bd_info structure is passed into the kernel, and drivers can access the MAC address from there. The right way to do it on ARM would probably be to define a corresponding tag.

There are also patches to access the U-Boot environment right in the flash using MTD.

Regards,
Marius

-----------------------------------------------------------------------------

Marius Groeger           SYSGO Real-Time Solutions AG       mgroeger at sysgo.de
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com
#2 lore raw

Hi Marius,

Quoted 4 lines · Marius Groeger

As usual, it depends. On PPCs for example, the bd_info structure is passed into the kernel, and drivers can access the MAC address from there. The right way to do it on ARM would probably be to define a corresponding tag.

Hmm. That's not very generic, which means that the drivers have to be architecture dependend as well, and that's bad.

Quoted 2 lines

There are also patches to access the U-Boot environment right in the flash using MTD.

In my case the environment is in a serial EEPROM. I've seen a patch from Bernhard Kuhn who has implemented a bootenv userspace command (also for flash). Looks saner to me, although this means that one wouldn't have the MAC address available if the kernel tried to make a dhcp request during IP autoconfiguration. But as the whole in-kernel autoconfig stuff seems to go away with the approach of early user space as well it might be an idea to do all that stuff from user space.

Anyway, thanks for the ideas.

Robert

Signature · 5 lines
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Braunschweiger Str. 79,  31134 Hildesheim, Germany
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
#3 lore raw
Quoted 8 lines · Robert Schwebel
Quoted 4 lines · Marius Groeger

As usual, it depends. On PPCs for example, the bd_info structure is passed into the kernel, and drivers can access the MAC address from there. The right way to do it on ARM would probably be to define a corresponding tag.

Hmm. That's not very generic, which means that the drivers have to be architecture dependend as well, and that's bad.

Absolutely. One of the biggest shortcomings of Linux is the lack of having such things properly defined as a BSP layer across all the platforms. But then again, obtaining the MAC address IS highly platform dependent. Asking the boot-loader is just one way. There even are many boards that can boot off various boot-loaders. I don't believe that is ever going to be resolved cleanly.

Regards
Marius

-----------------------------------------------------------------------------

Marius Groeger           SYSGO Real-Time Solutions AG       mgroeger at sysgo.de
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com
#4 lore raw
In reply to Robert Schwebel
Quoted 2 lines

I'm wondering what the "correct" way to export a MAC address from u-boot to a Linux kernel.

Does it work for you to NOT pass the MAC address?

Instead, get the MAC from your serial configuration prom and program your ethernet chip accordingly. Later Linux boots and the network driver get's the MAC as usual from the chip.

This is at least a possible approach for the SMC91111.