provision: Reorder bios image names
When looking for the bios image file in the .tar.bz2 archive, change to
look for the files in this order:
image-MODEL.bin
image-FW_TARGET.bin (FW_TARGET is the name parsed from the EC RO ver)
image-BOARD.bin
image.bin
BUG=b:215404487
TEST=None, maybe tryjob will work
Change-Id: I93a0da0e67ddc7ff85481d5fd84bac67098925f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/tauto/+/3402252
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Sergey Frolov <sfrolov@google.com>
Commit-Queue: Sergey Frolov <sfrolov@google.com>
Reviewed-by: Otabek Kasimov <otabek@google.com>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Otabek Kasimov <otabek@chromium.org>
diff --git a/src/autotest_lib/server/cros/servo/servo.py b/src/autotest_lib/server/cros/servo/servo.py
index cc40a16..61966dd 100644
--- a/src/autotest_lib/server/cros/servo/servo.py
+++ b/src/autotest_lib/server/cros/servo/servo.py
@@ -259,6 +259,7 @@
# Check if image candidates are in the list of tarball files
for image in image_candidates:
+ logging.debug("Trying to extract %s (tauto)", image)
if image in tarball_files:
# Extract and return the first image candidate found
tar_cmd = 'tar xf %s -C %s %s' % (tarball, dest_dir, image)
@@ -1534,22 +1535,21 @@
@return: Path to extracted BIOS image.
"""
- # Try to retrieve firmware build target from the version reported
- # by the EC. If this doesn't work, we assume the firmware build
- # target is the same as the model name.
+ # Most boards use the model name as the image filename.
+ bios_image_candidates = [
+ 'image-%s.bin' % model,
+ ]
+
+ # If that isn't found try the name from the EC RO version.
try:
fw_target = self.get_ec_board()
+ bios_image_candidates.append('image-%s.bin' % fw_target)
except Exception as err:
- logging.warn('Failed to get ec_board value; ignoring')
- fw_target = model
- pass
+ logging.warning('Failed to get ec_board value; ignoring')
- # Array of candidates for BIOS image
- bios_image_candidates = [
- 'image.bin',
- 'image-%s.bin' % fw_target,
- 'image-%s.bin' % board
- ]
+ # Fallback to the name of the board, and then a bare image.bin.
+ bios_image_candidates.append('image-%s.bin' % board)
+ bios_image_candidates.append('image.bin')
# Extract BIOS image from tarball
dest_dir = os.path.join(os.path.dirname(tarball_path), 'BIOS')