Skip to content

Instantly share code, notes, and snippets.

@jadonk
Last active December 28, 2015 22:49
Show Gist options
  • Select an option

  • Save jadonk/7573999 to your computer and use it in GitHub Desktop.

Select an option

Save jadonk/7573999 to your computer and use it in GitHub Desktop.
Read the serial number and unused MAC ID off of a BeagleBone
root@ubuntu-armhf:~# ./parse-eeprom
c8:a0:30:ac:e0:be
A335BNLT 0A5A 1513BBBK0837
#!/usr/bin/perl
undef $/;
open($maf, "</proc/device-tree/ocp/ethernet\@4a100000/slave\@4a100300/mac-address");
$ma = <$maf>;
@ADDR = unpack("(H2)*", $ma);
$DEV_ADDR = join(":", @ADDR);
print "$DEV_ADDR\n";
open($eef, "</sys/bus/i2c/devices/0-0050/eeprom");
$ee = <$eef>;
($HEADER,$ID,$VERSION,$SERIAL) = unpack("A4A8A4A12", $ee);
print "$ID $VERSION $SERIAL\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment