/
beagle-version
executable file
·214 lines (187 loc) · 5.97 KB
/
beagle-version
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/sh -e
#
if ! id | grep -q root; then
echo "beagle-version must be run as root:"
echo "sudo beagle-version"
exit
fi
omap_bootloader () {
unset test_var
dd if=${drive} count=1 skip=1 bs=128k > /tmp/SPL.tmp 2>/dev/null
if [ -f /tmp/SPL.tmp ] ; then
test_var=$(grep -a "U-Boot SPL" /tmp/SPL.tmp | head -n1 || true)
if [ ! "x${test_var}" = "x" ] ; then
echo "bootloader:[${label}]:[${drive}]:[${test_var}]:[location: dd MBR]"
fi
fi
unset test_var
test_var=$(dd if=${drive} count=6 skip=393248 bs=1 2>/dev/null || true)
if [ "x${test_var}" = "xU-Boot" ] ; then
uboot=$(dd if=${drive} count=32 skip=393248 bs=1 2>/dev/null || true)
uboot=$(echo ${uboot} | awk '{print $2}')
echo "bootloader:[${label}]:[${drive}]:[U-Boot ${uboot}]:[location: dd MBR]"
else
if [ -f /boot/uboot/u-boot.img ] ; then
if [ -f /usr/bin/mkimage ] ; then
unset uboot
uboot=$(/usr/bin/mkimage -l /boot/uboot/u-boot.img | grep Description | head -n1 | awk '{print $3}' 2>/dev/null || true)
if [ ! "x${uboot}" = "x" ] ; then
echo "bootloader:[${label}]:[${drive}]:[U-Boot ${uboot}]:[location: fatfs /boot/uboot/MLO]"
else
unset uboot
uboot=$(/usr/bin/mkimage -l /boot/uboot/u-boot.img | grep Name:| head -n1 | awk '{print $4}' 2>/dev/null || true)
if [ ! "x${uboot}" = "x" ] ; then
echo "bootloader:[${label}]:[${drive}]:[U-Boot ${uboot}]:[location: fatfs /boot/uboot/MLO]"
fi
fi
fi
else
if [ -b ${drive}p1 ] ; then
#U-Boot SPL 2014.04
unset test_var
test_var=$(dd if=${drive}p1 count=6 skip=284077 bs=1 2>/dev/null || true)
if [ "x${test_var}" = "xU-Boot" ] ; then
uboot=$(dd if=${drive}p1 count=34 skip=284077 bs=1 2>/dev/null || true)
uboot=$(echo ${uboot} | awk '{print $3}')
echo "bootloader:[${label}]:[${drive}]:[U-Boot ${uboot}]:[location: fatfs /boot/uboot/MLO]"
fi
fi
fi
fi
}
dpkg_check_version () {
unset pkg_version
pkg_version=$(dpkg -l | awk '$2=="'$pkg'" { print $3 }' || true)
if [ ! "x${pkg_version}" = "x" ] ; then
echo "pkg:[$pkg]:[$pkg_version]"
else
echo "WARNING:pkg:[$pkg]:[NOT_INSTALLED]"
fi
}
dpkg_check_version_replaced () {
unset pkg_version
pkg_version=$(dpkg -l | awk '$2=="'$pkg'" { print $3 }' || true)
if [ ! "x${pkg_version}" = "x" ] ; then
echo "pkg:[$pkg]:[$pkg_version]:[GOT_REPLACED_BY_NEXT]"
fi
}
if [ -f /sys/bus/i2c/devices/0-0050/eeprom ] ; then
board_eeprom=$(hexdump -e '8/1 "%c"' /sys/bus/i2c/devices/0-0050/eeprom -n 28 | cut -b 5-28 || true)
echo "eeprom:[${board_eeprom}]"
fi
device_model=$(cat /proc/device-tree/model | sed "s/ /_/g" | tr -d '\000')
case "${device_model}" in
SanCloud_BeagleBone_Enhanced)
wifi_8723bu_driver=$(lsmod | grep 8723bu | grep -v cfg | awk '{print $1}' || true)
if [ "x${wifi_8723bu_driver}" != "x" ] ; then
echo "model:[${device_model}]:WiFi AP Enabled:[https://github.com/lwfinger/rtl8723bu]"
else
echo "model:[${device_model}]:WiFi AP Broken on Mainline"
fi
;;
*)
echo "model:[${device_model}]"
;;
esac
if [ -f /etc/dogtag ] ; then
echo "dogtag:[`cat /etc/dogtag`]"
fi
#if [ -f /bin/lsblk ] ; then
# lsblk | sed 's/^/partition_table:[/' | sed 's/$/]/'
#fi
machine=$(cat /proc/device-tree/model | sed "s/ /_/g" | tr -d '\000')
if [ "x${SOC}" = "x" ] ; then
case "${machine}" in
TI_AM5728_Beagle*)
mmc0_label="microSD-(primary)"
mmc1_label="eMMC-(secondary)"
;;
TI_OMAP5_uEVM_board)
mmc0_label="eMMC-(secondary)"
mmc1_label="microSD-(primary)"
;;
TI_AM335x_PocketBeagle)
mmc0_label="microSD"
;;
*)
mmc0_label="microSD-(push-button)"
mmc1_label="eMMC-(default)"
;;
esac
fi
if [ -b /dev/mmcblk0 ] ; then
label=${mmc0_label}
drive=/dev/mmcblk0
omap_bootloader
fi
if [ -b /dev/mmcblk1 ] ; then
label=${mmc1_label}
drive=/dev/mmcblk1
omap_bootloader
fi
if [ -f /proc/device-tree/chosen/base_dtb ] ; then
echo "UBOOT: Booted Device-Tree:[`cat /proc/device-tree/chosen/base_dtb`]"
fi
if [ -d /proc/device-tree/chosen/overlays/ ] ; then
ls /proc/device-tree/chosen/overlays/ -p | grep -v / | grep -v name | sed 's/^/UBOOT: Loaded Overlay:[/' | sed 's/$/]/'
fi
echo "kernel:[`uname -r`]"
if [ -f /usr/bin/nodejs ] ; then
echo "nodejs:[`/usr/bin/nodejs --version`]"
fi
if [ -f /boot/uEnv.txt ] ; then
unset test_var
test_var=$(cat /boot/uEnv.txt | grep -v '#' | grep dtb | grep -v dtbo || true)
if [ "x${test_var}" != "x" ] ; then
echo "device-tree-override:[$test_var]"
fi
fi
if [ -f /boot/uEnv.txt ] ; then
echo "/boot/uEnv.txt Settings:"
unset test_var
test_var=$(cat /boot/uEnv.txt | grep -v '#' | grep enable_uboot_overlays=1 || true)
if [ "x${test_var}" != "x" ] ; then
if [ -f /uEnv.txt ] ; then
echo "/uEnv.txt exists, uboot overlays is DISABLED, remove /uEnv.txt"
fi
cat /boot/uEnv.txt | grep uboot_ | grep -v '#' | sed 's/^/uboot_overlay_options:[/' | sed 's/$/]/'
cat /boot/uEnv.txt | grep dtb_overlay | grep -v '#' | sed 's/^/uboot_overlay_options:[/' | sed 's/$/]/'
fi
fi
echo "pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]"
pkg="bb-cape-overlays" ; dpkg_check_version
pkg="bb-customizations" ; dpkg_check_version
pkg="bb-usb-gadgets" ; dpkg_check_version
pkg="bb-wl18xx-firmware" ; dpkg_check_version
pkg="kmod" ; dpkg_check_version
pkg="roboticscape" ; dpkg_check_version_replaced
pkg="librobotcontrol" ; dpkg_check_version
if [ -d /home/debian/ ] ; then
pkg="firmware-ti-connectivity" ; dpkg_check_version
echo "groups:[`groups debian`]"
fi
if [ -d /home/machinekit/ ] ; then
pkg="firmware-ti-connectivity" ; dpkg_check_version
echo "groups:[`groups machinekit`]"
fi
if [ -d /home/ubuntu/ ] ; then
echo "groups:[`groups ubuntu`]"
fi
if [ -d /home/beagle/ ] ; then
echo "groups:[`groups beagle`]"
fi
echo "cmdline:[`cat /proc/cmdline`]"
echo "dmesg | grep remote"
dmesg | grep remote || true
echo "dmesg | grep pru"
dmesg | grep pru || true
echo "dmesg | grep pinctrl-single"
dmesg | grep pinctrl-single || true
echo "dmesg | grep gpio-of-helper"
dmesg | grep gpio-of-helper || true
echo "dmesg | grep wlcore"
dmesg | grep wlcore || true
echo "lsusb"
lsusb || true
echo "END"
#