1#! /bin/bash
2
3# Build the bootloader.
4
5# In order to build successfully, ZEPHYR_SDK_INSTALL_DIR and
6# ZEPHYR_GCC_VARIANT need to be set, as well as zephyr/zephyr-env.sh
7# must be sourced.
8
9die() {
10    echo error: "$@"
11    exit 1
12}
13
14if [ -z "$ZEPHYR_BASE" ]; then
15    die "Please setup for a Zephyr build before running this script."
16fi
17
18if [ -z "$BOARD" ]; then
19    die "Please set BOARD to a valid board before running this script."
20fi
21
22make BOARD=${BOARD} -j$(nproc) boot || die "Build mcuboot"
23