diff options
author | John Klug <john.klug@multitech.com> | 2019-03-04 18:54:52 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2019-07-03 11:22:01 -0500 |
commit | 48b0523c349ebe8c22bb321776262ee9d6884aea (patch) | |
tree | 8219e3cc34a7d573ec8a5eaf3da2925d207a6254 | |
parent | ea40ba10c428a68f39cf4264ce96e5213f3785a0 (diff) | |
download | meta-multitech-48b0523c349ebe8c22bb321776262ee9d6884aea.tar.gz meta-multitech-48b0523c349ebe8c22bb321776262ee9d6884aea.tar.bz2 meta-multitech-48b0523c349ebe8c22bb321776262ee9d6884aea.zip |
Create routine in mts-io init script to load device tree.
-rwxr-xr-x[-rw-r--r--] | recipes-bsp/multitech/mts-io/mts-io.init | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init index 3988932..336f89e 100644..100755 --- 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" |