summaryrefslogtreecommitdiff
path: root/util/flash_ec
diff options
context:
space:
mode:
Diffstat (limited to 'util/flash_ec')
-rwxr-xr-xutil/flash_ec13
1 files changed, 10 insertions, 3 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 8fcde8d14b..a297d84a20 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -273,9 +273,16 @@ function dut_control_get_or_die {
: ${BOARD:=${FLAGS_board}}
# Find the Zephyr project directory for the specified board. Zephyr projects
-# organized under ./zephyr/projects as <baseboard>/<board> directory.
-: ${ZEPHYR_DIR:=$(find zephyr/projects -mindepth 2 -maxdepth 2 \
- -type d -name "${BOARD}")}
+# organized under ./zephyr/projects and always contain the file zmake.yaml
+mapfile -t zephyr_projects < <(find zephyr/projects/ -type f -name "zmake.yaml")
+for i in "${zephyr_projects[@]}"; do
+ zephyr_project_dir=$(dirname "${i}")
+ zephyr_project_name=$(basename "${zephyr_project_dir}")
+ if [[ "${BOARD}" = "${zephyr_project_name}" ]]; then
+ ZEPHYR_DIR="${zephyr_project_dir}"
+ break
+ fi
+done
in_array() {
local n=$#