-
Notifications
You must be signed in to change notification settings - Fork 38
/
mk_resources.sh
executable file
·74 lines (62 loc) · 1.94 KB
/
mk_resources.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
#!/bin/bash
BREW_SDK="$HOME/Library/Application Support/Pebble SDK/SDKs/current/sdk-core/pebble"
if hash brew 2>/dev/null;then
BREW=1
fi
if [ $# -eq 1 ];then
SDK=$1
else
if [ ! -z "$BREW" ];then
SDK=$BREW_SDK
else
echo "usage: $0 SDK-path"
exit 1
fi
fi
echo "Extracting resources from $SDK..."
if [ ! -f "$SDK/aplite/qemu/qemu_micro_flash.bin" ]; then
echo "$SDK/aplite/qemu/qemu_micro_flash.bin doesn't look like an SDK path to me, buster"
exit 1
fi
mkdir -p Resources
if [ -f Resources/snowy_boot.bin ]; then
echo "snowy_boot already exists, not overwriting"
else
dd if="$SDK/basalt/qemu/qemu_micro_flash.bin" of=Resources/snowy_boot.bin bs=16384 count=1
fi
if [ -f Resources/snowy_spi.bin ]; then
echo "snowy_spi already exists, not overwriting"
else
if [ -f "$SDK/basalt/qemu/qemu_spi_flash.bin.bz2" ];then
bzip2 -d "$SDK/basalt/qemu/qemu_spi_flash.bin.bz2"
fi
cp "$SDK/basalt/qemu/qemu_spi_flash.bin" "Resources/snowy_spi.bin"
fi
if [ -f Resources/tintin_boot.bin ]; then
echo "tintin_boot already exists, not overwriting"
else
dd if="$SDK/aplite/qemu/qemu_micro_flash.bin" of=Resources/tintin_boot.bin bs=16384 count=1
fi
if [ -f Resources/tintin_spi.bin ]; then
echo "tintin_spi already exists, not overwriting"
else
if [ -f "$SDK/aplite/qemu/qemu_spi_flash.bin.bz2" ];then
bzip2 -d "$SDK/aplite/qemu/qemu_spi_flash.bin.bz2"
fi
cp "$SDK/aplite/qemu/qemu_spi_flash.bin" "Resources/tintin_spi.bin"
fi
if [ -f Resources/chalk_boot.bin ]; then
echo "tintin_boot already exists, not overwriting"
else
dd if="$SDK/chalk/qemu/qemu_micro_flash.bin" of=Resources/chalk_boot.bin bs=16384 count=1
fi
if [ -f Resources/chalk_spi.bin ]; then
echo "tintin_spi already exists, not overwriting"
else
if [ -f "$SDK/chalk/qemu/qemu_spi_flash.bin.bz2" ];then
bzip2 -d "$SDK/chalk/qemu/qemu_spi_flash.bin.bz2"
fi
cp "$SDK/chalk/qemu/qemu_spi_flash.bin" "Resources/chalk_spi.bin"
fi
echo "all done"
echo "you may have to execute 'cp Resources/* ../Resources/"