-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sh
executable file
·85 lines (68 loc) · 1.96 KB
/
build.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
#! /bin/bash
set -xe
[ $# -eq 1 ] || {
echo 'Wrong args count'
echo "Use $0 simple|plus"
exit 1
}
[ "$1" == 'simple' -o "$1" == 'plus' ] || {
echo "Wrong build type: $1"
echo "Use $0 simple|plus"
exit 1
}
SDK_MAJOR=2
SDK_MINOR=1
SDK_BUILD=0
SDK_VERSION="$SDK_MAJOR.$SDK_MINOR.$SDK_BUILD"
rm -f /vagrant/*.bin
cd
[ -d "crosstool-NG" ] || {
git clone --recursive -b xtensa-1.22.x 'https://github.com/espressif/crosstool-NG.git'
cd 'crosstool-NG'
./bootstrap
./configure --enable-local
make
sudo make install
./ct-ng xtensa-lx106-elf
./ct-ng build
chmod -R u+w builds/xtensa-lx106-elf
cd
}
[ -d "ESP8266_NONOS_SDK-$SDK_VERSION" ] || {
wget -q "https://github.com/espressif/ESP8266_NONOS_SDK/archive/v$SDK_VERSION.tar.gz"
tar -xf "v$SDK_VERSION.tar.gz"
rm "v$SDK_VERSION.tar.gz"
mkdir -p "ESP8266_NONOS_SDK-$SDK_VERSION/button"
}
[ -d 'esp_microc' ] || {
git clone --recursive 'https://github.com/anakod/esp_microc.git'
cp 'esp_microc/build/libmicroc.a' "ESP8266_NONOS_SDK-$SDK_VERSION/lib/."
}
export PATH="$PATH:$HOME/crosstool-NG/builds/xtensa-lx106-elf/bin"
cd "ESP8266_NONOS_SDK-$SDK_VERSION"
mount | grep "/home/vagrant/ESP8266_NONOS_SDK-$SDK_VERSION/button" || {
sudo mount --bind /vagrant/ button
}
cd 'button'
VERSION=$(./version.sh include/version.h)
make clean
make "$1"
make clean
make DEBUG=1 "$1"
[ -d '/vagrant/image' ] || {
mkdir "/vagrant/image"
}
cd '../bin'
if [ "$1" == 'simple' ]
then
mv "upgrade/Simple-FW-$VERSION-release.bin" '/vagrant/image/.'
mv "upgrade/Simple-FW-$VERSION-develop.bin" '/vagrant/image/.'
cd '../button/rom'
./button_rom.sh "/vagrant/image/Simple-FW-$VERSION-release.bin" "/vagrant/image/Simple-FLASH-FW-$VERSION.bin"
else
mv "upgrade/Plus-FW-$VERSION-release.bin" '/vagrant/image/.'
mv "upgrade/Plus-FW-$VERSION-develop.bin" '/vagrant/image/.'
cd '../button/rom'
./button_rom.sh "/vagrant/image/Plus-FW-$VERSION-release.bin" "/vagrant/image/Plus-FLASH-FW-$VERSION.bin"
fi
echo 'CONGRATULATION! BUTID SUCCESSFULLY'