Skip to content

Instantly share code, notes, and snippets.

@mkresin
Last active November 11, 2016 17:55
Show Gist options
  • Save mkresin/a263c2de94285898aecb281a3773ceee to your computer and use it in GitHub Desktop.
Save mkresin/a263c2de94285898aecb281a3773ceee to your computer and use it in GitHub Desktop.
compile all LEDE boards of a given target: ~/compile_all_boards lantiq
#!/bin/bash
set -e
CPUS=9
PLATFORM="$1"
PLATFORMDIR="target/linux/$PLATFORM"
function build {
cat << EOF > .config
CONFIG_TARGET_${PLATFORM}=y
CONFIG_TARGET_MULTI_PROFILE=y
CONFIG_TARGET_ALL_PROFILES=y
CONFIG_TARGET_PER_DEVICE_ROOTFS=y
EOF
[ -n "${SUBTARGET}" ] && {
echo "CONFIG_TARGET_${PLATFORM}_${SUBTARGET}=y" >> .config
echo "${SUBTARGET}"
}
make defconfig && make clean && make -j$CPUS BUILD_LOG=1
}
if [ -z "$PLATFORM" ] || [ ! -d "$PLATFORMDIR" ]; then
echo "Missing parameter or unknown platform supplied"
exit
fi
SUBTARGETS=$(grep 'SUBTARGETS:=' "$PLATFORMDIR/Makefile")
# enable logging
rm build.log
exec > >(tee -a build.log)
exec 2> >(tee -a build.log >&2)
if [ -z "${SUBTARGETS}" ]; then
build
else
for SUBTARGET in ${SUBTARGETS#SUBTARGETS:=}; do
build
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment