diff --git a/NTCNA/README.txt b/NTCNA/README.txt new file mode 100644 index 0000000..13bdbf5 --- /dev/null +++ b/NTCNA/README.txt @@ -0,0 +1,21 @@ + + Raspberry Pi 3 (RPi) Setup + ========================== + +After writing the MicroSD card with the Raspbian image downloaded from the raspberrypi.org site, +put it into the MicroSD card slot on the RPi and power it up. + +Open a console window, and run the following commands. + +sudo apt-get update +sudo install git subversion +mkdir NTCNA +cd NTCNA +svn co https://www.probestar.com/NTCNA/CVehicle (password is temppwd) +cd NTCNA/CVehicle/trunk/platforms/bboneb +./rpi-setup.sh + +Takes awhile till it is done. There is a lot of software to install. +Powercycle the BBB. + +Adjust start_v2v.sh link as needed, re-run to run the right apps. diff --git a/NTCNA/etc/can.conf b/NTCNA/etc/can.conf new file mode 100644 index 0000000..c0b476a --- /dev/null +++ b/NTCNA/etc/can.conf @@ -0,0 +1,4 @@ +[default] +interface = socketcan_native +channel = can0 + diff --git a/NTCNA/etc/dhcpcd.conf b/NTCNA/etc/dhcpcd.conf new file mode 100644 index 0000000..68a62c5 --- /dev/null +++ b/NTCNA/etc/dhcpcd.conf @@ -0,0 +1,59 @@ +# A sample configuration for dhcpcd. +# See dhcpcd.conf(5) for details. + +# Allow users of this group to interact with dhcpcd via the control socket. +#controlgroup wheel + +# Inform the DHCP server of our hostname for DDNS. +hostname + +# Use the hardware address of the interface for the Client ID. +clientid +# or +# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361. +# Some non-RFC compliant DHCP servers do not reply with this set. +# In this case, comment out duid and enable clientid above. +#duid + +# Persist interface configuration when dhcpcd exits. +persistent + +# Rapid commit support. +# Safe to enable by default because it requires the equivalent option set +# on the server to actually work. +option rapid_commit + +# A list of options to request from the DHCP server. +option domain_name_servers, domain_name, domain_search, host_name +option classless_static_routes +# Respect the network MTU. This is applied to DHCP routes. +option interface_mtu + +# Most distributions have NTP support. +#option ntp_servers + +# A ServerID is required by RFC2131. +require dhcp_server_identifier + +# Generate SLAAC address using the Hardware Address of the interface +#slaac hwaddr +# OR generate Stable Private IPv6 Addresses based from the DUID +slaac private + +# Example static IP configuration: +interface eth0 +static ip_address=192.168.1.12/24 +#static ip6_address=fd51:42f8:caae:d92e::ff/64 +#static routers=192.168.2.1 +#static domain_name_servers=192.168.2.1 8.8.8.8 + +# It is possible to fall back to a static IP if DHCP fails: +# define static profile +#profile static_eth0 +#static ip_address=192.168.1.23/24 +#static routers=192.168.1.1 +#static domain_name_servers=192.168.1.1 + +# fallback to static profile on eth0 +#interface eth0 +#fallback static_eth0 diff --git a/NTCNA/etc/hosts b/NTCNA/etc/hosts new file mode 100644 index 0000000..160287a --- /dev/null +++ b/NTCNA/etc/hosts @@ -0,0 +1,19 @@ +127.0.0.1 localhost +127.0.1.1 raspberrypi pi raspberry + +# vehicle network +192.168.2.1 router +192.168.2.2 wsu obe obu +192.168.2.10 mabx2 +192.168.2.12 pi pi1 +192.168.2.15 carpc +192.168.1.77 denso pod wsu-77 +192.168.2.98 winpc +192.168.2.99 linpc + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters diff --git a/NTCNA/etc/ld.so.conf.d/cvehicle.conf b/NTCNA/etc/ld.so.conf.d/cvehicle.conf new file mode 100644 index 0000000..5c28b76 --- /dev/null +++ b/NTCNA/etc/ld.so.conf.d/cvehicle.conf @@ -0,0 +1,2 @@ +# NTCNA CVehicle library +/usr/local/cvehicle/lib diff --git a/NTCNA/etc/ld.so.conf.d/pstar.conf b/NTCNA/etc/ld.so.conf.d/pstar.conf new file mode 100644 index 0000000..eb49e99 --- /dev/null +++ b/NTCNA/etc/ld.so.conf.d/pstar.conf @@ -0,0 +1,2 @@ +# other libs +/usr/local/pstar/lib diff --git a/NTCNA/etc/rc.local b/NTCNA/etc/rc.local new file mode 100644 index 0000000..3d228f1 --- /dev/null +++ b/NTCNA/etc/rc.local @@ -0,0 +1,26 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +# CAN +ip link set can0 type can bitrate 500000 listen-only on +ifconfig can0 up + +# CVehicle +/usr/local/cvehicle/sbin/cvehicle-setup +#cd /home/debian/NTCNA/CVehicle/trunk/daemons/bsmpd +#bsmpd -c can0 -m bsmpbeat.xml -t 50 -w - + +# PyVehicle (DVI) +#chmod +x /home/debian/NTCNA/PyVehicle/bin/*.sh + +exit 0 diff --git a/NTCNA/etc/systemd/system/multi-user.target.wants/gpsd.service b/NTCNA/etc/systemd/system/multi-user.target.wants/gpsd.service new file mode 100644 index 0000000..95f05a8 --- /dev/null +++ b/NTCNA/etc/systemd/system/multi-user.target.wants/gpsd.service @@ -0,0 +1,15 @@ +[Unit] +Description=GPS (Global Positioning System) Daemon +Requires=gpsd.socket +# Needed with chrony SOCK refclock +After=chronyd.service + +[Service] +Type=forking +EnvironmentFile=-/etc/default/gpsd +ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES + +[Install] +WantedBy=multi-user.target +Also=gpsd.socket + diff --git a/NTCNA/etc/systemd/system/sockets.target.wants/gpsd.socket b/NTCNA/etc/systemd/system/sockets.target.wants/gpsd.socket new file mode 100644 index 0000000..80181e9 --- /dev/null +++ b/NTCNA/etc/systemd/system/sockets.target.wants/gpsd.socket @@ -0,0 +1,11 @@ +[Unit] +Description=GPS (Global Positioning System) Daemon Sockets + +[Socket] +ListenStream=/var/run/gpsd.sock +ListenStream=[::1]:2947 +ListenStream=0.0.0.0:2947 +SocketMode=0600 + +[Install] +WantedBy=sockets.target diff --git a/NTCNA/home/pi/.config/lxsession/LXDE-pi/autostart b/NTCNA/home/pi/.config/lxsession/LXDE-pi/autostart new file mode 100644 index 0000000..cc77be0 --- /dev/null +++ b/NTCNA/home/pi/.config/lxsession/LXDE-pi/autostart @@ -0,0 +1,5 @@ +@lxpanel --profile LXDE-pi +@pcmanfm --desktop --profile LXDE-pi +@xscreensaver -no-splash +@point-rpi +@/home/pi/start_v2x.sh diff --git a/NTCNA/home/pi/.vnc/passwd b/NTCNA/home/pi/.vnc/passwd new file mode 100644 index 0000000..575db67 --- /dev/null +++ b/NTCNA/home/pi/.vnc/passwd @@ -0,0 +1 @@ +³‚þoø¬Ñ© \ No newline at end of file diff --git a/NTCNA/lib/systemd/system/rc-local.service b/NTCNA/lib/systemd/system/rc-local.service new file mode 100644 index 0000000..4cd18d0 --- /dev/null +++ b/NTCNA/lib/systemd/system/rc-local.service @@ -0,0 +1,21 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +[Unit] +Description=/etc/rc.local Compatibility +ConditionPathExists=/etc/rc.local + +[Service] +Type=forking +ExecStart=/etc/rc.local start +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes +SysVStartPriority=99 + +[Install] +WantedBy=multi-user.target diff --git a/NTCNA/lib/systemd/system/x11vnc.service b/NTCNA/lib/systemd/system/x11vnc.service new file mode 100644 index 0000000..201167f --- /dev/null +++ b/NTCNA/lib/systemd/system/x11vnc.service @@ -0,0 +1,11 @@ +[Unit] +Description=Start x11vnc at startup. +After=multi-user.target + +[Service] +Type=simple +ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/vnc.passwd -rfbport 5900 -shared + +[Install] +WantedBy=multi-user.target + diff --git a/NTCNA/rpi-setup.sh b/NTCNA/rpi-setup.sh new file mode 100755 index 0000000..6068ca1 --- /dev/null +++ b/NTCNA/rpi-setup.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# copy config files +for i in etc lib usr home +do + sudo cp -r $i/* /$i/ +done + +# network + +# Need rc.local to start CAN and BSMPd +#sudo systemctl enable rc-local.service +#sudo systemctl enable x11vnc.service + +# update & clean +sudo apt-get update +sudo apt-get dist-upgrade +sudo apt-get install -y ntpdate subversion git cmake +sudo apt-get -y autoremove +sudo apt-get clean + +# enable GUI +sudo systemctl set-default graphical.target + +# time +sudo ntpdate pool.ntp.org +sudo hwclock -w +sudo apt-get update + +# clone/pull +mkdir -p $HOME/ProbeStar +cd $HOME/ProbeStar +for i in git_tools linux_tools pi_tools Cnomicon Pynomicon +do + if [ -d $i ]; then + cd $i + git config credential.helper store + git pull --recurse-submodules + cd .. + else + git clone https://github.com/nprobert/$i --recurse-submodules + cd $i + git config credential.helper store + cd .. + fi +done +cd $HOME +for i in ProbeStar/*; do + ln -fs $i +done +mkdir bin +cp linux_tools/bin/* bin/ + +# checkouts +mkdir -p $HOME/NTCNA +cd $HOME/NTCNA +for i in CVehicle PyVehicle +do + if [ -d $i ]; then + cd $i + git config credential.helper store + git pull --recurse-submodules + cd .. + else + git clone https://github.com/nprobert/$i --recurse-submodules + cd $i + git config credential.helper store + cd .. + fi +done +cd $HOME +for i in NTCNA/*; do + ln -fs $i +done + +# packages & builds +if [ -d $HOME/ProbeStar/Cnomicon ]; then + cd $HOME/Cnomicon/packages + sudo ./packages.sh + cd .. + ./cbuild.sh + ./cinstall.sh +fi + +if [ -d $HOME/NTCNA/CVehicle ]; then + cd $HOME/CVehicle/packages + sudo ./packages.sh + cd .. + ./cbuild.sh + ./cinstall.sh +fi + +# python stuff +cd $HOME/NTCNA/Pynomicon/packages +sudo ./packages.sh +chmod +x $HOME/Pynomicon/bin/*.sh +cd $HOME/NTCNA/PyVehicle/packages +sudo ./packages.sh +chmod +x $HOME/PyVehicle/bin/*.sh + +# cleanup +sudo raspi-config diff --git a/NTCNA/rpi-update.sh b/NTCNA/rpi-update.sh new file mode 100755 index 0000000..be6630b --- /dev/null +++ b/NTCNA/rpi-update.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# copy config files +sudo cp -r etc lib usr home / + +# Need rc.local to start CAN and BSMPd +sudo systemctl enable rc-local.service + +# update +sudo ntpdate pool.ntp.org +sudo hwclock -w + +# checkouts +ntcna-update.sh + +# rebuild +#cd $HOME/NTCNA/CVehicle +#./build.sh +#./install.sh diff --git a/NTCNA/usr/local/bin/all-update.sh b/NTCNA/usr/local/bin/all-update.sh new file mode 100755 index 0000000..1a9b686 --- /dev/null +++ b/NTCNA/usr/local/bin/all-update.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +cd $HOME + +for i in ProbeStar NTCNA CAMP Gits +do + if [ -L "$i" ]; then + echo "$i: Symlinked" + echo "=============" + elif [ -d "$i" ]; then + if [ "$i" == "ProbeStar" ]; then + $HOME/bin/pstar-update.sh + else + d=`echo "${i,,}"` + $HOME/bin/$d-update.sh + fi + fi +done + diff --git a/NTCNA/usr/local/bin/ntcna-update.sh b/NTCNA/usr/local/bin/ntcna-update.sh new file mode 100755 index 0000000..56d8b36 --- /dev/null +++ b/NTCNA/usr/local/bin/ntcna-update.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +function do_git { + echo $1 "(Git)" + cd $1 + git ls-remote --get-url + git pull + cd .. + echo +} + +function do_merc { + echo $1 "(Mercurial)" + cd $1 + hg pull -uv + cd .. + echo +} + +function do_svn { + echo $1 "(Subversion)" + cd $1 + svn info --show-item url + svn update + cd .. + echo +} + +function do_dir { + pwd + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/NTCNA ]; then + cd $HOME/NTCNA + echo "NTCNA Repositories" + echo "==================" + do_dir . + echo "==================" +fi + diff --git a/NTCNA/usr/local/bin/pstar-update.sh b/NTCNA/usr/local/bin/pstar-update.sh new file mode 100755 index 0000000..03e9029 --- /dev/null +++ b/NTCNA/usr/local/bin/pstar-update.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +function do_git { + echo $1 "(Git)" + cd $1 + git ls-remote --get-url + git pull + cd .. + echo +} + +function do_merc { + echo $1 "(Mercurial)" + cd $1 + hg pull -u + cd .. + echo +} + +function do_svn { + echo $1 "(Subversion)" + cd $1 + svn info --show-item url + svn update + cd .. + echo +} + +function do_dir { + pwd + echo $1 + echo "-----------------" + for i in * + do + if [ -d $i ]; then + if [ -d $i/.git ]; then + do_git $i + elif [ -d $i/.hg ]; then + do_merc $i + elif [ -d $i/.svn ]; then + do_svn $i + else + cd $i + do_dir $i + cd .. + fi + fi + done +} + +if [ -d $HOME/ProbeStar ]; then + cd $HOME/ProbeStar + echo "P* Repositories:" + echo "================" + do_dir . + echo "================" +fi diff --git a/NTCNA/usr/local/sbin/start_vnc.sh b/NTCNA/usr/local/sbin/start_vnc.sh new file mode 100644 index 0000000..e6c5b35 --- /dev/null +++ b/NTCNA/usr/local/sbin/start_vnc.sh @@ -0,0 +1,3 @@ +#!/bin/bash +x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -rfbauth /etc/x11vnc.pass -auth /etc/x11vnc.pass -forever +