[answered] Omega2 unique serial number
Does the Omage2 have a unique serial number, something that's embedded in the rom and accessible to the device to read, but not alter?
You can use MAC address from network interface. It is unique.
@Jakub-K I had considered that, but I thought I read somewhere that the MAC address can be changed, in which case it couldn't be guaranteed to be unique.
I think I'll have to look into that in more detail.
Indeed, MAC can be changed by e.g. ethtool.
MIPS32 have a unique CPUID I think? This sheds a bit of light: https://en.wikichip.org/wiki/mips/prid_register
@Chris-Drake Interesting, thank you.
Although I doubt I'll be able to write a userspace application capable of talking to this register, so this will have to go on the back burner for the time being.
PRid is not unique as global. It's just an identification of vendor + processor id (cpu type) + model revision. It's not unique in vendor's production line. It is not it's serial number.
You can read original MAC address even if it was changed (change is not permanent). To read permanent (value from NIC ROM memory):
-P --show-permaddr Queries the specified network device for permanent hardware address.
ethtool -P enp0s25
If you need to get it more programatically (C/C++), let me know.
Changing the MAC address of the running adapter might be ephemeral, but an easily made change to the flash partition where the MAC address is stored is permanent.
So no, the MAC address is NOT an immutable unique ID!
Giving -1 and not giving alternative is so fair ;-)
Using permanenty stored MAC is the only proposed solutions so far. Sure, you can reflash efuse (and change MAC). With that approach you will never find any unique id on any CPU that can't be altered (Intel tried it once and after EU commision intervention Intel abandoned idea of "serial numbers" in CPUs.).
Still, it's only way to get any unique ID based on hardware (accepting that, it can be changed by flashing efuse). If considering only out-of-the-box device, it can be assumed it's unique (for some purposes). I mean, when using new (own) device one should not be aware that someone in the middle changed efuse. If considering no-trust and 3rd parties, then id should be generated by software ("hard-to-guess" algorithms, uuid4 maybe?). Author did not reveal why and for what he needs that ID.
@Jakub-K False claims are false, regardless if there is no alternative.
The MAC is stored in an everyday, easily modified flash partition.
In contrast, true hardware unique ID's are not supposed to be alterable - but not all processors have them.
The initial question posting specifically requires something not alterable.
It looks like the answer to my question is no (unless someone from Onion can chime in and indicate otherwise) and the closest to a unique serial number I'll be able to get for my Omega2's is the MAC, but will have to factor in that it is untrustworthy as it is open to modification.
where did you got the ethtool for the onion omega?
I cant find a package or binary.
I came across this thread while trying to solve this problem and found the above answer not to work for me. 'ethtool' is not installed by default and is not found in the opkg package manager. I wish to avoid installing packages if avoidable anyway. I hope my solution is useful to someone.
ifconfig | grep 'eth0 ' | cut -d ' ' -f 11
How it works:
On my Omega2, ifconfig returns a set of information about 4 network interfaces, br-wlan, eth0, eth0.1 and lo. I chose to extract the MAC address of 'eth0'. The output of ifconfig is piped into the grep command which extracts only lines containing 'eth0 ' (note the space on the end, it eliminates 'eth0.1'). The output of grep is only one line and it contains the search term, the MAC address we're looking for and other information we do not need. This is piped into 'cut' with arguments to make it to treat space characters as column delimiters and return only the 11th column.
I had hoped to come up with a cross platform solution but this has certain expectations of the output of ifconfig. For instance, it doesn't work on MacOS. If you're hoping to develop on another machine and test on the Omega2, you might want to use some kind of platform detection.