From ac3e05c5d757334944fbf1f14583164cd1d69172 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Fri, 7 Apr 2017 18:09:08 +0200 Subject: treewide: populate boardname and model earlier For targets using the generic board detection and board specific settings in diag.sh, the board name is still unset at the time the set_state() provided by diag.sh is called by 10_indicate_preinit. Change the execution order to ensure the boardname is populated before required the first time. Do the target specific board detection as early as possible, directly followed by the generic one to allow a seamless switch to the generic function for populating /tmp/sysinfo/. Signed-off-by: Mathias Kresin --- package/base-files/files/lib/preinit/02_sysinfo | 10 ++++++++++ package/base-files/files/lib/preinit/10_sysinfo | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 package/base-files/files/lib/preinit/02_sysinfo delete mode 100644 package/base-files/files/lib/preinit/10_sysinfo (limited to 'package') diff --git a/package/base-files/files/lib/preinit/02_sysinfo b/package/base-files/files/lib/preinit/02_sysinfo new file mode 100644 index 0000000000..65b50968e2 --- /dev/null +++ b/package/base-files/files/lib/preinit/02_sysinfo @@ -0,0 +1,10 @@ +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 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 65b50968e2..0000000000 --- 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 -- cgit v1.2.3