diff options
Diffstat (limited to 'db845c')
-rw-r--r-- | db845c/device.mk | 5 | ||||
-rw-r--r-- | db845c/eth_mac_addr.rc | 9 | ||||
-rw-r--r-- | db845c/eth_mac_addr.sh | 15 |
3 files changed, 29 insertions, 0 deletions
diff --git a/db845c/device.mk b/db845c/device.mk index cc5b973..b37e06f 100644 --- a/db845c/device.mk +++ b/db845c/device.mk @@ -43,5 +43,10 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ device/linaro/dragonboard/qcom/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.qcom.rc +# Install scripts to set Ethernet MAC address +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/eth_mac_addr.rc:/system/etc/init/eth_mac_addr.rc \ + $(LOCAL_PATH)/eth_mac_addr.sh:/system/bin/eth_mac_addr.sh + # Copy firmware files $(call inherit-product-if-exists, $(LOCAL_PATH)/firmware/device.mk) diff --git a/db845c/eth_mac_addr.rc b/db845c/eth_mac_addr.rc new file mode 100644 index 0000000..e710c19 --- /dev/null +++ b/db845c/eth_mac_addr.rc @@ -0,0 +1,9 @@ +service eth_mac_addr /system/bin/eth_mac_addr.sh + class core + user root + group system + disabled + oneshot + +on post-fs-data + start eth_mac_addr diff --git a/db845c/eth_mac_addr.sh b/db845c/eth_mac_addr.sh new file mode 100644 index 0000000..bdc1ba7 --- /dev/null +++ b/db845c/eth_mac_addr.sh @@ -0,0 +1,15 @@ +#! /system/bin/sh +# Set eth0 mac address. +# +# Get the unique board serial number from /proc/cmdline, +# prepend '0's to the serial number to fill 5 LSBs of the +# MAC address and prepend "02" as MSB to prepare a 6 byte +# locally administered unicast MAC address. +# Format the output in xx:xx:xx:xx:xx:xx format for the +# "ip" set address command to work. + +SERIALNO=`cat /proc/cmdline | grep -o serialno.* | cut -f2 -d'=' | awk '{printf("02%010s\n", $1)}' | sed 's/\(..\)/\1:/g' | sed '$s/:$//'` + +/system/bin/ip link set dev eth0 down +/system/bin/ip link set dev eth0 address "${SERIALNO}" +/system/bin/ip link set dev eth0 up |