mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 08:38:36 -04:00
build: autobuild stable and beta binaries
this populates http://firmware.diydrones.com with latest, stable and beta binaries
This commit is contained in:
parent
c76f8a5242
commit
8ec5ba9cec
@ -2,9 +2,6 @@
|
||||
# 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.$$
|
||||
@ -12,92 +9,179 @@ echo $TMDIR
|
||||
rm -rf $TMPDIR
|
||||
echo "Building in $TMPDIR"
|
||||
|
||||
date
|
||||
git checkout master
|
||||
githash=$(git rev-parse HEAD)
|
||||
|
||||
hdate=$(date +"%Y-%m/%Y-%m-%d-%H:%m")
|
||||
mkdir -p binaries/$hdate
|
||||
binaries=$PWD/../buildlogs/binaries
|
||||
|
||||
. config.mk
|
||||
|
||||
# checkout the right version of the tree
|
||||
checkout() {
|
||||
vehicle="$1"
|
||||
tag="$2"
|
||||
git stash
|
||||
if [ "$tag" = "latest" ]; then
|
||||
git checkout master || return 1
|
||||
else
|
||||
git checkout "$vehicle-$tag" || return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# check if we should skip this build because we have already
|
||||
# built this version
|
||||
skip_build() {
|
||||
tag="$1"
|
||||
ddir="$2"
|
||||
bname=$(basename $ddir)
|
||||
ldir=$(dirname $(dirname $(dirname $ddir)))/$tag/$bname
|
||||
[ -d "$ldir" ] || {
|
||||
echo "$ldir doesn't exist - building"
|
||||
return 1
|
||||
}
|
||||
oldversion=$(cat "$ldir/git-version.txt" | head -1)
|
||||
newversion=$(git log -1 | head -1)
|
||||
[ "$oldversion" = "$newversion" ] && {
|
||||
echo "Skipping build - version match $newversion"
|
||||
return 0
|
||||
}
|
||||
echo "$ldir needs rebuild"
|
||||
return 1
|
||||
}
|
||||
|
||||
# copy the built firmware to the right directory
|
||||
copyit() {
|
||||
file="$1"
|
||||
dir="$2"
|
||||
tag="$3"
|
||||
bname=$(basename $dir)
|
||||
ldir=$(dirname $(dirname $(dirname $dir)))/latest/$bname
|
||||
mkdir -p "$dir"
|
||||
/bin/cp "$file" "$dir"
|
||||
echo "$githash" > "$dir/git-version.txt"
|
||||
mkdir -p "$ldir"
|
||||
echo "$githash" > "$ldir/git-version.txt"
|
||||
rsync "$file" "$ldir"
|
||||
tdir=$(dirname $(dirname $(dirname $dir)))/$tag/$bname
|
||||
if [ "$tag" = "latest" ]; then
|
||||
mkdir -p "$dir"
|
||||
/bin/cp "$file" "$dir"
|
||||
git log -1 > "$dir/git-version.txt"
|
||||
fi
|
||||
echo "Copying $file to $tdir"
|
||||
mkdir -p "$tdir"
|
||||
git log -1 > "$tdir/git-version.txt"
|
||||
rsync "$file" "$tdir"
|
||||
}
|
||||
|
||||
echo "Building ArduPlane binaries"
|
||||
pushd ArduPlane
|
||||
for b in apm1 apm2 apm1-hilsensors apm2-hilsensors apm1-1280; 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; do
|
||||
for f in quad tri hexa y6 octa octa-quad heli quad-hil heli-hil; do
|
||||
pwd
|
||||
make clean
|
||||
make "$b-$f" -j4
|
||||
copyit $TMPDIR/ArduCopter.build/ArduCopter.hex "$binaries/Copter/$hdate/$b-$f"
|
||||
done
|
||||
done
|
||||
popd
|
||||
|
||||
echo "Building APMRover2 binaries"
|
||||
pushd APMrover2
|
||||
for b in apm1 apm2 apm1-1280; 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"
|
||||
# build plane binaries
|
||||
build_arduplane() {
|
||||
tag="$1"
|
||||
echo "Building ArduPlane $tag binaries"
|
||||
checkout ArduPlane $tag || return
|
||||
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
|
||||
for f in quad tri hexa y6 octa octa-quad heli quad-hil heli-hil; do
|
||||
make px4-clean
|
||||
make px4-$f
|
||||
copyit $PX4_ROOT/Images/px4fmu.px4 "$binaries/Copter/$hdate/PX4-$f"
|
||||
for b in apm1 apm2 apm1-hilsensors apm2-hilsensors apm1-1280; do
|
||||
echo "Building ArduPlane $b binaries"
|
||||
ddir=$binaries/Plane/$hdate/$b
|
||||
skip_build $tag $ddir && continue
|
||||
make clean || continue
|
||||
make $b -j4 || continue
|
||||
copyit $TMPDIR/ArduPlane.build/ArduPlane.hex $ddir $tag
|
||||
done
|
||||
test -n "$PX4_ROOT" && test -d "$PX4_ROOT" && {
|
||||
echo "Building ArduPlane PX4 binaries"
|
||||
ddir=$binaries/Plane/$hdate/PX4
|
||||
skip_build $tag $ddir || {
|
||||
make px4-clean &&
|
||||
make px4 &&
|
||||
copyit $PX4_ROOT/Images/px4fmu.px4 $ddir $tag
|
||||
}
|
||||
}
|
||||
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
|
||||
git checkout master
|
||||
}
|
||||
|
||||
# build copter binaries
|
||||
build_arducopter() {
|
||||
tag="$1"
|
||||
checkout ArduCopter $tag || return
|
||||
echo "Building ArduCopter $tag binaries"
|
||||
pushd ArduCopter
|
||||
for b in apm1 apm2; do
|
||||
for f in quad tri hexa y6 octa octa-quad heli quad-hil heli-hil; do
|
||||
echo "Building ArduCopter $b-$f binaries"
|
||||
ddir="$binaries/Copter/$hdate/$b-$f"
|
||||
skip_build $tag $ddir && continue
|
||||
make clean || continue
|
||||
make "$b-$f" -j4 || exit 1
|
||||
copyit $TMPDIR/ArduCopter.build/ArduCopter.hex "$ddir" "$tag"
|
||||
done
|
||||
done
|
||||
test -n "$PX4_ROOT" && test -d "$PX4_ROOT" && {
|
||||
for f in quad tri hexa y6 octa octa-quad heli quad-hil heli-hil; do
|
||||
echo "Building ArduCopter PX4-$f binaries"
|
||||
ddir="$binaries/Copter/$hdate/PX4-$f"
|
||||
skip_build $tag $ddir && continue
|
||||
make px4-clean || continue
|
||||
make px4-$f || continue
|
||||
copyit $PX4_ROOT/Images/px4fmu.px4 $ddir $tag
|
||||
done
|
||||
}
|
||||
popd
|
||||
git checkout master
|
||||
}
|
||||
|
||||
# build rover binaries
|
||||
build_rover() {
|
||||
tag="$1"
|
||||
checkout APMrover2 $tag || return
|
||||
echo "Building APMRover2 $tag binaries"
|
||||
pushd APMrover2
|
||||
for b in apm1 apm2 apm1-1280; do
|
||||
echo "Building APMrover2 $b binaries"
|
||||
ddir=$binaries/Rover/$hdate/$b
|
||||
skip_build $tag $ddir && continue
|
||||
make clean || continue
|
||||
make $b -j4 || continue
|
||||
copyit $TMPDIR/APMrover2.build/APMrover2.hex $ddir $tag
|
||||
done
|
||||
test -n "$PX4_ROOT" && test -d "$PX4_ROOT" && {
|
||||
echo "Building APMrover2 PX4 binaries"
|
||||
ddir=$binaries/Rover/$hdate/PX4
|
||||
skip_build $tag $ddir || {
|
||||
make px4-clean &&
|
||||
make px4 &&
|
||||
copyit $PX4_ROOT/Images/px4fmu.px4 $binaries/Rover/$hdate/PX4 $tag
|
||||
}
|
||||
}
|
||||
popd
|
||||
git checkout master
|
||||
}
|
||||
|
||||
# build PX4io firmware
|
||||
build_px4io() {
|
||||
tag="$1"
|
||||
test -n "$PX4_ROOT" && test -d "$PX4_ROOT" && {
|
||||
echo "Building PX4IO $tag firmware"
|
||||
pushd $PX4_ROOT
|
||||
checkout PX4IO $tag || return
|
||||
ddir=$binaries/PX4IO/$hdate/PX4IO
|
||||
skip_build $tag $ddir || {
|
||||
make clean &&
|
||||
make configure_px4io &&
|
||||
make &&
|
||||
copyit $PX4_ROOT/Images/px4io.bin $ddir $tag &&
|
||||
make configure_px4fmu
|
||||
}
|
||||
git checkout master
|
||||
popd
|
||||
}
|
||||
}
|
||||
|
||||
for build in stable beta latest; do
|
||||
build_arduplane $build
|
||||
build_arducopter $build
|
||||
build_rover $build
|
||||
done
|
||||
build_px4io latest
|
||||
|
||||
rm -rf $TMPDIR
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user