|
@@ -11,8 +11,20 @@
|
|
|
# BUILD_TS = build timestamp (format: %Y-%m-%d %H:%M:%S)
|
|
|
# BROKEN = 0 (default) or 1, build the untested hardware model firmwares, too
|
|
|
# MAKEJOBS = number of compiler processes running in parallel (default: number of CPUs/Cores)
|
|
|
+# TARGETS = a space separated list of target platforms (if unset, all platforms will be build)
|
|
|
#
|
|
|
|
|
|
+function get_all_supported_platforms()
|
|
|
+{
|
|
|
+ local buffer;
|
|
|
+ for val in $(ls ${1}) ; do
|
|
|
+ [ -d "./${1}/${val}" ] || continue
|
|
|
+ buffer="${buffer} ${val}"
|
|
|
+ done
|
|
|
+ echo ${buffer}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
if [ "_$BRANCH" == "_" ]; then
|
|
|
echo "Please specify BRANCH environment variable." >&2
|
|
|
exit 1
|
|
@@ -77,30 +89,52 @@ cd ..
|
|
|
|
|
|
### CLEAN
|
|
|
if [ "$BRANCH" != "experimental" ]; then
|
|
|
- progress "Cleaning your build environment ..."
|
|
|
- make clean
|
|
|
+ progress "Cleaning your build environment ..."
|
|
|
+ make dirclean
|
|
|
fi
|
|
|
|
|
|
### PREPARE
|
|
|
-[ -n "${MAKEJOBS}" ] || MAKEJOBS=$(grep -c "^processor" /proc/cpuinfo)
|
|
|
progress "Preparing the build environment (make update) ..."
|
|
|
make update
|
|
|
[ "$?" -eq "0" ] || abort "Failed to update the build environment, mimimi."
|
|
|
|
|
|
-### BUILD TOOLCHAIN
|
|
|
-progress "Building toolchain if necessary (this is not possible on a fresh build) ..."
|
|
|
-faketime "$BUILD_TS" make toolchain -j ${MAKEJOBS}
|
|
|
-
|
|
|
### BUILD FIRMWARE
|
|
|
progress "Building the firmware - please stand by!"
|
|
|
-[ "_$BROKEN" == "_" ] && export BROKEN=0
|
|
|
-if [ "$BRANCH" != "experimental" ]; then
|
|
|
- GLUON_BRANCH=$BRANCH GLUON_RELEASE=$VERSION BROKEN=$BROKEN faketime "$BUILD_TS" make -j ${MAKEJOBS}
|
|
|
-else
|
|
|
- GLUON_BRANCH=experimental faketime "$BUILD_TS" make -j ${MAKEJOBS}
|
|
|
+[ -n "${BROKEN}" ] || BROKEN=0
|
|
|
+[ -n "${MAKEJOBS}" ] || MAKEJOBS=$(grep -c "^processor" /proc/cpuinfo)
|
|
|
+[ -n "${TARGETS}" ] || TARGETS=$(get_all_supported_platforms "./targets")
|
|
|
+
|
|
|
+if [ "${BRANCH}" == "experimental" -a -z "${VERSION}" ] ; then
|
|
|
+ default_release_pattern=$( awk -F" := " '/^DEFAULT_GLUON_RELEASE/ { gsub("shell ", "", $2); print $2; }' ./site/site.mk )
|
|
|
+ VERSION=$(eval echo ${default_release_pattern})
|
|
|
fi
|
|
|
|
|
|
-[ "$?" -eq "0" ] || abort "Failed to build the firmware, mimimi."
|
|
|
+for target in ${TARGETS} ; do
|
|
|
+ # configure build environment for our current target
|
|
|
+ export GLUON_TARGET="${target}"
|
|
|
+ gluon_build_env_vars="GLUON_TARGET=\"${target}\" GLUON_BRANCH=\"${BRANCH}\" GLUON_RELEASE=\"${VERSION}\" BROKEN=\"${BROKEN}\""
|
|
|
+
|
|
|
+ # prepare build environment for our current target
|
|
|
+ progress "Preparing build environment for target ${target}."
|
|
|
+ [ "${BRANCH}" == "experimental" ] || make clean
|
|
|
+ make -j ${MAKEJOBS} prepare-target
|
|
|
+
|
|
|
+ # need to have a toolchain for the particular target
|
|
|
+ progress "Building toolchain for target ${target}."
|
|
|
+ make -j ${MAKEJOBS} toolchain/install
|
|
|
+ [ "$?" -eq "0" ] || abort "Unable to build toolchain for target. Aborting."
|
|
|
+
|
|
|
+ # now we can start building the images for the target platform
|
|
|
+ progress "Building FFPB-flavoured Gluon firmware for target ${target}. You'd better go and fetch some c0ffee!"
|
|
|
+ make_targets="prepare"
|
|
|
+ eval "${gluon_build_env_vars} faketime \"$BUILD_TS\" make -j ${MAKEJOBS} ${make_targets}"
|
|
|
+ [ "$?" -eq "0" ] || abort "Failed to build firmware for target-platform ${target}."
|
|
|
+
|
|
|
+ # finally compile the firmware binaries
|
|
|
+ progress "Compiling binary firmware images."
|
|
|
+ faketime "$BUILD_TS" make images
|
|
|
+ [ "$?" -eq "0" ] || abort "Failed to assemble images for target-platform ${target}."
|
|
|
+done
|
|
|
|
|
|
cd ..
|
|
|
|
|
@@ -119,10 +153,19 @@ progress "Assembling images.7z ..."
|
|
|
[ -e "output/${BRANCH}/images.7z" ] && rm "output/${BRANCH}/images.7z"
|
|
|
7z a "output/${BRANCH}/images.7z" ${CODE_DIR}/images/sysupgrade/*.bin ${CODE_DIR}/images/factory/*.bin || abort "Failed to assemble images (did you install p7zip-full?)."
|
|
|
|
|
|
-# generate and copy manifest
|
|
|
+# generate, franken-merge, and copy manifests
|
|
|
progress "Generating and copying manifest ..."
|
|
|
pushd $CODE_DIR
|
|
|
-GLUON_BRANCH=$BRANCH make manifest || abort "Failed to generate the manifest, try running 'make manifest' in '$CODE_DIR' directory manually."
|
|
|
+for target in ${TARGETS} ; do
|
|
|
+ GLUON_TARGET="${target}" GLUON_BRANCH=$BRANCH make manifest || abort "Failed to generate the manifest, try running 'make manifest' in '$CODE_DIR' directory manually."
|
|
|
+ mv ./images/sysupgrade/${BRANCH}.manifest ./images/sysupgrade/${target}.${BRANCH}.manifest
|
|
|
+done
|
|
|
+frankenmerge_manifest_file="./images/sysupgrade/${BRANCH}.manifest"
|
|
|
+echo "BRANCH=${BRANCH}" > ${frankenmerge_manifest_file}
|
|
|
+echo "DATE=${BUILD_TS}" >> ${frankenmerge_manifest_file}
|
|
|
+echo "PRIORITY=0" >> ${frankenmerge_manifest_file}
|
|
|
+echo "" >> ${frankenmerge_manifest_file}
|
|
|
+grep -hE "*.bin$" ./images/sysupgrade/*.${BRANCH}.manifest | sort >> ${frankenmerge_manifest_file}
|
|
|
popd
|
|
|
cp "${CODE_DIR}/images/sysupgrade/${BRANCH}.manifest" "output/${BRANCH}/"
|
|
|
|