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

Mike Frysinger vapier at gentoo.org
Tue Feb 17 00:55:09 CET 2009


On Monday 16 February 2009 17:46:24 Wolfgang Denk wrote:
> In message Mike Frysinger 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....

looks correct to me ... the boards are moved from using the global data to 
using the environment

> > 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).

ok

> > -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.

yes, i broke the return value.  not that it would make a difference at runtime 
as nowhere was the return value actually checked/used.  fixed though, thanks.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090216/25976e62/attachment.pgp 


More information about the U-Boot mailing list