[LEDE-DEV] [PATCH v2 1/3] base-files: add/convert generic board detection scripts

Roman Yeryomin leroi.lists at gmail.com
Tue May 9 02:16:47 PDT 2017


Signed-off-by: Roman Yeryomin <roman at advem.lv>
---
 package/base-files/files/lib/board_detect.sh                 |  9 +++++++++
 package/base-files/files/lib/preinit/03_preinit_board_detect | 11 +++++++++++
 package/base-files/files/lib/preinit/10_sysinfo              | 10 ----------
 3 files changed, 20 insertions(+), 10 deletions(-)
 create mode 100644 package/base-files/files/lib/board_detect.sh
 create mode 100644 package/base-files/files/lib/preinit/03_preinit_board_detect
 delete mode 100644 package/base-files/files/lib/preinit/10_sysinfo

diff --git a/package/base-files/files/lib/board_detect.sh b/package/base-files/files/lib/board_detect.sh
new file mode 100644
index 0000000..e2f0f89
--- /dev/null
+++ b/package/base-files/files/lib/board_detect.sh
@@ -0,0 +1,9 @@
+board_detect()
+{
+	[ -d /proc/device-tree ] || return
+	mkdir -p /tmp/sysinfo
+	[ -e /tmp/sysinfo/board_name ] || \
+		echo "$(strings /proc/device-tree/compatible | head -1)" > /tmp/sysinfo/board_name
+	[ ! -e /tmp/sysinfo/model -a -e /proc/device-tree/model ] && \
+		echo "$(cat /proc/device-tree/model)" > /tmp/sysinfo/model
+}
diff --git a/package/base-files/files/lib/preinit/03_preinit_board_detect b/package/base-files/files/lib/preinit/03_preinit_board_detect
new file mode 100644
index 0000000..739ab02
--- /dev/null
+++ b/package/base-files/files/lib/preinit/03_preinit_board_detect
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Copyright (c) 2017 The Linux Foundation. All rights reserved.
+#
+
+do_board_detect()
+{
+	. /lib/board_detect.sh && board_detect
+}
+
+boot_hook_add preinit_main do_board_detect
diff --git a/package/base-files/files/lib/preinit/10_sysinfo b/package/base-files/files/lib/preinit/10_sysinfo
deleted file mode 100644
index 65b5096..0000000
--- a/package/base-files/files/lib/preinit/10_sysinfo
+++ /dev/null
@@ -1,10 +0,0 @@
-do_sysinfo_generic() {
-	[ -d /proc/device-tree ] || return
-	mkdir -p /tmp/sysinfo
-	[ -e /tmp/sysinfo/board_name ] || \
-		echo "$(strings /proc/device-tree/compatible | head -1)" > /tmp/sysinfo/board_name
-	[ ! -e /tmp/sysinfo/model -a -e /proc/device-tree/model ] && \
-		echo "$(cat /proc/device-tree/model)" > /tmp/sysinfo/model
-}
-
-boot_hook_add preinit_main do_sysinfo_generic
-- 
2.7.4




More information about the Lede-dev mailing list