diff options
author | John Klug <john.klug@multitech.com> | 2019-03-04 18:54:52 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2019-03-04 18:54:52 -0600 |
commit | 8ab1ab5315c31dd2cf54fa4d95a6d46226e1131d (patch) | |
tree | 8219e3cc34a7d573ec8a5eaf3da2925d207a6254 /recipes-bsp/multitech | |
parent | 88c77423378c7890921f48e82083382367df09bc (diff) | |
download | meta-multitech-atmel-8ab1ab5315c31dd2cf54fa4d95a6d46226e1131d.tar.gz meta-multitech-atmel-8ab1ab5315c31dd2cf54fa4d95a6d46226e1131d.tar.bz2 meta-multitech-atmel-8ab1ab5315c31dd2cf54fa4d95a6d46226e1131d.zip |
Create routine in mts-io init script to load device tree.
Diffstat (limited to 'recipes-bsp/multitech')
-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" |