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
|
giuliomoro@300
|
38 SCRIPTPATH=$(readlink "$0")
|
andrewm@58
|
39 SCRIPTDIR=$(dirname "$SCRIPTPATH")
|
andrewm@58
|
40
|
giuliomoro@243
|
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@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..."
|
giuliomoro@300
|
51 scp -r $SCRIPTDIR/../core $SCRIPTDIR/../include $SCRIPTDIR/../Makefile $SCRIPTDIR/../libNE10.a $SCRIPTDIR/../libprussdrv.a $SCRIPTDIR/../examples $BBB_ADDRESS:$BBB_PATH &&\
|
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@300
|
60 ssh $BBB_ADDRESS "mkdir -p $BBB_PATH/build ; mkdir -p $BBB_PATH/build/core ; mkdir -p $BBB_PATH/build/projects; mkdir -p $BBB_PATH/projects" &&\
|
andrewm@58
|
61 echo "Done."
|
giuliomoro@83
|
62 else
|
giuliomoro@83
|
63 echo "Aborting..."
|
andrewm@58
|
64 fi
|
andrewm@58
|
65
|