firmware-updater: Detect legacy flashrom program.
When updating with programs from old system, we must detect and use the old
"-p internal:bus=*" syntax.
BUG=chrome-os-partner:20261
TEST=manually: remove the flashrom from firmware updater bundle and see flashrom
invoked with "-p internal:bus=*" param.
CQ-DEPEND=CL:58933
Change-Id: I2669d50bab48d18bb8045d6f2d8b278ed5c2341f
Reviewed-on: https://gerrit.chromium.org/gerrit/58950
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>
diff --git a/pack_dist/crosutil.sh b/pack_dist/crosutil.sh
index 1cf0723..0c4bca2 100644
--- a/pack_dist/crosutil.sh
+++ b/pack_dist/crosutil.sh
@@ -337,6 +337,15 @@
fi
debug_msg "Using programs in system."
+
+ # flashrom has changed its syntax (crosbug.com/p/16211). When we're upgrading
+ # with programs in previous system, it is possible the old flashrom does not
+ # support new syntax so we must check.
+ if ! flashrom $TARGET_OPT_MAIN --version >/dev/null 2>&1; then
+ alert "Using flashrom in current system rootfs with legacy target syntax."
+ TARGET_OPT_MAIN="-p internal:bus=spi"
+ TARGET_OPT_EC="-p internal:bus=lpc"
+ fi
}
# Reset lock file variable.