aboutsummaryrefslogtreecommitdiff
path: root/zephyr-tutorial/builders.sh
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr-tutorial/builders.sh')
-rwxr-xr-xzephyr-tutorial/builders.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/zephyr-tutorial/builders.sh b/zephyr-tutorial/builders.sh
new file mode 100755
index 00000000..ffd37011
--- /dev/null
+++ b/zephyr-tutorial/builders.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+sudo apt-get -q=2 update
+sudo apt-get -q=2 -y install git g++ g++-multilib gperf python3-ply \
+ python3-yaml gcc-arm-none-eabi python-requests rsync device-tree-compiler \
+ python3-pip
+
+set -ex
+
+# Distro package is too old for Zephyr
+sudo pip3 install pyelftools pykwalify
+
+git clone -b ${BRANCH} https://git.linaro.org/lite/zephyr.git ${WORKSPACE}
+git clean -fdx
+if [ -n "${GIT_COMMIT}" ]; then
+ git reset --hard ${GIT_COMMIT}
+fi
+echo "GIT_COMMIT=$(git rev-parse --short=8 HEAD)" > env_var_parameters
+
+head -5 Makefile
+
+# Toolchains are pre-installed and come from:
+# https://github.com/zephyrproject-rtos/meta-zephyr-sdk/releases/download/0.9.2/zephyr-sdk-0.9.2-setup.run
+# To install Zephyr SDK: ./zephyr-sdk-0.9.2-setup.run --quiet --nox11 -- <<< "${HOME}/srv/toolchain/zephyr-sdk-0.9.2"
+
+export ZEPHYR_SDK_INSTALL_DIR="${HOME}/srv/toolchain/zephyr-sdk-0.9.2"
+
+# Set build environment variables
+LANG=C
+ZEPHYR_BASE=${WORKSPACE}
+PATH=${ZEPHYR_BASE}/scripts:${PATH}
+OUTDIR=${HOME}/srv/zephyr/${PLATFORM}
+export LANG ZEPHYR_BASE PATH
+env |grep '^ZEPHYR'
+
+echo ""
+echo "########################################################################"
+echo " make -C tests/kernel/common "
+echo "########################################################################"
+
+cd ${WORKSPACE}
+make -C ${WORKSPACE}/tests/kernel/common O=${OUTDIR} BOARD=${PLATFORM}
+
+# OUTDIR is per-platform.
+find ${OUTDIR} -type f -name '.config' -exec rename 's/.config/zephyr.config/' {} +
+rsync -avm \
+ --include=zephyr.bin \
+ --include=zephyr.config \
+ --include=zephyr.elf \
+ --include='*/' \
+ --exclude='*' \
+ ${OUTDIR} out/
+find ${OUTDIR} -type f -name 'zephyr.config' -delete
+