Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
build: Multiple improvements to the parallel build script.
Browse files Browse the repository at this point in the history
You can now easily select which models to build, either at run time,
or embedded in the script itself.  Read the config section inside the
script for usage details.
  • Loading branch information
RMerl committed Jun 8, 2016
1 parent a112dff commit b84a5c7
Showing 1 changed file with 149 additions and 33 deletions.
182 changes: 149 additions & 33 deletions tools/build-all
Original file line number Diff line number Diff line change
@@ -1,5 +1,83 @@
#!/bin/bash


### Start config

### Manual/hardcoded
# Set DEFAULTBUILD to "none", then
# uncomment desired models
#
# You can also set DEFAULTBUILD to one of the BUILDMODELS flags (see below)

DEFAULTBUILD="all"

#BN66=y
#BAC66=y

#BAC56=y
#BAC68=y
#BAC87=y

#BAC3200=y

#BAC88=y
#BAC3100=y
#BAC5300=y


### Specify at run time through env vars
#
# a) By group
# Example:
# BUILDMODELS="sdk6|sdk7114" ./build-all
#
# Supported flags: all sdk6 sdk7x sdk7114 mips arm none
#
# b) Or individual models (must disable group build):
#
# BN66=y BUILDMODELS="none" ./build-all
#

### Paths
# Store built images there
STAGE_LOC=~/images

# Copy built images there
# Copy is done using scp, so it can be an ssh location
#FINAL_LOC=""
#FINAL_LOC=admin@router.asus.com:/mnt/sda1/Share
FINAL_LOC=/media/sf_Share

### End config



if [ -z "$BUILDMODELS" ]; then
BUILDMODELS=$DEFAULTBUILD
fi

if [[ "$BUILDMODELS" =~ "mips" || "$BUILDMODELS" =~ "all" ]] ; then
BN66=y
BAC66=y
fi

if [[ "$BUILDMODELS" =~ "arm" || "$BUILDMODELS" =~ "all" || "$BUILDMODELS" =~ "sdk6" ]] ; then
BAC56=y
BAC68=y
BAC87=y
fi

if [[ "$BUILDMODELS" =~ "arm" || "$BUILDMODELS" =~ "all" || "$BUILDMODELS" =~ "sdk7x" ]] ; then
BAC3200=y
fi

if [[ "$BUILDMODELS" =~ "arm" || "$BUILDMODELS" =~ "all" || "$BUILDMODELS" =~ "sdk7114" ]] ; then
BAC88=y
BAC3100=y
BAC5300=y
fi


