aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/base-files/lib
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mediatek/base-files/lib')
-rw-r--r--target/linux/mediatek/base-files/lib/mediatek.sh33
-rw-r--r--target/linux/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh12
2 files changed, 45 insertions, 0 deletions
diff --git a/target/linux/mediatek/base-files/lib/mediatek.sh b/target/linux/mediatek/base-files/lib/mediatek.sh
new file mode 100644
index 0000000000..8466c72ee3
--- /dev/null
+++ b/target/linux/mediatek/base-files/lib/mediatek.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+mediatek_board_detect() {
+ local machine
+ local name
+
+ machine=$(cat /proc/device-tree/model)
+
+ case "$machine" in
+ "MediaTek MT7623 Evaluation Board")
+ name="mt7623_evb"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$name" > /tmp/sysinfo/board_name
+ echo "$machine" > /tmp/sysinfo/model
+}
+
+mediatek_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/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh b/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh
new file mode 100644
index 0000000000..9e5a18db1a
--- /dev/null
+++ b/target/linux/mediatek/base-files/lib/preinit/03_preinit_do_mediatek.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Copyright (c) 2014 The Linux Foundation. All rights reserved.
+#
+
+do_mediatek() {
+ . /lib/mediatek.sh
+
+ mediatek_board_detect
+}
+
+boot_hook_add preinit_main do_mediatek