-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_toolchain.sh
executable file
·87 lines (71 loc) · 2.22 KB
/
setup_toolchain.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
#!/bin/bash
# setup_toolchain.sh - Morc @ 370network
echo "=================="
echo "370network paxdevs"
echo "= toolchain ="
echo "=================="
echo ""
echo ""
echo "Cache setup!"
if [ ! -d cache ]; then
echo "Cache directory create"
mkdir cache
fi
echo ""
echo ""
echo "Toolchain setup!"
if [ -f cache/toolchain.tar.bz2 ]; then
echo "Toolchain already exists"
else
echo "Toolchain download"
wget https://forum.370.network/download/file.php?id=287 -O cache/toolchain.tar.bz2
fi
if [ ! -d toolchain/bin ]; then
echo "Toolchain unpack"
tar -jxf cache/toolchain.tar.bz2 --strip-components=1 -C $PWD/toolchain
else
echo "Toolchain already unpacked"
fi
if [ ! -f toolchain/bin/arm-none-linux-gnueabi-gcc-ar ]; then
echo "Toolchain gcc ar copy"
cp toolchain/bin/arm-none-linux-gnueabi-ar toolchain/bin/arm-none-linux-gnueabi-gcc-ar
else
echo "Toolchain gcc-ar already copied"
fi
echo ""
echo ""
echo "XCB setup!"
if [ -d xcb ]; then
echo "XCB already exists"
else
echo "XCB download"
git clone https://git.lsd.cat/g/prolin-xcb-client.git xcb --depth=1
fi
echo "XCB client.py setup!"
read -p "Enter device address (IP or whole /dev/ path): " addr
if [[ "$addr" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
new_device="device.ConnectDevice(port_path=None, serial=\"$addr:5555\")"
else
new_device="device.ConnectDevice(port_path=None, serial=\"$addr,115200\")"
fi
if [ "$(uname)" == "Darwin" ]; then
sed -i '' "s|device.ConnectDevice(port_path=None, serial=[^)]*)|$new_device|" xcb/client.py
else
sed -i "s|device.ConnectDevice(port_path=None, serial=[^)]*)|$new_device|" xcb/client.py
fi
echo "XCB env"
python3 -m venv xcb
source xcb/bin/activate
pip3 install pyserial libusb1 setuptools
if [ "$(uname)" == "Darwin" ]; then
export CFLAGS=$(pkg-config --cflags openssl)
export LDFLAGS=$(pkg-config --libs openssl)
export SWIG_FEATURES="-cpperraswarn -includeall $(pkg-config --cflags openssl)"
pip3 install --pre --no-binary :all: M2Crypto --no-cache
else
pip3 install M2Crypto==0.40.0
fi
echo ""
echo ""
echo "Initial setup done!"
echo "In case of errors, please use your eyes and read. Continue by opening https://github.com/370network/pax-s920/issues and report problems."