Skip to content

Commit 9bfd899

Browse files
committed
extra/build.sh: allow specifying a board name
This commit allows the user to specify a board name when running the `extra/build.sh` script. If the argument matches a board in the boards.txt file, the script will use that board's target and arguments instead of the default board.
1 parent ed7618a commit 9bfd899

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

extra/build.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,19 @@ if [[ $# -eq 0 ]]; then
1818
args=$(jq -cr '.args' <<< "$first_board")
1919
else
2020
target=$1
21-
shift
22-
args="$*"
21+
chosen_board=$(extra/get_board_details.sh | jq -cr ".[] | select(.board == \"$target\") // empty")
22+
if ! [ -z "$chosen_board" ]; then
23+
target=$(jq -cr '.target' <<< "$chosen_board")
24+
args=$(jq -cr '.args' <<< "$chosen_board")
25+
else
26+
shift
27+
args="$*"
28+
fi
2329
fi
2430

31+
echo
32+
echo "Build target: $target $args"
33+
2534
source venv/bin/activate
2635

2736
ZEPHYR_BASE=$(west topdir)/zephyr
@@ -32,6 +41,8 @@ variant=$(extra/get_variant_name.sh $target)
3241
if [ -z "${variant}" ] ; then
3342
echo "Failed to get variant name from '$target'"
3443
exit 1
44+
else
45+
echo "Build variant: $variant"
3546
fi
3647

3748
# Build the loader

0 commit comments

Comments
 (0)