build_fw()
{
FWMODEL=$2
Expand All @@ -11,11 +89,11 @@ build_fw()
if [ $? -eq 0 ]; then
cd image
FWNAME=$(ls -t *.trx | head -n 1)
cp $FWNAME ~/images/
cp $FWNAME $STAGE_LOC/

ZIPNAME="${FWNAME%.*}".zip
sha256sum $FWNAME | unix2dos > sha256sum.txt
zip -j ~/images/$ZIPNAME $FWNAME ~/images/README-merlin.txt ~/images/Changelog.txt sha256sum.txt &>/dev/null
zip -j $STAGE_LOC/$ZIPNAME $FWNAME $STAGE_LOC/README-merlin.txt $STAGE_LOC/Changelog.txt sha256sum.txt &>/dev/null
echo "*** $(date +%R) - Done building $FWMODEL!"
else
echo "!!! $(date +%R) - $FWMODEL build failed!"
Expand Down Expand Up @@ -45,46 +123,82 @@ clean_tree()
# Initial cleanup

echo "--- $(date +%R) - Global cleanup..."
rm ~/images/*
cp ~/asuswrt/README-merlin.txt ~/images/
cp ~/asuswrt/Changelog.txt ~/images/
rm $STAGE_LOC/*
cp ~/asuswrt/README-merlin.txt $STAGE_LOC/
cp ~/asuswrt/Changelog.txt $STAGE_LOC/


# Update all model trees

echo "--- $(date +%R) - Preparing trees"
clean_tree asuswrt.n66 release/src-rt-6.x rt-n66u
clean_tree asuswrt.ac56 release/src-rt-6.x.4708 rt-ac56u
clean_tree asuswrt.ac68 release/src-rt-6.x.4708 rt-ac68u
clean_tree asuswrt.ac66 release/src-rt-6.x rt-ac66u
clean_tree asuswrt.ac87 release/src-rt-6.x.4708 rt-ac87u
clean_tree asuswrt.ac3200 release/src-rt-7.x.main/src rt-ac3200
clean_tree asuswrt.ac3100 release/src-rt-7.14.114.x/src rt-ac3100
clean_tree asuswrt.ac88 release/src-rt-7.14.114.x/src rt-ac88u
clean_tree asuswrt.ac5300 release/src-rt-7.14.114.x/src rt-ac5300
if [ "$BN66" == "y" ]; then
clean_tree asuswrt.n66 release/src-rt-6.x rt-n66u
fi
if [ "$BAC56" == "y" ]; then
clean_tree asuswrt.ac56 release/src-rt-6.x.4708 rt-ac56u
fi
if [ "$BAC68" == "y" ]; then
clean_tree asuswrt.ac68 release/src-rt-6.x.4708 rt-ac68u
fi
if [ "$BAC66" == "y" ]; then
clean_tree asuswrt.ac66 release/src-rt-6.x rt-ac66u
fi
if [ "$BAC87" == "y" ]; then
clean_tree asuswrt.ac87 release/src-rt-6.x.4708 rt-ac87u
fi
if [ "$BAC3200" == "y" ]; then
clean_tree asuswrt.ac3200 release/src-rt-7.x.main/src rt-ac3200
fi
if [ "$BAC3100" == "y" ]; then
clean_tree asuswrt.ac3100 release/src-rt-7.14.114.x/src rt-ac3100
fi
if [ "$BAC88" == "y" ]; then
clean_tree asuswrt.ac88 release/src-rt-7.14.114.x/src rt-ac88u
fi
if [ "$BAC5300" == "y" ]; then
clean_tree asuswrt.ac5300 release/src-rt-7.14.114.x/src rt-ac5300
fi
echo -e "--- $(date +%R) - All trees ready!\n"

# Launch parallel builds

echo "--- $(date +%R) - Launching all builds"
build_fw asuswrt.n66/release/src-rt-6.x rt-n66u &
sleep 20
build_fw asuswrt.ac56/release/src-rt-6.x.4708 rt-ac56u &
sleep 20
build_fw asuswrt.ac68/release/src-rt-6.x.4708 rt-ac68u &
sleep 20
build_fw asuswrt.ac66/release/src-rt-6.x rt-ac66u &
sleep 20
build_fw asuswrt.ac87/release/src-rt-6.x.4708 rt-ac87u &
sleep 20
build_fw asuswrt.ac3200/release/src-rt-7.x.main/src rt-ac3200 &
sleep 20
build_fw asuswrt.ac3100/release/src-rt-7.14.114.x/src rt-ac3100 &
sleep 20
build_fw asuswrt.ac88/release/src-rt-7.14.114.x/src rt-ac88u &
sleep 20
build_fw asuswrt.ac5300/release/src-rt-7.14.114.x/src rt-ac5300 &
sleep 10
if [ "$BN66" == "y" ]; then
build_fw asuswrt.n66/release/src-rt-6.x rt-n66u &
sleep 20
fi
if [ "$BAC56" == "y" ]; then
build_fw asuswrt.ac56/release/src-rt-6.x.4708 rt-ac56u &
sleep 20
fi
if [ "$BAC68" == "y" ]; then
build_fw asuswrt.ac68/release/src-rt-6.x.4708 rt-ac68u &
sleep 20
fi
if [ "$BAC66" == "y" ]; then
build_fw asuswrt.ac66/release/src-rt-6.x rt-ac66u &
sleep 20
fi
if [ "$BAC87" == "y" ]; then
build_fw asuswrt.ac87/release/src-rt-6.x.4708 rt-ac87u &
sleep 20
fi
if [ "$BAC3200" == "y" ]; then
build_fw asuswrt.ac3200/release/src-rt-7.x.main/src rt-ac3200 &
sleep 20
fi
if [ "$BAC3100" == "y" ]; then
build_fw asuswrt.ac3100/release/src-rt-7.14.114.x/src rt-ac3100 &
sleep 20
fi
if [ "$BAC88" == "y" ]; then
build_fw asuswrt.ac88/release/src-rt-7.14.114.x/src rt-ac88u &
sleep 20
fi
if [ "$BAC5300" == "y" ]; then
build_fw asuswrt.ac5300/release/src-rt-7.14.114.x/src rt-ac5300 &
sleep 10
fi
echo "--- $(date +%R) - All builds launched, please wait..."

wait
Expand All @@ -96,6 +210,8 @@ sha256sum *.trx | unix2dos > sha256sums.txt

# Copy everything to the host

cp *.zip *.trx *.txt /media/sf_Share/
if [ -z "$FINAL_LOC" ]; then
scp *.zip *.trx *.txt $FINAL_LOC/
fi

echo "=== $(date +%R) - All done!"

0 comments on commit b84a5c7

Please sign in to comment.