diff options
author | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2016-05-23 16:10:20 +0200 |
---|---|---|
committer | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2016-05-23 16:10:20 +0200 |
commit | 8c57b778e0e770934a00e68c6031e85ada43ac85 (patch) | |
tree | 074c59d3e73b73289d9750419788f813ea49205b | |
parent | 64ab5a4c59871b99bae51fb6ac3e8a8ccd413718 (diff) |
wcnss-gen-macaddr: make sure that MAC address is exactly 8 charnext
The MAC address is contructed artifically during the first boot of the platform,
as:
02:00:<ID> where <ID> is the eMMC 'serial number' (e.g. PSN) read from the eMMC
CID. The PSN is a 32-bit unsigned number, and if the number is 'low' then the
MAC address will be shorter than expected.
Pad the MAC address with '0' if needed.
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
-rwxr-xr-x | wcnss-gen-macaddr | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/wcnss-gen-macaddr b/wcnss-gen-macaddr index e5411e2..75e4951 100755 --- a/wcnss-gen-macaddr +++ b/wcnss-gen-macaddr @@ -7,7 +7,11 @@ if [ ! -f ${MAC_FILE} ]; then for i in $(cat /proc/cmdline); do case "$i" in androidboot.serialno=*) - echo "0200${i#androidboot.serialno=}" > ${MAC_FILE} + mac=${i#androidboot.serialno=} + # make sure that mac is 8-char (the serialno is an unsigned 32-bit) + # pad with '0' if needed + while [ ${#mac} -lt 8 ]; do mac="0$mac"; done + echo "0200${mac}" > ${MAC_FILE} ;; esac done |