comparison scripts/setup_board.sh @ 67:472e892c6e41

Merge newapi into default
author Andrew McPherson <a.mcpherson@qmul.ac.uk>
date Fri, 17 Jul 2015 15:28:18 +0100
parents b89dd0c97a04
children eec746389e20
comparison
equal deleted inserted replaced
21:0d80ff9e2227 67:472e892c6e41
1 #!/bin/bash
2 #
3 # This script copies the core BeagleRT files to the BeagleBone Black
4 # in preparation for building projects. It will remove any existing
5 # BeagleRT directory before copying the files over
6
7 BBB_ADDRESS="root@192.168.7.2"
8 BBB_PATH="~/BeagleRT"
9
10 function usage
11 {
12 THIS_SCRIPT=`basename "$0"`
13 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone]"
14
15 echo "
16 This script copies the core BeagleRT files to the BeagleBone, REMOVING
17 any previous files found at that location. This should be done before
18 running any of the other build scripts in this directory. The -b option
19 changes the default path, which is otherwise $BBB_PATH."
20 }
21
22 OPTIND=1
23
24 while getopts "b:h" opt; do
25 case $opt in
26 b) BBB_PATH=$OPTARG
27 ;;
28 h|\?) usage
29 exit 1
30 esac
31 done
32
33 echo "Copying BeagleRT core files to $BBB_PATH"
34
35 shift $((OPTIND-1))
36
37 # Find location of this script so we can locate the rest of the files
38 SCRIPTPATH=$(readlink -f "$0")
39 SCRIPTDIR=$(dirname "$SCRIPTPATH")
40
41 read -p "Warning: this script will DELETE any existing BeagleRT files from your BeagleBone! Continue? " -n 1 -r
42 echo
43 if [[ $REPLY =~ ^[Yy]$ ]]
44 then
45 # Stop BeagleRT if running and remove all files
46 echo "Stopping BeagleRT and removing old files."
47 ssh $BBB_ADDRESS "screen -X -S BeagleRT quit ; pkill BeagleRT; sleep 0.5 ; rm -rf $BBB_PATH ; mkdir $BBB_PATH"
48
49 # Copy relevant files to BeagleBone Black
50 echo "Copying new files to BeagleBone..."
51 scp -r $SCRIPTDIR/../core $SCRIPTDIR/../include $SCRIPTDIR/../Makefile $SCRIPTDIR/../libNE10.a $SCRIPTDIR/../libprussdrv.a $BBB_ADDRESS:$BBB_PATH
52
53 if [ $? -ne 0 ]
54 then
55 echo "Error while copying files"
56 exit
57 fi
58 # Make remaining directories needed for building
59 echo "Creating directory structure on BeagleBone..."
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" &&\
61 echo "Done."
62 fi
63