i need to ensure that even if my executable C/C++ codes are copied to another raspberry Pi (dumping the SDcard), they will not run there.

what are the possible ways to do this.


adding "PI serial number" as a licence to run my code is a solution to prevent dumping and using my software on another PI, but i have also lots of installed/configured Linux services which run when Pi boots. is there any idea how to prevent them to run without licence?

  • I think you should ask a new question focusing on the idea in the last paragraph, because you are implying you can't use the serial number at boot (??), which isn't true -- it is probably available as soon as soon as /proc is mounted, and it is unlikely you need to do anything before that (ie., you could use this as a dependency). Obviously you also need to check that this cannot be (easily) spoofed. This is a set of pi specific questions, whereas a generic "how to implement DRM" isn't (and tacking "on a Raspberry Pi" doesn't really change that).
    – goldilocks
    Commented Jun 19, 2019 at 13:21

1 Answer 1


One option would be to check the Ethernet MAC address, but this can be spoofed.

An alternative would be to use the serial number in /proc/cpuinfo such as in this Xojo thread.

Such efforts should prevent most of the casual copying. However, a determined programmer can defeat that as well. See Dimitry's answer on a different thread.

  • how to how to check that serial number in your C code and verify it? Commented Jun 15, 2019 at 9:45
  • 2
    It is trivial to spoof the serial number. The MAC address is derived from the serial number.
    – Dougie
    Commented Jun 15, 2019 at 11:41
  • I embed the serial number of the Pi licensed to run my software in the software itself. This makes "nearly" all attempts to run the copy on another Pi fail. Each Pi has a unique serial number which can not be changed. I encrypt the serial number in my software and change where the encrypted data is stored on each copy of the software, thus, comparing two copies of the distributed .pyc results in useless differences.
    – Wendall
    Commented Jun 15, 2019 at 19:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.