[U-Boot] [PATCH v7 2/4] net: use common rand()/srand() functions

Joe Hershberger joe.hershberger at gmail.com
Thu May 31 21:08:17 CEST 2012


On Thu, May 31, 2012 at 2:04 PM, Joe Hershberger
<joe.hershberger at gmail.com> wrote:
> Hi Michael,
>
> On Thu, May 31, 2012 at 1:12 PM, Michael Walle <michael at walle.cc> wrote:
>> Replace rand() with the functions from lib/. The link-local network code
>> stores its own seed, derived from the MAC address. Thus making it
>> independent from calls to srand() in other modules.
>>
>> Signed-off-by: Michael Walle <michael at walle.cc>
>> Cc: Joe Hershberger <joe.hershberger at ni.com>
>> ---

>>  #define CONFIG_ETHADDR 08:00:06:00:00:00
>> diff --git a/net/Makefile b/net/Makefile
>> index 5264687..e7764ce 100644
>> --- a/net/Makefile
>> +++ b/net/Makefile
>> @@ -34,8 +34,6 @@ COBJS-$(CONFIG_CMD_DNS)  += dns.o
>>  COBJS-$(CONFIG_CMD_NET)  += eth.o
>>  COBJS-$(CONFIG_CMD_LINK_LOCAL) += link_local.o
>>  COBJS-$(CONFIG_CMD_NET)  += net.o
>> -COBJS-$(CONFIG_BOOTP_RANDOM_DELAY) += net_rand.o
>> -COBJS-$(CONFIG_CMD_LINK_LOCAL) += net_rand.o
>
> In the Makefile for lib/, mimic the implementation that you are
> removing here.  This way each user of CMD_LINK_LOCAL and
> BOOTP_RANDOM_DELAY aren't forced to also define RAND.  You can still
> also keep CONFIG_RAND for cases like your board where all you want is
> RAND.  Don't forget that you need to add a COBJS := $(sort $(COBJS-y))
> to the Makefile like this one in case more than one of the options is
> enabled for the same board.

Actually you could also add CONFIG_RANDOM_MACADDR in the same way.

>>  COBJS-$(CONFIG_CMD_NFS)  += nfs.o
>>  COBJS-$(CONFIG_CMD_PING) += ping.o
>>  COBJS-$(CONFIG_CMD_RARP) += rarp.o

Thanks,
-Joe


More information about the U-Boot mailing list