summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2014-10-24 00:16:37 +0000
committerFlorian Fainelli <florian@openwrt.org>2014-10-24 00:16:37 +0000
commit7166fbbb676cc978a9174dee6744bfafdf0842e0 (patch)
tree560a43347efaf34a49c72f97371d3a3886e0eb5d /target/linux
parentc6285fd82f1b631b77ad94be613dc4575cd9ed28 (diff)
downloadmtk-20170518-7166fbbb676cc978a9174dee6744bfafdf0842e0.zip
mtk-20170518-7166fbbb676cc978a9174dee6744bfafdf0842e0.tar.gz
mtk-20170518-7166fbbb676cc978a9174dee6744bfafdf0842e0.tar.bz2
netlogic: add basic user-space support
Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 43038
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/netlogic/base-files.mk5
-rwxr-xr-xtarget/linux/netlogic/base-files/etc/uci-defaults/02_network28
-rwxr-xr-xtarget/linux/netlogic/base-files/lib/netlogic.sh48
-rwxr-xr-xtarget/linux/netlogic/base-files/lib/preinit/03_do_netlogic.sh9
4 files changed, 90 insertions, 0 deletions
diff --git a/target/linux/netlogic/base-files.mk b/target/linux/netlogic/base-files.mk
new file mode 100644
index 0000000..d6682bd
--- /dev/null
+++ b/target/linux/netlogic/base-files.mk
@@ -0,0 +1,5 @@
+define Package/base-files/install-target
+ rm -f $(1)/etc/config/network
+endef
+
+
diff --git a/target/linux/netlogic/base-files/etc/uci-defaults/02_network b/target/linux/netlogic/base-files/etc/uci-defaults/02_network
new file mode 100755
index 0000000..e271e17
--- /dev/null
+++ b/target/linux/netlogic/base-files/etc/uci-defaults/02_network
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+
+[ -e /etc/config/network ] && exit 0
+
+touch /etc/config/network
+
+. /lib/functions/uci-defaults.sh
+. /lib/netlogic.sh
+
+ucidef_set_interface_loopback
+
+case "$board_name" in
+"xlp-evp" |\
+"xlp-fvp" |\
+"xlp-gvp" |\
+"xlp-svp" |\
+*)
+ ucidef_set_interface_lan "eth0"
+ ;;
+
+esac
+
+uci commit network
+
+exit 0
diff --git a/target/linux/netlogic/base-files/lib/netlogic.sh b/target/linux/netlogic/base-files/lib/netlogic.sh
new file mode 100755
index 0000000..27b7c40
--- /dev/null
+++ b/target/linux/netlogic/base-files/lib/netlogic.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+
+NETLOGIC_BOARD_NAME=
+NETLOGIC_MODEL=
+
+netlogic_board_detect() {
+ local machine
+ local name
+
+ machine=$(awk 'BEGIN{FS="[ \t:/]+"} /machine/ {print $2}' /proc/cpuinfo)
+
+ case "$machine" in
+ *"netlogic,XLP-EVP")
+ name="xlp-evp"
+ ;;
+ *"netlogic,XLP-FVP")
+ name="xlp-fvp"
+ ;;
+ *"netlogic,XLP-GVP")
+ name="xlp-gvp"
+ ;;
+ *"netlogic,XLP-SVP")
+ name="xlp-svp"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -z "$NETLOGIC_BOARD_NAME" ] && NETLOGIC_BOARD_NAME="$name"
+ [ -z "$NETLOGIC_MODEL" ] && NETLOGIC_MODEL="$machine"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$NETLOGIC_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$NETLOGIC_MODEL" > /tmp/sysinfo/model
+}
+
+netlogic_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}
diff --git a/target/linux/netlogic/base-files/lib/preinit/03_do_netlogic.sh b/target/linux/netlogic/base-files/lib/preinit/03_do_netlogic.sh
new file mode 100755
index 0000000..712a231
--- /dev/null
+++ b/target/linux/netlogic/base-files/lib/preinit/03_do_netlogic.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_netlogic() {
+ . /lib/netlogic.sh
+
+ netlogic_board_detect
+}
+
+boot_hook_add preinit_main do_netlogic