--- /dev/null
+#!/bin/ksh
+
+BBB_IP="0"
+PATHSAVE=`pwd`
+OURF=`basename $0`
+TMPF=$OURF.tmp
+RUSER=root
+
+check_kern() {
+ if ssh $RUSER@$BBB_IP stat /bsd.safe \> /dev/null 2\>\&1 ; then
+ return
+ else
+ echo "/bsd.safe not found -- copying /bsd to /bsd.safe"
+ ssh $RUSER@$BBB_IP 'cp /bsd /bsd.safe'
+ fi
+}
+
+cd `dirname $0`
+
+if [[ $BBB_IP == "0" || $1 == "-f" ]]; then
+ echo -n "Enter BBB's IP address or host: "
+ read BBB_NEWIP
+ cat $OURF | sed -E -e "s/^BBB_IP=.*$/BBB_IP=$BBB_NEWIP/" > $TMPF
+ mv $TMPF $OURF && chmod +x $OURF
+fi
+
+cd $PATHSAVE
+
+if [[ ! -f ./obj.amd64.armv7/bsd && ! -f ./bsd ]]; then
+ echo "Run me in your compile/<target>/ directory"
+ exit 1
+fi
+
+check_kern
+
+if [[ -f ./obj.amd64.armv7/bsd ]]; then
+ scp ./obj.amd64.armv7/bsd $RUSER@$BBB_IP:/bsd
+else
+ scp ./bsd $RUSER@$BBB_IP:/bsd
+fi
+
+echo -n "Reboot it? (y/n): "
+read BOOT
+case $BOOT in
+ yes|Yes|y|Y)
+ echo "Rebooting..."
+ ssh $RUSER@$BBB_IP '{ sleep 1; reboot -f; } >/dev/null &'
+ ;;
+ no|No|n|N|"")
+ exit 0
+ ;;
+esac