-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate_real.sh
127 lines (100 loc) · 3.15 KB
/
update_real.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! /bin/sh
# Script to perform software update for Chronos 1.4 camera
#
# Authors: David Kronstein, Kron Technologies Inc.
# Matthew Peters, Kron Technologies Inc.
# Simon Kronstein, Kron Technologies Inc.
#
echo "Stopping camApp"
killall camApp
cd $(realpath $(dirname $0)) #start where update.sh is located
cd .. #go up to the root dir of the partition
UPDATEPARTITION=$(pwd)
PMICHEXFILE=$UPDATEPARTITION/camUpdate/Chronos1_4PowerController.X.production.hex
PMICHEXVERSION=7
echo "Validating checksums"
if [ -f $UPDATEPARTITION/camUpdate/update.md5sum ]; then
badsums=$(cd $UPDATEPARTITION/ && md5sum -c camUpdate/update.md5sum | grep 'FAILED$')
if [ "$badsums" != "" ]; then
cat $UPDATEPARTITION/camUpdate/checksum.raw > /dev/fb0
sleep 10
reboot
exit 1
fi
fi
bitmap=$UPDATEPARTITION/camUpdate/busy.raw
if [ -f $bitmap ]; then
TIMEOUT=100
while true; do
grep_out=$(ps | grep camApp)
if [[ "$grep_out" == "" ]]; then
break
elif [[ $TIMEOUT -gt 0 ]]; then
TIMEOUT=$((TIMEOUT-1))
sleep 0.1s
else
killall -9 camApp
fi
done
echo "---<<< Showing Shutdown Splash >>>---"
sleep 0.5s
cat $bitmap > /dev/fb0
fi
echo "deleting old /boot directory"
rm -rf /boot/*
echo "copying new files into place"
cd /
# just in case it didn't draw before
if [ -f $bitmap ]; then
cat $bitmap > /dev/fb0
fi
# copy new files into place
tar zxvf $UPDATEPARTITION/camUpdate/update.tgz
echo "get rid of old TI logo"
[ -e /media/mmcblk0p1/ti_logo.bmp ] && echo "removing ti logo" && rm /media/mmcblk0p1/ti_logo.bmp
echo "copy in the new boot components"
cp /boot/* /media/mmcblk0p1/
echo "fixing init script links"
update-rc.d -f telnetd remove
update-rc.d -f thttpd remove
update-rc.d -f banner remove
update-rc.d -f psplash remove
update-rc.d -f shutdown_splash.sh remove
update-rc.d -f matrix-gui-e remove
# this one never worked and even if it did would only show on the serial terminal
update-rc.d -f gplv3-notice remove
update-rc.d -f udev remove
update-rc.d udev start 3 S .
update-rc.d -f load-hd-firmware.sh remove
update-rc.d load-hd-firmware.sh start 40 S .
update-rc.d -f vidorder remove
update-rc.d vidorder start 41 S .
update-rc.d -f camera remove
update-rc.d camera start 42 S . stop 0 0 6 .
update-rc.d -f networking remove
update-rc.d networking start 60 S .
update-rc.d -f mountnfs.sh remove
update-rc.d mountnfs.sh start 65 S .
update-rc.d -f bootmisc.sh remove
update-rc.d bootmisc.sh start 70 S .
update-rc.d -f alsa-state remove
update-rc.d alsa-state start 80 S .
update-rc.d udhcpcd defaults
#Update the Power Management IC if an update file is in the update drive's root directory:
if test -f "$PMICHEXFILE"; then
echo "$PMICHEXFILE exists, checking for firmware update"
# Check the PIC firmware version and update only if necessary.
echo "Stopping power management daemon"
killall camshutdown
killall pcUtil
PMICFWVERSION=$(/usr/local/sbin/pcUtil -v | sed -e 's/.*://' | tr -d '[:space:]')
if [ "$PMICFWVERSION" -lt "$PMICHEXVERSION" ]; then
echo "Updating PMIC Firmware"
/usr/local/sbin/pcUtil -u $PMICHEXFILE
else
echo "Found PMIC version $PMICFWVERSION Skipping PMIC firmware update"
fi
fi
echo "completed!"
#exit 0
reboot