[U-Boot] [PATCH 10/27] boards: get mac address from environment

Wolfgang Denk wd at denx.de
Mon Feb 16 23:46:24 CET 2009


Dear Mike Frysinger,

In message <1234596190-524-11-git-send-email-vapier at gentoo.org> you wrote:
> The boards that get converted here to use the environment for the mac
> address rather than global data:

Hmm... is this commit message correct? Makes little sense to me....

> diff --git a/board/etin/debris/debris.c b/board/etin/debris/debris.c
> index 227c49a..3dec7cc 100644
> --- a/board/etin/debris/debris.c
> +++ b/board/etin/debris/debris.c
> @@ -174,8 +174,10 @@ void nvram_write(long dest, const void *src, size_t count)
>  int misc_init_r(void)
>  {
>  	/* Write ethernet addr in NVRAM for VxWorks */
> -	nvram_write(CONFIG_ENV_ADDR + CONFIG_SYS_NVRAM_VXWORKS_OFFS,
> -			(char*)&gd->bd->bi_enetaddr[0], 6);
> +	uchar ethaddr[6];
> +	if (eth_getenv_enetaddr("ethaddr", ethaddr))

Please move declaration above comment (and add an empty line).

...
> -static int get_mac_address (int id, u8 * mac, char *string, int size)
> +static int get_mac_address (int id, u8 *mac)
>  {
> -	if (size < 6 * 3)
> -		return -1;
> -
>  	i2155x_read_vpd (I2155X_VPD_MAC0_START + 6 * id, 6, mac);
> -	return sprintf (string, "%02x:%02x:%02x:%02x:%02x:%02x",
> -				mac[0], mac[1], mac[2],
> -				mac[3], mac[4], mac[5]);
>  }

This one looks broken to me. At least it returns random data.


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
ADVISORY:  There is  an  Extremely Small  but  Nonzero  Chance  That,
Through a Process Know as "Tunneling," This Product May Spontaneously
Disappear  from Its Present Location and Reappear at Any Random Place
in the Universe, Including Your Neighbor's Domicile. The Manufacturer
Will Not Be Responsible for Any Damages  or  Inconvenience  That  May
Result.


More information about the U-Boot mailing list