|
@@ -33,8 +33,9 @@ PATCH_DIR="${SIZE_DIR}/patches"
|
|
|
OUTPUT_DIR="${MY_DIR}/output"
|
|
|
IMAGE_DIR="${CODE_DIR}/output/images"
|
|
|
MODULE_DIR="${CODE_DIR}/output/modules"
|
|
|
-BUILD_INFO_FILENAME="build-info.txt"
|
|
|
VERSIONS_INFO_DIR="${MY_DIR}/versions"
|
|
|
+
|
|
|
+BUILD_INFO_FILENAME="build-info.txt"
|
|
|
SITE_REPO_URL="git.c3pb.de/freifunk-pb/site-ffho.git"
|
|
|
LANG=C
|
|
|
|
|
@@ -67,9 +68,8 @@ fi
|
|
|
[ -n "${TARGETS}" ] || TARGETS=$(BROKEN=${BROKEN} make list-targets | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
|
|
|
|
|
if [ "${BRANCH}" == "experimental" -a -z "${VERSION}" ] ; then
|
|
|
- default_release_pattern=$( awk -F" := " '/^DEFAULT_GLUON_RELEASE/ { gsub("shell ", "", $2); print $2; }' ${CODE_DIR}/site/site.mk )
|
|
|
+ default_release_pattern=$( awk -F" := " '/^DEFAULT_GLUON_RELEASE/ { gsub("shell ", "", $2); print $2; }' ${SITE_DIR}/site.mk )
|
|
|
VERSION=$(eval echo ${default_release_pattern})
|
|
|
-
|
|
|
info "EXPERIMENTAL FIRMWARE: using version tag '$VERSION'"
|
|
|
fi
|
|
|
|
|
@@ -82,14 +82,13 @@ fi
|
|
|
MAKE_PARAM=""
|
|
|
[ "$VERBOSE" -eq "1" ] && MAKE_PARAM="${MAKE_PARAM} V=s"
|
|
|
|
|
|
-### INIT
|
|
|
### INIT /src IF NECESSARY
|
|
|
if [ ! -d "${CODE_DIR}" ]; then
|
|
|
info "Code directory does not exist yet - fetching Gluon ..."
|
|
|
git clone https://github.com/freifunk-gluon/gluon.git "${CODE_DIR}"
|
|
|
+ [ "$?" -eq "0" ] || abort "Failed to fetch Gluon repository."
|
|
|
fi
|
|
|
|
|
|
-
|
|
|
### INIT /src/site IF NECESSARY
|
|
|
if [ ! -d "${SITE_DIR}" ]; then
|
|
|
info "Site repository does not exist, fetching it ..."
|
|
@@ -97,9 +96,10 @@ if [ ! -d "${SITE_DIR}" ]; then
|
|
|
[ "$?" -eq "0" ] || abort "Failed to fetch SITE repository."
|
|
|
fi
|
|
|
|
|
|
+pushd ${CODE_DIR}
|
|
|
+
|
|
|
### CHECKOUT GLUON
|
|
|
progress "Checking out GLUON '$BASE' ..."
|
|
|
-pushd ${CODE_DIR}
|
|
|
# TODO: check if gluon got modified and bail out if necessary
|
|
|
git fetch
|
|
|
git checkout -q ${BASE}
|
|
@@ -119,19 +119,25 @@ else
|
|
|
# fetch site repo updates
|
|
|
git fetch || true
|
|
|
# commit given - use this one
|
|
|
- git checkout -q ${SITE_ID} || abort "Failed to checkout requested site commit '${SITE_ID}', mimimi."
|
|
|
+ git checkout -q ${SITE_ID}
|
|
|
+ [ "$?" -eq "0" ] || abort "Failed to checkout requested site commit '${SITE_ID}', mimimi."
|
|
|
fi
|
|
|
SITE_COMMIT=$(git rev-list --max-count=1 HEAD)
|
|
|
-popd
|
|
|
+popd #${SITE_DIR}
|
|
|
|
|
|
### APPLY PATCHES TO GLUON
|
|
|
-# ToDo:
|
|
|
-
|
|
|
-if [ -d "$PATCH_DIR" ]; then
|
|
|
- progress "Applying Patches ..."
|
|
|
- git am ${PATCH_DIR}/*.patch
|
|
|
+progress "Applying Patches ..."
|
|
|
+git checkout -B patching base
|
|
|
+if [ "$(echo "${PATCH_DIR}"/*.patch)" ]; then
|
|
|
+ git am ${PATCH_DIR}/*.patch || (
|
|
|
+ git am --abort
|
|
|
+ git checkout patched
|
|
|
+ git branch -D patching
|
|
|
+ false
|
|
|
+ )
|
|
|
[ "$?" -eq "0" ] || abort "Failed to apply patches, mimimi."
|
|
|
fi
|
|
|
+git branch -M patched
|
|
|
|
|
|
|
|
|
### DIRCLEAN
|
|
@@ -168,14 +174,13 @@ for target in ${TARGETS} ; do
|
|
|
# configure build environment for our current target
|
|
|
export GLUON_TARGET="${target}"
|
|
|
gluon_build_env_vars="GLUON_TARGET=\"${target}\" GLUON_RELEASE=\"${VERSION}\" BROKEN=\"${BROKEN}\""
|
|
|
- if [ "${AUTOUPDATER}" != "off" ]; then
|
|
|
- gluon_build_env_vars="${gluon_build_env_vars} GLUON_BRANCH=\"${AUTOUPDATER}\""
|
|
|
- fi
|
|
|
+ [ "${AUTOUPDATER}" != "off" ] && gluon_build_env_vars="${gluon_build_env_vars} GLUON_BRANCH=\"${AUTOUPDATER}\""
|
|
|
|
|
|
# prepare build environment for our current target
|
|
|
progress "Preparing build environment for target ${target}."
|
|
|
- [ "${DIRCLEAN}" -eq "0" ] || make clean
|
|
|
+ [ "${DIRCLEAN}" -eq "0" ] && make clean
|
|
|
make -j ${MAKEJOBS} prepare-target${MAKE_PARAM}
|
|
|
+ [ "$?" -eq "0" ] || abort "Unable to build environment for target-platform ${target}."
|
|
|
|
|
|
# need to have a toolchain for the particular target
|
|
|
progress "Building toolchain for target ${target}."
|
|
@@ -183,26 +188,30 @@ for target in ${TARGETS} ; do
|
|
|
[ "$?" -eq "0" ] || abort "Unable to build toolchain for target-platform ${target}."
|
|
|
|
|
|
# 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}${MAKE_PARAM}"
|
|
|
+ progress "Building FFHO-flavoured Gluon firmware for target ${target}. You'd better go and fetch some c0ffee!"
|
|
|
+ eval "${gluon_build_env_vars} faketime \"${BUILD_TS}\" make -j ${MAKEJOBS} prepare${MAKE_PARAM}"
|
|
|
[ "$?" -eq "0" ] || abort "Failed to build firmware for target-platform ${target}."
|
|
|
|
|
|
- eval "${gluon_build_env_vars} faketime \"${BUILD_TS}\" make -j ${MAKEJOBS} modules${MAKE_PARAM}"
|
|
|
- [ "$?" -eq "0" ] || abort "Failed to build modules for target-platform ${target}."
|
|
|
-
|
|
|
# finally compile the firmware binaries
|
|
|
progress "Compiling binary firmware images."
|
|
|
- faketime "${BUILD_TS}" make images${MAKE_PARAM}
|
|
|
+ faketime "${BUILD_TS}" make -j ${MAKEJOBS} images${MAKE_PARAM}
|
|
|
[ "$?" -eq "0" ] || abort "Failed to assemble images for target-platform ${target}."
|
|
|
+
|
|
|
+ # compile the modules
|
|
|
+ process "Compiling modules."
|
|
|
+ eval "${gluon_build_env_vars} faketime \"${BUILD_TS}\" make -j ${MAKEJOBS} modules${MAKE_PARAM}"
|
|
|
+ [ "$?" -eq "0" ] || abort "Failed to build modules for target-platform ${target}."
|
|
|
done
|
|
|
-popd
|
|
|
+
|
|
|
+popd #${CODE_DIR}
|
|
|
|
|
|
# compress all binaries into 7z archive
|
|
|
progress "Assembling images.7z ..."
|
|
|
+pushd ${IMAGE_DIR}
|
|
|
[ -e "${OUTPUT_DIR}/${BRANCH}/images.7z" ] && rm "${OUTPUT_DIR}/${BRANCH}/images.7z"
|
|
|
-7z a -xr!*.manifest "${OUTPUT_DIR}/${BRANCH}/images.7z" ${IMAGE_DIR}/sysupgrade/* ${IMAGE_DIR}/factory/*
|
|
|
+7z a -xr!*.manifest "${OUTPUT_DIR}/${BRANCH}/images.7z" ./sysupgrade/* ./factory/*
|
|
|
[ "$?" -eq "0" ] || abort "Failed to assemble images (did you install p7zip-full?)."
|
|
|
+popd #${IMAGE_DIR}
|
|
|
|
|
|
# compress modules into 7z archive
|
|
|
progress "Assembling modules.7z ..."
|
|
@@ -210,7 +219,7 @@ pushd ${MODULE_DIR}
|
|
|
[ -e "${OUTPUT_DIR}/${BRANCH}/modules.7z" ] && rm "${OUTPUT_DIR}/${BRANCH}/modules.7z"
|
|
|
7z a "${OUTPUT_DIR}/${BRANCH}/modules.7z" ./gluon-ffho-${VERSION}
|
|
|
[ "$?" -eq "0" ] || abort "Failed to assemble modules."
|
|
|
-popd
|
|
|
+popd #${MODULE_DIR}
|
|
|
|
|
|
# generate and copy manifests
|
|
|
progress "Generating and copying manifest ..."
|
|
@@ -218,7 +227,7 @@ pushd ${CODE_DIR}
|
|
|
faketime "${BUILD_TS}" GLUON_PRIORITY=${PRIORITY} GLUON_BRANCH=${BRANCH} make manifest
|
|
|
[ "$?" -eq "0" ] || abort "Failed to generate the manifest, try running 'make manifest' in '$CODE_DIR' directory manually."
|
|
|
cp "${CODE_DIR}/output/images/sysupgrade/${BRANCH}.manifest" "${OUTPUT_DIR}/${BRANCH}/"
|
|
|
-popd
|
|
|
+popd #${CODE_DIR}
|
|
|
|
|
|
# Saving a copy of the build info file as reference
|
|
|
progress "Building a greater and brighter firmware finished successfully. Saving build information at: ${VERSIONS_INFO_DIR}/${VERSION}"
|
|
@@ -226,5 +235,5 @@ cp -p "${build_info_path}" "${VERSIONS_INFO_DIR}/${VERSION}"
|
|
|
|
|
|
# The end. Finally.
|
|
|
success "We're done, go and enjoy your new firmware in ${OUTPUT_DIR}/${BRANCH}!"
|
|
|
-popd > /dev/null
|
|
|
+popd > /dev/null #${MY_DIR}
|
|
|
|