diff options
author | Daniel Golle <daniel@makrotopia.org> | 2022-01-11 12:58:50 +0000 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2022-01-23 20:20:47 +0000 |
commit | f5278bf820105c83267d6bc0ad3dfaf1d77a4681 (patch) | |
tree | 183ed3c3a290f768323f9bfd37a9cefce544d78b | |
parent | 31872a38be6ae88f782cc0db4a17c058b4dc23bc (diff) | |
download | upstream-f5278bf820105c83267d6bc0ad3dfaf1d77a4681.tar.gz upstream-f5278bf820105c83267d6bc0ad3dfaf1d77a4681.tar.bz2 upstream-f5278bf820105c83267d6bc0ad3dfaf1d77a4681.zip |
mediatek: store random MAC address in U-Boot env on first boot
For devboards without a MAC address assigned from factory, store
the random MAC in U-Boot env on first boot to make it persistent.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r-- | target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh b/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh new file mode 100644 index 0000000000..b078b8f8ce --- /dev/null +++ b/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh @@ -0,0 +1,14 @@ +[ ! -e /etc/fw_env.config ] && exit 0 + +. /lib/functions.sh + +case "$(board_name)" in +bananapi,bpi-r2|\ +bananapi,bpi-r64|\ +unielec,u7623-02) + [ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] && + fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)" + ;; +esac + +exit 0 |