forked from rusefi/fw-custom-example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_boards.sh
More file actions
executable file
·55 lines (46 loc) · 1.76 KB
/
Copy pathbuild_boards.sh
File metadata and controls
executable file
·55 lines (46 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Build all per-board firmwares inside Docker (needed for mtools/dosfstools).
# Usage:
# ./build_boards.sh # build all boards
# ./build_boards.sh mazduino-compact # build single board
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")"; pwd)"
IMAGE_NAME="rusefi-build"
# Force x86-64 so hex2dfu.bin (x86-64 Linux binary) works via Rosetta 2 on Apple Silicon.
# CI runners are already x86-64 Linux, so this keeps local and CI environments identical.
DOCKER_PLATFORM="linux/amd64"
BOARD_ARG="${1:-}"
# Build Docker image if not present
if ! docker image inspect "$IMAGE_NAME" &>/dev/null; then
echo "=== Building Docker image (first time only) ==="
docker build --platform "$DOCKER_PLATFORM" -t "$IMAGE_NAME" "$REPO_ROOT/.devcontainer/"
fi
# Determine which boards to build
if [ -n "$BOARD_ARG" ]; then
BOARDS=("$BOARD_ARG")
else
BOARDS=()
for d in "$REPO_ROOT/boards"/*/; do
BOARDS+=("$(basename "$d")")
done
fi
echo "=== Boards to build: ${BOARDS[*]} ==="
for BOARD in "${BOARDS[@]}"; do
META="$REPO_ROOT/boards/$BOARD/meta-info.env"
if [ ! -f "$META" ]; then
echo "ERROR: $META not found, skipping $BOARD"
continue
fi
echo ""
echo "========================================="
echo " Building: $BOARD"
echo "========================================="
docker run --rm --platform "$DOCKER_PLATFORM" \
-v "$REPO_ROOT:/workspace" \
-w /workspace/ext/rusefi/firmware \
-e META_OUTPUT_ROOT_FOLDER=../../../generated/ \
-e AUTOMATION_REF="$(git -C "$REPO_ROOT" branch --show-current 2>/dev/null || echo mazduino)" \
"$IMAGE_NAME" \
bash bin/compile.sh "/workspace/boards/$BOARD/meta-info.env"
echo "=== $BOARD: DONE ==="
done