diff options
author | Keith Short <keithshort@chromium.org> | 2021-10-08 15:59:24 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-12 20:00:11 +0000 |
commit | 42518c1ab4f52e31efed14c732344dec21b5d716 (patch) | |
tree | d5188d061ffaf2804e723c20bcbb1a6cbc33a35b | |
parent | 6c81234074add3ee421982ca7062b6d9805c7c15 (diff) | |
download | chrome-ec-42518c1ab4f52e31efed14c732344dec21b5d716.tar.gz |
flash_ec: update zephyr support to support flat projects
Identify valid Zephyr projects by finding the zmake.yaml file. This
correctly finds Zephyr projects, regardless of the directory layout
under zephyr/projects.
BUG=none
BRANCH=none
TEST="./util/flash_ec --board guybrush --dry_run --zephyr" identifies
the EC binary as "build/zephyr/projects/guybrush/output/zephyr.bin"
TEST="./util/flash_ec --board volteer --dry_run --zephyr" identifies the
EC binary as "build/zephyr/projects/volteer/volteer/output/zephyr.bin"
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Ib43aa718f41e4c73f2ad574f7a260f7a94c23dcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3212779
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Diana Z <dzigterman@chromium.org>
-rwxr-xr-x | util/flash_ec | 13 |
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=$# |