comparison 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
comparison
equal deleted inserted replaced
366:2ea5ed159f21 367:b49dc040af73
2 # 2 #
3 # This script copies the core BeagleRT files to the BeagleBone Black 3 # This script copies the core BeagleRT files to the BeagleBone Black
4 # in preparation for building projects. It will remove any existing 4 # in preparation for building projects. It will remove any existing
5 # BeagleRT directory before copying the files over 5 # BeagleRT directory before copying the files over
6 6
7 BBB_ADDRESS="root@192.168.7.2" 7 [ -z "$BBB_ADDRESS" ] && BBB_ADDRESS="root@192.168.7.2"
8 BBB_PATH="~/BeagleRT" 8 [ -z "$BBB_BELA_HOME" ] && BBB_BELA_HOME="~/BeagleRT/"
9 9
10 function usage 10 function usage
11 { 11 {
12 THIS_SCRIPT=`basename "$0"` 12 THIS_SCRIPT=`basename "$0"`
13 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone]" 13 echo "Usage: $THIS_SCRIPT [-b path-on-beaglebone]"
14 14
15 echo " 15 echo "
16 This script copies the core BeagleRT files to the BeagleBone, REMOVING 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 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 18 running any of the other build scripts in this directory. The -b option
19 changes the default path, which is otherwise $BBB_PATH." 19 changes the default path, which is otherwise $BBB_BELA_HOME."
20 } 20 }
21 21
22 OPTIND=1 22 OPTIND=1
23 23
24 while getopts "b:h" opt; do 24 while getopts "b:h" opt; do
25 case $opt in 25 case $opt in
26 b) BBB_PATH=$OPTARG 26 b) BBB_BELA_HOME=$OPTARG
27 ;; 27 ;;
28 h|\?) usage 28 h|\?) usage
29 exit 1 29 exit 1
30 esac 30 esac
31 done 31 done
32 32
33 echo "Copying BeagleRT core files to $BBB_PATH" 33 echo "Copying BeagleRT core files to $BBB_BELA_HOME"
34 34
35 shift $((OPTIND-1)) 35 shift $((OPTIND-1))
36 36
37 # Find location of this script so we can locate the rest of the files 37 # Find location of this script so we can locate the rest of the files
38 SCRIPTPATH=$(readlink "$0") 38 SCRIPTPATH=$(readlink "$0")
42 echo 42 echo
43 if [[ $REPLY = [yY] ]] 43 if [[ $REPLY = [yY] ]]
44 then 44 then
45 # Stop BeagleRT if running and remove all files 45 # Stop BeagleRT if running and remove all files
46 echo "Stopping BeagleRT and removing old files." 46 echo "Stopping BeagleRT and removing old files."
47 ssh $BBB_ADDRESS "screen -X -S BeagleRT quit &>/dev/null; pkill BeagleRT; sleep 0.5 ; rm -rf $BBB_PATH ; mkdir $BBB_PATH" 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"
48 48
49 # Copy relevant files to BeagleBone Black 49 # Copy relevant files to BeagleBone Black
50 echo "Copying new files to BeagleBone..." 50 echo "Copying new files to BeagleBone..."
51 scp -r $SCRIPTDIR/../core $SCRIPTDIR/../include $SCRIPTDIR/../Makefile $SCRIPTDIR/../libNE10.a $SCRIPTDIR/../libprussdrv.a $SCRIPTDIR/../examples $BBB_ADDRESS:$BBB_PATH &&\ 51 scp -r $SCRIPTDIR/../core $SCRIPTDIR/../include $SCRIPTDIR/../Makefile $SCRIPTDIR/../libNE10.a $SCRIPTDIR/../libprussdrv.a $SCRIPTDIR/../examples $BBB_ADDRESS:$BBB_BELA_HOME &&\
52 scp $SCRIPTDIR/../libpd.so $BBB_ADDRESS:/usr/lib 52 scp $SCRIPTDIR/../libpd.so $BBB_ADDRESS:/usr/lib
53 if [ $? -ne 0 ] 53 if [ $? -ne 0 ]
54 then 54 then
55 echo "Error while copying files" 55 echo "Error while copying files"
56 exit 56 exit
57 fi 57 fi
58 # Make remaining directories needed for building 58 # Make remaining directories needed for building
59 echo "Creating directory structure on BeagleBone..." 59 echo "Creating directory structure on BeagleBone..."
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" &&\ 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" &&\
61 echo "Done." 61 echo "Done."
62 else 62 else
63 echo "Aborting..." 63 echo "Aborting..."
64 fi 64 fi
65 65