2010-07-12 17:30:35     gethostid() unique?

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-07-12 17:30:35     gethostid() unique?

Daniel Tripp (UNITED STATES)

Message: 91177   

 

Is gethostid() unique for each Blackfin system? If not, is there a better way for getting a unique identifier for each Blackfin CPU?

QuoteReplyEditDelete

 

 

2010-07-13 02:04:29     Re: gethostid() unique?

Sonic Zhang (CHINA)

Message: 91182   

 

There is no gethostid() for blackfin linux. If you want to read the cpu id and revision, you should call bfin_cpuid() and bfin_revid().

 

In addition, what do you mean "each blackfin system"? If it refers to bf533, bf537, bf527, etc, yes it is unique.

QuoteReplyEditDelete

 

 

2010-07-13 02:09:51     Re: gethostid() unique?

Sonic Zhang (CHINA)

Message: 91183   

 

Sorry, didn't figure out you want to get the id from user space.

 

You can check the cpuid and revid by "cat /proc/cpuinfo".

QuoteReplyEditDelete

 

 

2010-07-13 13:36:26     Re: gethostid() unique?

Mike Frysinger (UNITED STATES)

Message: 91204   

 

only BF54x and BF52x provide cpu-unique IDs in their OTP pages (review the HRM for more details).  no other processor does so you'll have to figure out a unique ID system on your end.

QuoteReplyEditDelete

 

 

2010-07-13 13:57:44     Re: gethostid() unique?

Robin Getz (UNITED STATES)

Message: 91207   

 

Daniel:

 

We may be able to help better if we really understood what you were trying to do.

 

If you want to return a unique ID - gethostid() isn't going to work all the time...

 

In the uClibc/libc/inet/hostid.c

 

        /* Try some methods of returning a unique 32 bit id. Clearly IP

         * numbers, if on the internet, will have a unique address. If they

         * are not on the internet then we can return 0 which means they should

         * really set this number via a sethostid() call. If their hostname

         * returns the loopback number (i.e. if they have put their hostname

         * in the /etc/hosts file with 127.0.0.1) then all such hosts will

         * have a non-unique hostid, but it doesn't matter anyway and

         * gethostid() will return a non zero number without the need for

         * setting one anyway.

         *                                              Mitch

         */

 

 

From the man page:

 

BUGS

       It is impossible to ensure that the identifier is globally unique.

 

So  - what are you looking for?

 

-Robin

QuoteReplyEditDelete

 

 

2010-07-13 15:01:59     Re: gethostid() unique?

Wojtek Skulski (UNITED STATES)

Message: 91209   

 

Perhaps this might be helpful. You will get two things in one: a globally unique id, and also the MAC address for your product.

 

  www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2542&param=en538878

QuoteReplyEditDelete

 

 

2010-07-16 09:38:26     Re: gethostid() unique?

Daniel Tripp (UNITED STATES)

Message: 91347   

 

Ah, I was looking for the cpu-unique IDs for the BF52x series. Found it in the OTP from the HRM. Another question though, is there a "correct" way of formatting those values to create the ID? At the moment, I'm just getting the two values, converting them to hex, and concatenating them.

QuoteReplyEditDelete

 

 

2010-07-16 14:04:26     Re: gethostid() unique?

Mike Frysinger (UNITED STATES)

Message: 91358   

 

i'm pretty sure it's just a 128bit binary value.  just read & hexdump it and if it looks like it, then it is.  dont have a bf52x/bf54x board near me to double check myself.

Attachments

    Outcomes