diff options
author | Keith Short <keithshort@chromium.org> | 2021-08-22 14:26:13 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-26 19:54:47 +0000 |
commit | 6ce35bf6aec45de9793a6d750acaa8a3c4f9dc6e (patch) | |
tree | b52b8d5806cbf75f164edf0d9270b7e235c017d3 /util | |
parent | 769264c30d58e0b12795411e99e7d3efbbf78e2d (diff) | |
download | chrome-ec-6ce35bf6aec45de9793a6d750acaa8a3c4f9dc6e.tar.gz |
flash_ec: Updates to support Zephyr images
Add support for flashing Zephyr images. This includes finding the NPCX
monitor binary built with Zephyr images instead of requiring a cros-ec
build to provide the monitor.
Automatically finding and flashing Zephyr images built with
"emerge-<board> chromeos-zephyr" is not supported by this change.
BUG=b:197162681
BRANCH=none
TEST=Delete cros-ec build directories to ensure NPCX monitor comes from
Zehpyr builds.
TEST=Verify local image programming using "./util/flash_ec --board
volteer --zephyr"
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Ib85f65b241bd0119bb8cce3193cede5a9fcee4aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3116568
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/util/flash_ec b/util/flash_ec index 1368c2e79a..8fcde8d14b 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -180,6 +180,8 @@ DEFINE_boolean verbose "${FLAGS_FALSE}" \ "Verbose hw control logging" DEFINE_boolean verify "${FLAGS_FALSE}" \ "Verify EC firmware image after programming." +DEFINE_boolean zephyr "${FLAGS_FALSE}" \ + "Program a Zephyr EC image instead of a CrOS EC image" # Parse command line FLAGS_HELP="usage: $0 [flags]" @@ -270,6 +272,11 @@ 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}")} + in_array() { local n=$# local value=${!n} @@ -664,9 +671,20 @@ cleanup() { } trap cleanup EXIT +# TODO: the name of the RO images created for zephyr vary based on whether +# the RO image includes a header. +# NPCX images use "build-ro/zephyr/zephyr.npcx.bin" +# ITE images use "build-ro/zephyr/zephyr.bin" +if [ "${FLAGS_ro}" = ${FLAGS_TRUE} ] && [ "${FLAGS_zephyr}" = ${FLAGS_TRUE} ] +then + die "The --ro flag is not supported with the --zephyr flag" +fi + # Possible default EC images if [ "${FLAGS_ro}" = ${FLAGS_TRUE} ] ; then EC_FILE=ec.RO.flat +elif [ "${FLAGS_zephyr}" = ${FLAGS_TRUE} ] ; then + EC_FILE=zephyr.bin else EC_FILE=ec.bin fi @@ -675,6 +693,8 @@ LOCAL_BUILD= if [[ -n "${EC_DIR}" ]]; then if [ "${FLAGS_ro}" = ${FLAGS_TRUE} ] ; then LOCAL_BUILD="${EC_DIR}/build/${BOARD}/RO/${EC_FILE}" + elif [ "${FLAGS_zephyr}" = ${FLAGS_TRUE} ] ; then + LOCAL_BUILD="${EC_DIR}/build/${ZEPHYR_DIR}/output/${EC_FILE}" else LOCAL_BUILD="${EC_DIR}/build/${BOARD}/${EC_FILE}" fi @@ -1421,6 +1441,7 @@ function flash_npcx_uut() { "$(dirname "$IMG")/chip/npcx/spiflashfw" \ "$(dirname "$IMG")" \ "${EC_DIR}/build/${BOARD}/chip/npcx/spiflashfw" \ + "${EC_DIR}/build/${ZEPHYR_DIR}/output" \ "$(dirname "$LOCAL_BUILD")" \ "$(dirname "$EMERGE_BUILD")" ; do |