To differentiate each C2 board, you can use 16-digit S/N or MAC that are written on C2 manufacturing line.
Your kernel version should be 3.14.29-35 or higher to get the full 16 digit of unique ID.
Using the following node, you can get the 16-digit board ID.
cat /sys/class/efuse/usid
odroid@odroid64:~$ cat /sys/class/efuse/usid HKC2123456789ABC
$ gcc -o get_usid get_usid.c
odroid@odroid64:~$ ./get_usid S/N is 'HKC2123456789ABC'
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #define SYSFS_CLASS_USID "/sys/class/efuse/usid" #define USID_LEN 16 int main(int argc, char *argv[]) { int fd, len; char buf[USID_LEN]; fd = open(SYSFS_CLASS_USID, O_RDONLY); if (fd < 0) printf("Open error! \n"); read(fd, buf, USID_LEN); printf("S/N is '%s'\n", buf); close(fd); return 0; }
Or the unique MAC can be used to define your board.
odroid@odroid64:~$ ip add | grep link/ether link/ether 00:12:34:56:78:9A brd ff:ff:ff:ff:ff:ff
If you need to confirm if the value that you read is right one, check booting log message on console.
U-Boot 2015.01-00076-gbeda694 (Mar 01 2016 - 10:35:37), Build: jenkins-s905_and8 DRAM: 2 GiB Relocation Offset is: 76f41000 ------------------------------------------------------------------------------------- * Welcome to Hardkernel's ODROID-C2 ------------------------------------------------------------------------------------- CPU : AMLogic S905 S/N : HKC2123456789ABC MAC : 00:12:34:56:78:9A BID : HKC2123456 -------------------------------------------------------------------------------------
On Android platform, you can use Property to get board ID with 'ro.serialno' or 'ro.boot.serialno'.
shell@odroidc2:/ $ getprop ro.serialno HKC2123456789ABC
shell@odroidc2:/ $ getprop ro.boot.serialno HKC2123456789ABC
The native property_get method from a java app using jni can be a general and easy way.
#include <cutils/perperties.h> void get_serialno(void) { char serialno[16]; perperty_get("ro.serialno", serialno, ""); // or perperty_get("ro.bootserialno", serialno, ""); ..... }