annotate scripts/setup_board.sh @ 367:b49dc040af73 prerelease

Updated setup_board
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 09 Jun 2016 01:58:06 +0100
parents ff5f346a293e
children a430a16d2c02
rev   line source
andrewm@58 1 #!/bin/bash
andrewm@58 2 #
andrewm@58 3 # This script copies the core BeagleRT files to the BeagleBone Black
andrewm@58 4 # in preparation for building projects. It will remove any existing
andrewm@58 5 # BeagleRT directory before copying the files over
andrewm@58 6
giuliomoro@367 7 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
giuliomoro@367 8 [ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/BeagleRT/"
andrewm@58 9
andrewm@58 10 function usage
andrewm@58 11 {
andrewm@58 12 THIS_SCRIPT=`basename "$0"`
andrewm@58 13 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone]"
andrewm@58 14
andrewm@58 15 echo "
andrewm@58 16 This script copies the core BeagleRT files to the BeagleBone, REMOVING
andrewm@58 17 any previous files found at that location. This should be done before
andrewm@58 18 running any of the other build scripts in this directory. The -b option
giuliomoro@367 19 changes the default path, which is otherwise $BBB_BELA_HOME."
andrewm@58 20 }
andrewm@58 21
andrewm@58 22 OPTIND=1
andrewm@58 23
andrewm@58 24 while getopts "b:h" opt; do
andrewm@58 25 case $opt in
giuliomoro@367 26 b) BBB_BELA_HOME=$OPTARG
andrewm@58 27 ;;
andrewm@58 28 h|\?) usage
andrewm@58 29 exit 1
andrewm@58 30 esac
andrewm@58 31 done
andrewm@58 32
giuliomoro@367 33 echo "Copying BeagleRT core files to $BBB_BELA_HOME"
andrewm@58 34
andrewm@58 35 shift $((OPTIND-1))
andrewm@58 36
andrewm@58 37 # Find location of this script so we can locate the rest of the files
giuliomoro@300 38 SCRIPTPATH=$(readlink "$0")
andrewm@58 39 SCRIPTDIR=$(dirname "$SCRIPTPATH")
andrewm@58 40
andrewm@307 41 read -p "Warning: this script will DELETE any existing BeagleRT files from your BeagleBone! Continue? (y/N) " -r
andrewm@58 42 echo
giuliomoro@243 43 if [[ $REPLY = [yY] ]]
andrewm@58 44 then
andrewm@58 45 # Stop BeagleRT if running and remove all files
andrewm@58 46 echo "Stopping BeagleRT and removing old files."
giuliomoro@367 47 ssh $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT; sleep 0.5 ; rm -rf $BBB_BELA_HOME ; mkdir $BBB_BELA_HOME"
andrewm@58 48
andrewm@58 49 # Copy relevant files to BeagleBone Black
andrewm@58 50 echo "Copying new files to BeagleBone..."
giuliomoro@367 51 scp -r $SCRIPTDIR/../core $SCRIPTDIR/../include $SCRIPTDIR/../Makefile $SCRIPTDIR/../libNE10.a $SCRIPTDIR/../libprussdrv.a $SCRIPTDIR/../examples $BBB_ADDRESS:$BBB_BELA_HOME &&\
giuliomoro@243 52 scp $SCRIPTDIR/../libpd.so $BBB_ADDRESS:/usr/lib
giuliomoro@64 53 if [ $? -ne 0 ]
giuliomoro@64 54 then
giuliomoro@64 55 echo "Error while copying files"
giuliomoro@64 56 exit
giuliomoro@64 57 fi
andrewm@58 58 # Make remaining directories needed for building
andrewm@58 59 echo "Creating directory structure on BeagleBone..."
giuliomoro@367 60 ssh $BBB_ADDRESS "mkdir -p $BBB_BELA_HOME/build ; mkdir -p $BBB_BELA_HOME/build/core ; mkdir -p $BBB_BELA_HOME/build/projects; mkdir -p $BBB_BELA_HOME/projects" &&\
andrewm@58 61 echo "Done."
giuliomoro@83 62 else
giuliomoro@83 63 echo "Aborting..."
andrewm@58 64 fi
andrewm@58 65