diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-04-16 20:09:21 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-04-16 20:09:21 +0000 |
commit | 98524cc69868a3cf90201dcb43b4fc0361998598 (patch) | |
tree | 43bc14a74dd5c7e06c6ae9bbe4994437ba577f96 /package/base-files/files/lib | |
parent | 60136406246ec5de99fbbba3e0b91434c208c771 (diff) | |
download | master-187ad058-98524cc69868a3cf90201dcb43b4fc0361998598.tar.gz master-187ad058-98524cc69868a3cf90201dcb43b4fc0361998598.tar.bz2 master-187ad058-98524cc69868a3cf90201dcb43b4fc0361998598.zip |
base-files: add generic preinit script to extract board/model info from device-tree
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45462 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/lib')
-rw-r--r-- | package/base-files/files/lib/preinit/90_sysinfo | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/package/base-files/files/lib/preinit/90_sysinfo b/package/base-files/files/lib/preinit/90_sysinfo new file mode 100644 index 0000000000..42fd5b6239 --- /dev/null +++ b/package/base-files/files/lib/preinit/90_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 ] || \ + echo "$(cat /proc/device-tree/model)" > /tmp/sysinfo/model +} + +boot_hook_add preinit_main do_sysinfo_generic |