Get Unique IDs

6 2111

I'm working on a project where we are planning to roll our hundreds of banana Pi's with bananian on it.
To keep track of them, I would like to have a script that 'collects' some unique IDs. So that whenever the SD card on an banana Pi is changed, that I can automatically detect what box it is. (Using an central management server with database.)

I'm able to read out the serial number of the CPU and the MAC address of the NIC. But I would like to have a 3rd unique ID.
Is there some way to get a serial number of the motherboard / RAM / GPU / ... ?

I know I can also detect the UUID of the SD card. But well... The SD card can easy be replaced. So that is not an good ID for me.

Also, in the same spirit, would it be possible to find some unique ID for the USB power-supply? (This then in the case that we need to replace a banana, that I can detect based on power-supply + SD card that the banana itself has been replaced. (And not the SD card moved.)

Edited by tkaiser at Mon Mar 23, 2015 15:15
I'm able to read out the serial number of the CPU and the MAC address of the NIC


Regarding MAC address it's a locally administered one, randomly assigned in the first place (and then set by u-boot or in script.bin -- both on SD card) or everytime. Please have a look at and

You can also set it at startup using /etc/modprobe.d/sunxi_gmac.conf or /etc/network/interfaces or using an ifconfig call in /etc/rc.local. And maybe in the meantime the sunxi_gmac driver writes it to and reads it from the SID.

How do you read out the CPU's serial number? Using /proc/cpuinfo?

The BPI has lots of pins - if I were you I'd create a trigger switch which sends alerts or just erases some identification private keys once anyone tries to tamper with the case.
This would at least allow you to be sure that the BPI is in the same state as you installed it. Other identification parts may probably be solved by public-key cryptography.

@tkaiser, thanks for the info.

Until now, looking at 2 Banana PIs, there MAC adresses are different. So I'm happy with that.
But it is good to know its not really unique.

This is what / now I read the information:

CPU serial number
grep Serial /proc/cpuinfo | awk '{print $NF}'

Ethernet MAC
cat /sys/class/net/eth0/address

SD card serial number
cat /sys/class/mmc_host/mmc0/mmc0:*/serial

I'm still not able to find any other IDs. And since the SD card can be easy changed, I don't want to relay on that.

@jekader, I'm not worried about people trying to 'hack' (or so) the box.
I want to be able to easy manage them. And they will be located in many countries. So for example if 1 SD card dies, a spare SD card should be able to be placed in the banana PI. Then on boot it should detect what PI it's running on, and get the correct configuration for that PI. (Using an central backend server, that knows all the configs for all the boxes.
(And yes, I protect our central server against hacking. The box will need to 'autenticate' (using it's unique IDs), and will then only get the configurations for that 1 box.

Edited by tkaiser at Fri Mar 27, 2015 04:01
Kamiware replied at Wed Mar 25, 2015 14:47
looking at 2 Banana PIs, there MAC adresses are different

The MAC address looks scary (00:00:00:00), same with the 'cpu id' (never seen anything other than '0000000000000000' in the wild). But there seems to be a persistent and unique ID present inside the A20 -- the aforementioned SID:

If I read it out here (kernel 4.0.0-rc1) using "hexdump -C /sys/devices/platform/soc@01c00000/1c23800.eeprom/eeprom" I get
  1. 16 51 66 8a 80 48 57 88  51 48 48 48 02 82 51 72
Copy the Code
Which differs from the SIDs already collected here:

Will try that the next days on one or two of my other A20 based boards and get back to you.

Edited by tkaiser at Sun Mar 29, 2015 09:46
tkaiser replied at Fri Mar 27, 2015 03:57
hexdump -C /sys/devices/platform/soc@01c00000/1c23800.eeprom/eeprom

Olimex A20-OLinuXIno-LIME2:
  1. 16 51 66 08 80 48 51 72  49 48 48 48 08 00 cc fc
Copy the Code

I also tried to boot my pcDuino3 Nano but somehow the 3.19 image got corrupted and I hadn't the time to play around with the other images with older kernels (/sys/devices/platform/soc@01c00000/1c23800.eeprom does not exist in earlier kernels).

As expected the MAC address changed when exchanging SD cards so I would solely rely on the SID for your purpose (since this ID 'lives' inside the A20 SoC)

You have to log in before you can reply Login | Sign Up

Points Rules