All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Generating random numbers
Date: Wed, 31 Aug 2011 21:15:53 +0200	[thread overview]
Message-ID: <20110831191553.D109E18C46FA@gemini.denx.de> (raw)
In-Reply-To: <CAAO=tycSJgHWdUvYrH5zecHM6L6F4KPeC8qyu8_PzZaCibN7Bw@mail.gmail.com>

Dear "elison.niven at gmail.com",

In message <CAAO=tycSJgHWdUvYrH5zecHM6L6F4KPeC8qyu8_PzZaCibN7Bw@mail.gmail.com> you wrote:
>
> How am I supposed to set the real MAC in the environment? Build
> separate images for each board? I do not want that.

Not that is finally a good question, and one where answering makes
sense again.

There are many ways, depending on how you organized the production
and/or testing of your boards.

If either of these steps includes to actually boot up U-Boot (for
example, to run some production test software etc.), then it is
usually tricial to use plain standard "env set" + "env save" commands
to set and store the MAC address - and probably the serial number
and/or other vital product data as well.

If you use any specific means to set the serial number of your board
(for example, but using a Silicon Serial Number chip or similar, you
should define a method to derive the MAC address from the serial
number.

If you are doing none of these, you may find other ways to write a
small block with the respective information into flash during your
hardware tests.  This is done on a number of boards.  See for example
function load_sernum_ethaddr() in "board/tqc/tqm8xx/load_sernum_ethaddr.c";
in this case, a small block of data gets written into a predefined
location of the NOR flash during the functional test of these boards,
using directly the PCB test probe.

If you are capable of booting from SDCard, it may be sufficient to
generate respective files (with the environment data) on your SDcards
that get loaded automatically at first boot (for example by using
PREBOOT settings; such a command can even delete itself from the
environment when done, so this is allows for one-time actions.

Of course, you can also pre-program your flashes before even fitting
the chips on the boards. There are programmers that support auto-
incrementing serial numbers or automatic insertion of data blocks
retrieved from some sort of production database.

etc. etc.

There is a zillion of methods to do what you want, you just have to
pick one that fits your board and your productions and test
environment best.  And any of these is way better than using random
MAC addresses.

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
What is mind?  No matter.  What is matter?  Never mind.
                                      -- Thomas Hewitt Key, 1799-1875

  reply	other threads:[~2011-08-31 19:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-29  5:02 [U-Boot] Generating random numbers elison.niven at gmail.com
2011-08-30 19:55 ` Wolfgang Denk
2011-08-30 20:10   ` elison.niven at gmail.com
2011-08-30 21:48     ` Albert ARIBAUD
2011-08-30 21:07   ` elison.niven at gmail.com
2011-08-31 16:54     ` elison.niven at gmail.com
2011-08-31 19:15       ` Wolfgang Denk [this message]
2011-08-31 21:55         ` Mike Frysinger
2011-09-01 14:00         ` elison.niven at gmail.com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110831191553.D109E18C46FA@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.