temperature 85 is error condition
[rpi-ds18b20] / overlay-load.sh
1 #!/bin/sh -e
2
3 dtb=$1
4 test -f "$dtb" || ( echo "Usage: $0 overlay.dtb" ; exit 1 )
5
6 if echo $dtb | grep '\.dts$' ; then
7         echo "Compile overlay $dtb"
8         dtc -I dts -O dtb -o $dtb.dtb $dtb
9         dtb=$dtb.dtb
10         echo "Created $dtb"
11 fi
12
13
14 #mount none /sys/kernel/config/ -t configfs
15
16 config=`mount -t configfs | awk '{ print $3 }'`
17 if [ -z "$config" ] ; then
18         config=/sys/kernel/config
19         mount -t configfs none $config
20 fi
21 name=`basename $1`
22
23
24 dir=$config/device-tree/overlays/$name
25
26 # remote overlay to reaload it
27 test -d $dir && rmdir $dir
28
29 mkdir $dir
30 cat $dtb > $dir/dtbo
31 cat $dir/status
32
33 echo "Remove with: rmdir $dir"