diff options
Diffstat (limited to 'target/linux/sunxi/base-files')
-rw-r--r-- | target/linux/sunxi/base-files/etc/board.d/01_leds | 3 | ||||
-rw-r--r-- | target/linux/sunxi/base-files/etc/board.d/02_network | 63 |
2 files changed, 47 insertions, 19 deletions
diff --git a/target/linux/sunxi/base-files/etc/board.d/01_leds b/target/linux/sunxi/base-files/etc/board.d/01_leds index 45153b44dc..60783363de 100644 --- a/target/linux/sunxi/base-files/etc/board.d/01_leds +++ b/target/linux/sunxi/base-files/etc/board.d/01_leds @@ -7,7 +7,8 @@ boardname="${board##*,}" board_config_update case $board in -friendlyarm,nanopi-r1) +friendlyarm,nanopi-r1|\ +friendlyarm,nanopi-r1s-h5) ucidef_set_led_netdev "wan" "WAN" "nanopi:green:wan" "eth0" ucidef_set_led_netdev "lan" "LAN" "nanopi:green:lan" "eth1" ;; diff --git a/target/linux/sunxi/base-files/etc/board.d/02_network b/target/linux/sunxi/base-files/etc/board.d/02_network index d5c615e7f2..46ace1f67c 100644 --- a/target/linux/sunxi/base-files/etc/board.d/02_network +++ b/target/linux/sunxi/base-files/etc/board.d/02_network @@ -3,27 +3,54 @@ # . /lib/functions/uci-defaults.sh +. /lib/functions/system.sh -board_config_update +sunxi_setup_interfaces() +{ + local board="$1" + + case "$board" in + friendlyarm,nanopi-r1|\ + friendlyarm,nanopi-r1s-h5) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; + lamobo,lamobo-r1) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan + ;; + olimex,a20-olinuxino-micro) + ucidef_set_interface_lan "wlan0" + ;; + xunlong,orangepi-r1) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ;; + *) + ucidef_set_interface_lan "eth0" + ;; + esac +} + +sunxi_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" -case $(board_name) in -friendlyarm,nanopi-r1) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; -lamobo,lamobo-r1) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan - ;; -olimex,a20-olinuxino-micro) - ucidef_set_interface_lan "wlan0" - ;; -xunlong,orangepi-r1) - ucidef_set_interfaces_lan_wan "eth0" "eth1" - ;; -*) - ucidef_set_interface_lan "eth0" - ;; -esac + case "$board" in + friendlyarm,nanopi-r1s-h5) + lan_mac=$(get_mac_binary "/sys/bus/i2c/devices/0-0051/eeprom" 0xfa) + ;; + esac + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac +} + +board_config_update +board=$(board_name) +sunxi_setup_interfaces $board +sunxi_setup_macs $board board_config_flush exit 0 |