forked from Gernby/raspberry-pilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_raspilot.sh
105 lines (92 loc) · 4.15 KB
/
install_raspilot.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# this script is meant to run on a fresh image of 64-bit Ubuntu Server for ARM, specifically Raspberry Pi 4.
# However, I think it should work for any ARM64 SBC on 64-bit Ubuntu for ARM.
#
# NOTE: A fresh image has unattended-upgrades enabled. You must wait
# for the initial upgrade to complete before running this script
#
# Download the image for RPi4 here
# https://ubuntu.com/download/raspberry-pi/thank-you?version=18.04.4&architecture=arm64+raspi3
#
# For other ARM64, download from here.
# http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-server-arm64.iso
#
# create flash using something like Balena Etcher
# https://www.balena.io/etcher/
#
# In Linux:
# xzcat ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz | sudo dd bs=4M of=/dev/blkmmc0
#
# connect to LAN, monitor and keyboard
# change default password for ubuntu (default login is ubuntu / ubuntu)
# ifconfig to get IP address
# SSH into RPi
# ssh ubuntu@<ip address>
#
# connect to Wifi
# sudo apt install network-manager
# systemctl start NetworkManager
# nmcli d wifi list
# nmcli d wifi connect <WiFiSSID> password <WiFiPassword>
#
# monitor CPU temperature
# cat /sys/class/thermal/thermal_zone0/temp
# 42355 = 42.355 C
# update software from repository
sudo apt update
# disable unattended upgrades
sudo apt remove -y unattended-upgrades
# update Ubuntu and clean up
sudo apt full-upgrade -y
sudo apt autoremove -y
# install dependencies
sudo apt install -y build-essential make automake python3-numpy python3-dev python3-pip python3-mock python3-scipy
sudo apt install -y openjdk-8-jdk automake autoconf zip unzip libtool swig libpng-dev zlib1g-dev pkg-config
sudo apt install -y libhdf5-dev bzip2 clang git libarchive-dev libavcodec-dev libavdevice-dev libavfilter-dev
sudo apt install -y libavresample-dev libavutil-dev libffi-dev libglib2.0-0 libssl-dev libswscale-dev
sudo apt install -y libtool libusb-1.0-0 libzmq5-dev ocl-icd-libopencl1 ocl-icd-opencl-dev
sudo apt install -y opencl-headers pkg-config python-pip wget checkinstall libusb-1.0
sudo apt install -y clang-3.8 libatlas-base-dev libopenblas-base libopenblas-dev gcc gfortran ocl-icd-opencl-dev
sudo apt install -y capnproto opencl-headers autotools-dev uuid-dev libsodium-dev valgrind python-qt4
sudo apt install -y libusb-dev cmake libnewlib-arm-none-eabi libhdf5-serial-dev hdf5-tools smbclient
sudo apt install -y influxdb apt-transport-https software-properties-common adduser libfontconfig1
wget https://dl.grafana.com/oss/release/grafana_6.6.2_arm64.deb
sudo dpkg -i grafana_6.6.2_arm64.deb
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server
sudo service influxdb start
sudo service grafana-server start
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar -xvf Python-3.7.3.tgz
cd Python-3.7.3
# The enable-optimizations option is important!
./configure --enable-optimizations
# This will take an hour with occasional "pauses" as long as 15 minutes! It actually has to run a second time to get the optimizations right
sudo make
# This will also take a long time while "writing files to temporary folder" (or something like that)
sudo checkinstall
cd ~/
git clone https://github.com/gernby/raspberry-pilot.git raspilot
pip3 install pipenv --user
# Exit SSH and log in again, since pipenv won't work without it
cd raspilot
sudo mkdir /data
sudo mkdir /data/params
sudo chown ubuntu /data
sudo chown ubuntu /data/params
sudo tee /etc/udev/rules.d/11-panda.rules <<EOF
SUBSYSTEM=="usb", ATTRS{idVendor}=="bbaa", ATTRS{idProduct}=="ddcc", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="bbaa", ATTRS{idProduct}=="ddee", MODE="0666"
SUBSYSTEMS=="usb", ATTR{idVendor}=="bbaa", ATTR{idProduct}=="ddcc", MODE:="0666"
SUBSYSTEMS=="usb", ATTR{idVendor}=="bbaa", ATTR{idProduct}=="ddee", MODE:="0666"
EOF
sudo udevadm control --reload-rules && sudo udevadm trigger
(crontab -l; echo "@reboot bash raspilot/launch_openpilot.sh";) | crontab -
crontab -l
sudo cp ~/raspilot/phonelibs/usercfg.txt /boot/firmware/usercfg.txt
sudo cp ~/raspilot/phonelibs/influxdb.conf /etc/influxdb/influxdb.conf
sudo apt --fix-broken install -y
sudo apt clean -y
sudo bash phonelibs/install_capnp.sh
pipenv install
pipenv run bash build_all.sh