[LEDE-DEV] [PATCH 2/2] x86: Add board configs for the PC Engines APU2
Chris Blake
chrisrblake93 at gmail.com
Mon Feb 13 00:01:14 PST 2017
This adds the default LED and network settings for the PC Engines APU2
when running under the x86 target.
Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
---
target/linux/x86/base-files/etc/board.d/01_leds | 7 +++-
target/linux/x86/base-files/etc/board.d/02_network | 7 +++-
target/linux/x86/base-files/etc/diag.sh | 37 ++++++++++++++++++++++
target/linux/x86/base-files/lib/x86.sh | 13 ++++++++
4 files changed, 62 insertions(+), 2 deletions(-)
create mode 100755 target/linux/x86/base-files/etc/diag.sh
create mode 100755 target/linux/x86/base-files/lib/x86.sh
diff --git a/target/linux/x86/base-files/etc/board.d/01_leds b/target/linux/x86/base-files/etc/board.d/01_leds
index 8a1a1e0..05ddc71 100755
--- a/target/linux/x86/base-files/etc/board.d/01_leds
+++ b/target/linux/x86/base-files/etc/board.d/01_leds
@@ -4,12 +4,17 @@
#
. /lib/functions/uci-defaults.sh
+. /lib/x86.sh
board_config_update
-board=$(cat /tmp/sysinfo/board_name) 2>/dev/null
+board=$(x86_board_name)
case "$board" in
+pc-engines-apu2)
+ ucidef_set_led_netdev "wan" "WAN" "apu2:green:led3" "eth0"
+ ucidef_set_led_netdev "lan" "LAN" "apu2:green:led2" "eth1"
+ ;;
traverse-technologies-geos)
ucidef_set_led_netdev "lan" "LAN" "geos:1" "br-lan" "tx rx"
ucidef_set_led_netdev "wlan" "WiFi" "geos:2" "phy0tpt"
diff --git a/target/linux/x86/base-files/etc/board.d/02_network b/target/linux/x86/base-files/etc/board.d/02_network
index dcce0fa..03aa969 100755
--- a/target/linux/x86/base-files/etc/board.d/02_network
+++ b/target/linux/x86/base-files/etc/board.d/02_network
@@ -5,12 +5,17 @@
. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
+. /lib/x86.sh
board_config_update
-board="$(cat /tmp/sysinfo/board_name)" 2>/dev/null
+board=$(x86_board_name)
case "$board" in
+pc-engines-apu2)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_set_interface_raw "opt" "eth2"
+ ;;
traverse-technologies-geos)
ucidef_set_interface_lan "eth0 eth1"
ucidef_add_atm_bridge "0" "35" "llc" "bridged"
diff --git a/target/linux/x86/base-files/etc/diag.sh b/target/linux/x86/base-files/etc/diag.sh
new file mode 100755
index 0000000..2426161
--- /dev/null
+++ b/target/linux/x86/base-files/etc/diag.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Copyright © 2017 OpenWrt.org
+#
+
+. /lib/functions/leds.sh
+. /lib/x86.sh
+
+get_status_led() {
+ case $(x86_board_name) in
+ pc-engines-apu2)
+ status_led="apu2:green:power"
+ ;;
+ esac
+}
+
+set_state() {
+ get_status_led
+
+ case "$1" in
+ preinit)
+ status_led_blink_preinit
+ ;;
+
+ failsafe)
+ status_led_blink_failsafe
+ ;;
+
+ preinit_regular)
+ status_led_blink_preinit_regular
+ ;;
+
+ done)
+ status_led_on
+ ;;
+ esac
+}
diff --git a/target/linux/x86/base-files/lib/x86.sh b/target/linux/x86/base-files/lib/x86.sh
new file mode 100755
index 0000000..40e4d1f
--- /dev/null
+++ b/target/linux/x86/base-files/lib/x86.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# Copyright © 2017 OpenWrt.org
+#
+
+x86_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}
--
2.7.4
More information about the Lede-dev
mailing list