blob: c9d257c6fd891efac293c216cb34ce2acc95bbbb (
plain)
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
|
#!/bin/bash
# Copyright (c) 2016, Intel Corporation.
# Author: Geoff Gustafson <geoff@linux.intel.com>
# bldetect - detect current sizes of X86 and ARC partitions on Arduino 101
# requires: dfu-util is installed, e.g. sudo apt-get install dfu-util
# effects: reports sizes of x86, arc, and boot partition; or with -l flag
# just reads tiny panic partition to leave device in DFU mode
function check() {
echo -n "Checking $1 ($2) partition size... "
rm -f /tmp/bl-image.$2
dfu-util -a $2 -U /tmp/bl-image.$2 > /dev/null
if [ $? -ne 0 ]; then
echo Reset the device and try command again a few seconds later!
exit 1
fi
echo $(ls -lh /tmp/bl-image.$2 | cut -d' ' -f5)
}
# only read panic partition in -l listen mode, leave device listening
if [ "x$1" == "x-l" ]; then
check panic panic > /dev/null
if [ $? -eq 0 ]; then
echo Device is now waiting in DFU mode.
exit 0
fi
exit 1
fi
check X86 x86_app
check ARC sensor_core
check Boot x86_boot
|