diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2023-07-19 10:17:38 +0530 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2023-07-19 13:00:24 +0530 |
commit | e0b877ac38361eef5efedcd2951021ced4c20a37 (patch) | |
tree | 230be62984f5960a4ca92111525e7265c724bc1d /db845c | |
parent | bd160522bf3e8f411051286adaa02a48585c1f9f (diff) |
utils: eth_mac_addr: Refactor ethernet mac addr script
Refactored the scripts which we use on DB845c to set
Ethernet MAC address.
Updated the .sh script to fall back to parsing bootconfig
file to lookup androidboot.serialno bootarg, if it is not
found in /proc/cmdline (boot image header v4 for example).
Fixed a typo s/db45c/db845c in .rc script which was blocking
this service to run.
Renamed the script from eth_mac_addr to set_ethaddr to
follow the nomenclature we have used everywhere else and
moved them to common shared/utils/ directory.
And updated the sepolicies accordingly.
Change-Id: Ia25e464b7c13934ffd8ab66a6aa2d892d7cd5a7b
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'db845c')
-rw-r--r-- | db845c/device.mk | 4 | ||||
-rw-r--r-- | db845c/eth_mac_addr.rc | 9 | ||||
-rw-r--r-- | db845c/eth_mac_addr.sh | 15 |
3 files changed, 2 insertions, 26 deletions
diff --git a/db845c/device.mk b/db845c/device.mk index 7dac78b..700e339 100644 --- a/db845c/device.mk +++ b/db845c/device.mk @@ -47,8 +47,8 @@ PRODUCT_COPY_FILES += \ # 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 + device/linaro/dragonboard/shared/utils/ethaddr/ethaddr.rc:/system/etc/init/ethaddr.rc \ + device/linaro/dragonboard/shared/utils/ethaddr/set_ethaddr.sh:/system/bin/set_ethaddr.sh PRODUCT_VENDOR_PROPERTIES += ro.soc.manufacturer=Qualcomm PRODUCT_VENDOR_PROPERTIES += ro.soc.model=SDM845 diff --git a/db845c/eth_mac_addr.rc b/db845c/eth_mac_addr.rc deleted file mode 100644 index a30c0a5..0000000 --- a/db845c/eth_mac_addr.rc +++ /dev/null @@ -1,9 +0,0 @@ -service eth_mac_addr /system/bin/eth_mac_addr.sh - class core - user root - group system - disabled - oneshot - -on post-fs-data && property:vendor.hw=db45c - start eth_mac_addr diff --git a/db845c/eth_mac_addr.sh b/db845c/eth_mac_addr.sh deleted file mode 100644 index bdc1ba7..0000000 --- a/db845c/eth_mac_addr.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /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 |