[U-Boot] [PATCHv1 0/3] Retrieve MAC address from EEPROM
Olliver Schinagl
oliver+list at schinagl.nl
Mon Nov 30 17:50:10 CET 2015
From: Olliver Schinagl <o.schinagl at ultimaker.com>
This patch-series introduces methods to retrieve the MAC address from an
onboard EEPROM. I know there is probably a thing or two that might needed
to be changed to make the concept apply in a more generic way.
The reason we might want to read the MAC address from an EEPROM instead of
storing the entire environment is mostly a size thing. Our default environment
already is bigger then the EEPROM so it is understandable that someone might
not give up the entire eeprom just for the u-boot environment. Especially if
only board specific things might be stored in the eeprom (MAC, serial, product
number etc).
The current idea of the eeprom layout, is to skip the first 8 bytes, so that
other information can be stored there if needed, for example a header with some
magic to identify the EEPROM. Or equivalent purposes.
After those 8 bytes the MAC address follows and identifier byte to indicate the
interface the MAC is applicable too, 0x00 - 0xFE to indicate ethernet interface
0 to 254. 0xFF has special meaning that it does not matter. This bit
(no pun intended) is where I am not sure it should be in here at all, but it
seemed more logical than simple order based. For example, if there are 2
ethernet devices on a board, eth0 being an internal device, and eth1 being an
external facing device and only 1 MAC address per device is allotted, it can
seem logical that eth1 gets the MAC address and eth0 gets a randomly chosen MAC
address (or whatever the fall back behavior is).
These 7 bytes are then appended with a CRC8 byte and can be optionally checked,
although the whole optional-ness could be very well dropped.
Hans de Goede and I talked about retrieving the MAC from the EEPROM for sunxi
based boards a while ago, but hopefully this patch makes possible to have
something slightly more generic, even if only the configuration option and the
EEPROM layout.
Since the Olimex OLinuXino sunxi boards all seem to have an eeprom, I started
my work on one of these and tested the implementation with one of our own real
MAC addresses.
Features planned for v2, simple tool to write the MAC address to the eeprom
from Linux.
Olliver Schinagl (3):
net: Add ability to set MAC address via EEPROM to Kconfig
sunxi: net: Allow the sunxi to set the MAC from an EEPROM
sunxi: net: Enable eeprom on OLinuXino Lime2 boards
board/sunxi/Kconfig | 4 +++
board/sunxi/board.c | 36 +++++++++++++++++++++
configs/A20-OLinuXino-Lime2_defconfig | 3 ++
doc/README.enetaddr | 36 +++++++++++++++++++++
net/Kconfig | 59 +++++++++++++++++++++++++++++++++++
5 files changed, 138 insertions(+)
--
2.6.2
More information about the U-Boot
mailing list