From 8ab1ab5315c31dd2cf54fa4d95a6d46226e1131d Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 4 Mar 2019 18:54:52 -0600 Subject: Create routine in mts-io init script to load device tree. --- recipes-bsp/multitech/mts-io/mts-io.init | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) mode change 100644 => 100755 recipes-bsp/multitech/mts-io/mts-io.init (limited to 'recipes-bsp') diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init old mode 100644 new mode 100755 index 3988932..336f89e --- a/recipes-bsp/multitech/mts-io/mts-io.init +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -13,6 +13,7 @@ i2c=/sys/bus/i2c/devices/ GPSCONFIGTYPE="/var/run/config/gpstype" +DEVTREE="/sys/kernel/config/device-tree/overlays/" ((fail=0)) # To log debug, set LOGDBG to /usr/bin/LOGGER @@ -48,6 +49,25 @@ sethwtype() { MTAC_MODULES=$(cd /lib/modules/$(uname -r)/extra/;ls mtac_* 2>/dev/null) } +setdevtree() { + # add device tree overlays, if they exist. + [[ -d /lib/dtoverlays ]] || return 1 + ( + cd /lib/dtoverlays + for f in $(ls ${hw}*) ; do + if ! [[ -d ${DEVTREE} ]] ; then + mount configfs + fi + f1=${f/#${hw}-/} + f2=${f1/%.dtbo} + # f2 is the extracted device name + /bin/mkdir ${DEVTREE}/$f2 + /bin/cat $f >${DEVTREE}/$f2/dtbo + done + ) +} + + SYSFS="/usr/sbin/mts-io-sysfs" LRST="/usr/sbin/mts-util-lora2-reset" @@ -261,6 +281,7 @@ case $1 in fi sethwtype + setdevtree if ((HASAP == 1)) ; then # install mtac explicitly or any unused modules will cause @@ -292,6 +313,10 @@ case $1 in /usr/bin/logger -t "mts-io" -p daemon.err -s "ERROR: Missing ${LRST} -- Cannot initialize LoRa." fi fi + + if [[ -d ${DEVTREE} ]] ; then + /bin/umount configfs + fi if ((fail == 0)) ; then echo "OK" -- cgit v1.2.3