Skip to content

Instantly share code, notes, and snippets.

@mkresin
Created January 26, 2018 21:12
Show Gist options
  • Save mkresin/64aca8673dd5452a1b5ab93dbf77b2d4 to your computer and use it in GitHub Desktop.
Save mkresin/64aca8673dd5452a1b5ab93dbf77b2d4 to your computer and use it in GitHub Desktop.
#!/bin/bash
CPUS=9
function build {
cat << EOF > .config
CONFIG_TARGET_${TARGET}=y
CONFIG_TARGET_MULTI_PROFILE=y
CONFIG_TARGET_ALL_PROFILES=y
CONFIG_TARGET_PER_DEVICE_ROOTFS=y
CONFIG_DEVEL=y
CONFIG_CCACHE=y
CONFIG_ALL_NONSHARED=y
EOF
[ -n "${SUBTARGET}" ] && {
echo " ${SUBTARGET}"
echo "CONFIG_TARGET_${TARGET}_${SUBTARGET}=y" >> .config
}
for EXTRAOPTION in ${EXTRAOPTIONS}; do
echo "${EXTRAOPTION}" >> .config
done
make defconfig > /dev/null
for EXTRAOPTION in ${EXTRAOPTIONS}; do
grep -q "${EXTRAOPTION}" <(./scripts/diffconfig.sh) || {
echo " ${EXTRAOPTION} not found. Skipping."
return
}
done
make clean && make -j${CPUS} BUILD_LOG=1 IGNORE_ERRORS=1
}
if [ "$#" -ne 0 ]; then
for TARGET in "$@"; do
MAKEFILE="target/linux/${TARGET}/Makefile"
[ ! -f "${MAKEFILE}" ] && {
echo "TARGET ${TARGET} is unknown"
exit
}
MAKEFILES="${MAKEFILES} ${MAKEFILE}"
done
else
MAKEFILES=$(grep -Li 'FEATURES.*broken' target/linux/*/Makefile)
fi
# enable logging
rm build.log
exec > >(tee -a build.log)
exec 2> >(tee -a build.log >&2)
for MAKEFILE in ${MAKEFILES}; do
SUBTARGET=""
TARGET=$(grep "BOARD:=" "${MAKEFILE}")
TARGET=${TARGET#BOARD:=}
echo "${TARGET}"
SUBTARGETS=$(grep 'SUBTARGETS:=' "${MAKEFILE}")
if [ -z "${SUBTARGETS}" ]; then
build
else
for SUBTARGET in ${SUBTARGETS#SUBTARGETS:=}; do
build
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment