diff options
author | Florian Fainelli <florian@openwrt.org> | 2014-10-24 00:16:37 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2014-10-24 00:16:37 +0000 |
commit | f5346a990261726863598190f148ec3abd30381e (patch) | |
tree | bad4da7386383dad8b0edf9a148eecdffb6119ba /target/linux/netlogic/base-files/lib | |
parent | a1cb12525c4c2cd9a1dc302ba31ee464d7138ed3 (diff) | |
download | master-187ad058-f5346a990261726863598190f148ec3abd30381e.tar.gz master-187ad058-f5346a990261726863598190f148ec3abd30381e.tar.bz2 master-187ad058-f5346a990261726863598190f148ec3abd30381e.zip |
netlogic: add basic user-space support
Signed-off-by: Florian Fainelli <florian@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43038 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/netlogic/base-files/lib')
-rwxr-xr-x | target/linux/netlogic/base-files/lib/netlogic.sh | 48 | ||||
-rwxr-xr-x | target/linux/netlogic/base-files/lib/preinit/03_do_netlogic.sh | 9 |
2 files changed, 57 insertions, 0 deletions
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 0000000000..27b7c4031d --- /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 0000000000..712a231734 --- /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 |