util: update flash_ec to handle unibuild emerge paths

If a baseboard exists in the build.mk for a board, use that
as the unibuild path.

BRANCH=none
BUG=b:77128456
TEST=tested the following command with correct results:
	    flash_ec --board=yorp  (baseboard)
	    flash_ec --board=bip   (baseboard)
	    flash_ec --board=grunt (non-baseboard)

Change-Id: Ic4573cb01849275d1333ff9e715f69a4c95444b0
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/986753
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Jett Rink
2018-03-29 12:39:16 -06:00
committed by chrome-bot
parent 7a756993ea
commit 375ecebcb7
2 changed files with 13 additions and 2 deletions

View File

@@ -463,6 +463,10 @@ flash_ec: $(out)/ec.bin
flash_dfu: $(out)/ec.bin
sudo ./$(BDIR)/dfu $(out)/ec.bin
.PHONY: print-baseboard
print-baseboard:
@echo "${BASEBOARD}"
.PHONY: clean
clean:
-rm -rf $(out)

View File

@@ -222,7 +222,6 @@ function get_servo_type() {
}
BOARD=${FLAGS_board}
BOARD_ROOT=/build/${BOARD}
in_array() {
local n=$#
@@ -412,13 +411,21 @@ else
EC_FILE=ec.bin
fi
EMERGE_BUILD=${BOARD_ROOT}/firmware/${EC_FILE}
LOCAL_BUILD=
if [[ -n "${EC_DIR}" ]]; then
LOCAL_BUILD="${EC_DIR}/build/${BOARD}/${EC_FILE}"
fi
# Get baseboard from build system if present
BASEBOARD=$(make --quiet -C ${EC_DIR} BOARD=${BOARD} print-baseboard)
if [[ -n "${BASEBOARD}" ]]; then
EMERGE_BUILD=/build/${BASEBOARD}/firmware/${BOARD}/${EC_FILE}
else
EMERGE_BUILD=/build/${BOARD}/firmware/${EC_FILE}
fi
# Find the EC image to use
function ec_image() {
# No image specified on the command line, try default ones