annotate scripts/setup_board.sh @ 151:e9c9404e3d1f ClockSync

Pff partially working. No PID. When setting the audio clock on the bbb to 44098 the master and slave clock keep diverging instead of converging ...
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 22 Sep 2015 04:10:07 +0100
parents 91e1a3a220d4
children 0357b8df93a5
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
andrewm@58 7 BBB_ADDRESS="root@192.168.7.2"
andrewm@58 8 BBB_PATH="~/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
andrewm@58 19 changes the default path, which is otherwise $BBB_PATH."
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
andrewm@58 26 b) BBB_PATH=$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
andrewm@58 33 echo "Copying BeagleRT core files to $BBB_PATH"
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
andrewm@58 38 SCRIPTPATH=$(readlink -f "$0")
andrewm@58 39 SCRIPTDIR=$(dirname "$SCRIPTPATH")
andrewm@58 40
andrewm@58 41 read -p "Warning: this script will DELETE any existing BeagleRT files from your BeagleBone! Continue? " -n 1 -r
andrewm@58 42 echo
giuliomoro@83 43 if [[ $REPLY = y ]]
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@85 47 ssh $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT; sleep 0.5 ; rm -rf $BBB_PATH ; mkdir $BBB_PATH"
andrewm@58 48
andrewm@58 49 # Copy relevant files to BeagleBone Black
andrewm@58 50 echo "Copying new files to BeagleBone..."
andrewm@58 51 scp -r $SCRIPTDIR/../core $SCRIPTDIR/../include $SCRIPTDIR/../Makefile $SCRIPTDIR/../libNE10.a $SCRIPTDIR/../libprussdrv.a $BBB_ADDRESS:$BBB_PATH
andrewm@58 52
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@64 60 ssh $BBB_ADDRESS "mkdir -p $BBB_PATH/source ; mkdir -p $BBB_PATH/build ; mkdir -p $BBB_PATH/build/core ; mkdir -p $BBB_PATH/build/source" &&\
andrewm@58 61 echo "Done."
giuliomoro@83 62 else
giuliomoro@83 63 echo "Aborting..."
andrewm@58 64 fi
andrewm@58 65