diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index 6dc07ddaff..83d63a51a4 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -76,6 +76,14 @@ def build_all(): return False return True +def build_binaries(): + '''run the build_binaries.sh script''' + print("Running build_binaries.sh") + if util.run_cmd(util.reltopdir('Tools/scripts/build_binaries.sh'), dir=util.reltopdir('.')) != 0: + print("Failed build_binaries.sh") + return False + return True + def build_examples(): '''run the build_examples.sh script''' print("Running build_examples.sh") @@ -142,6 +150,7 @@ import arducopter, arduplane, apmrover2 steps = [ 'prerequesites', 'build.All', + 'build.Binaries', 'build.Examples', 'build1280.ArduPlane', @@ -247,6 +256,9 @@ def run_step(step): if step == 'build.All': return build_all() + if step == 'build.Binaries': + return build_binaries() + if step == 'build.Examples': return build_examples() diff --git a/Tools/scripts/build_binaries.sh b/Tools/scripts/build_binaries.sh new file mode 100755 index 0000000000..12417b12f9 --- /dev/null +++ b/Tools/scripts/build_binaries.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# script to build the latest binaries for each vehicle type, ready to upload +# Andrew Tridgell, March 2013 + +set -e +set -x + +export PATH=$PATH:/bin:/usr/bin + +export TMPDIR=$PWD/build.tmp.$$ +echo $TMDIR +rm -rf $TMPDIR +echo "Building in $TMPDIR" + +githash=$(git rev-parse HEAD) + +hdate=$(date +"%Y-%m/%Y-%m-%d-%H:%m") +mkdir -p binaries/$hdate +binaries=$PWD/../buildlogs/binaries + +copyit() { + file="$1" + dir="$2" + bname=$(basename $dir) + ldir=$(dirname $(dirname $dir))/latest/$bname + mkdir -p "$dir" + /bin/cp "$file" "$dir" + mkdir -p "$ldir" + rsync "$file" "$ldir" +} + +echo "Building ArduPlane binaries" +pushd ArduPlane +for b in apm1 apm2 apm1-hilsensors apm2-hilsensors; do + pwd + make clean + make $b -j4 + copyit $TMPDIR/ArduPlane.build/ArduPlane.hex $binaries/Plane/$hdate/$b +done +popd + +echo "Building ArduCopter binaries" +pushd ArduCopter +for b in apm1 apm2 apm1-hil apm2-hil; do + pwd + make clean + make $b -j4 + copyit $TMPDIR/ArduCopter.build/ArduCopter.hex $binaries/Copter/$hdate/$b +done +popd + +echo "Building APMRover2 binaries" +pushd APMrover2 +for b in apm1 apm2; do + pwd + make clean + make $b -j4 + copyit $TMPDIR/APMrover2.build/APMrover2.hex $binaries/Rover/$hdate/$b +done +popd + +. config.mk +test -n "$PX4_ROOT" && test -d "$PX4_ROOT" && { + echo "Building ArduPlane PX4 binaries" + pushd ArduPlane + make px4-clean + make px4 + copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Plane/$hdate/PX4 + popd + + echo "Building ArduCopter PX4 binaries" + pushd ArduCopter + make px4-clean + make px4 + copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Copter/$hdate/PX4 + popd + + echo "Building APMrover2 PX4 binaries" + pushd APMrover2 + make px4-clean + make px4 + copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Rover/$hdate/PX4 + popd + + echo "Building PX4IO firmware" + pushd $PX4_ROOT + make clean + make configure_px4io + make + copyit $PX4_ROOT/Images/px4io.bin $binaries/PX4IO/$hdate/PX4IO + make configure_px4fmu + popd +} + +rm -rf $TMPDIR + +exit 0