comparison scripts/setup_board.sh @ 58:3ffafa57302c newapi

Added scripts for building on board
author andrewm
date Wed, 15 Jul 2015 15:49:00 +0100
parents
children 3ada83df91a5
comparison
equal deleted inserted replaced
57:72726dd4f66c 58:3ffafa57302c
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 "kill -s 2 \`pidof BeagleRT\` 2>/dev/null ; 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 # Make remaining directories needed for building
54 echo "Creating directory structure on BeagleBone..."
55 ssh $BBB_ADDRESS "mkdir $BBB_PATH/source ; mkdir $BBB_PATH/build ; mkdir $BBB_PATH/build/core ; mkdir $BBB_PATH/build/source"
56
57 echo "Done."
58 fi
59