[U-Boot] How to random my mac in u-boot

Peter Pan pppeterpppan at gmail.com
Mon Feb 8 13:46:17 CET 2010


Thank you very much. I will check their approach.

2010/2/8 Wolfgang Denk <wd at denx.de>:
> Dear Peter Pan,
>
> In message <48abf2c21002080330k285f07b2y8b55f978a28cd6f8 at mail.gmail.com> you wrote:
>> I understand what your mean. But we need to setup the boards' information
>> including the MAC address through ethernet. With the same MAC address,
>> only one board can be configured at a time, which is not efficient enough.
>
> There are many ways to install a MAC into your hardware -without
> hard-conding one into your image code.
>
>> Because of the quantity of the boards comparing with the number of workers,
>> we can not set the MAC address by hand. So what I means is to make the
>
> Of course you cannot do that. Keep in mind that you are _required_
> (and note that this is not an option, but a mandatory requirement) to
> provide a unique (!) MAC address with each piece of your hardware.
>
>> u-boot generate a temporarily random local-administration MAC and get the
>> correct information later.
>
> This is one option, but probably not a good one.
>
> How would you then know which board was provided what MAC? Typically
> you want to also put a sticker with the printed serial number, MAC
> address etc. on your hardware, i. e. there is some interaction with
> your production database needed, and you need to know exactly which
> board has been assigned which addresses. This prevents using "random"
> addresses.
>
>> May I know how other set their boards' MAC address. Is there any trick to
>> do this job.
>
> There are many different ways to do that. Just to give you one
> example: have a look at board/tqc/tqm8xx/load_sernum_ethaddr.c
> In this case, during production (when the software gets installed to
> flash), a special information block (containing among other things the
> board's unique serial number and MAC address) gets programmed to a
> special, otherwise unused location in flash. U-Boot will pick up the
> information there and auto-initialize the respective variables.
>
> I don't want to suggest that this is the optimal approach -  but it is
> one of the working solutions.
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> Randal said it would be tough to do in sed. He didn't say  he  didn't
> understand  sed.  Randal  understands sed quite well. Which is why he
> uses Perl. :-)         - Larry Wall in <7874 at jpl-devvax.JPL.NASA.GOV>
>


More information about the U-Boot mailing list