summaryrefslogtreecommitdiff
path: root/futility/updater_utils.h
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2020-02-17 16:02:08 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-21 10:35:48 +0000
commitb2efcbe10010944d0ed6c49e2131d898ee7ea7fe (patch)
tree4619477c0e2efcff20bc8d0387f24a3ee1e2fb4d /futility/updater_utils.h
parent83ab1908e8173cddc8405a341fe1dc79a2c8d911 (diff)
downloadvboot-b2efcbe10010944d0ed6c49e2131d898ee7ea7fe.tar.gz
futility: updater: Ignore image parsing error in --force
The firmware updater has been improved to support flashing outside DUT (--ccd, --servo) that also implies more people will use it for devices with corrupted (or empty) firmware. It's pretty confusing for developers to see "Cannot load system active firmware" while the flashrom can actually read and write to the SPI firmware. The solution here is to allow updating on such devices when --force is specified (which is automatically applied for --servo and --ccd). BUG=b:148405957 TEST=make runtests BRANCH=None Change-Id: I19e63e3464616bc508639cbfad0d1cf8e99507b0 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2059621 Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'futility/updater_utils.h')
-rw-r--r--futility/updater_utils.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/futility/updater_utils.h b/futility/updater_utils.h
index 5e6e99cd..622e4e2e 100644
--- a/futility/updater_utils.h
+++ b/futility/updater_utils.h
@@ -64,11 +64,18 @@ struct firmware_image {
FmapHeader *fmap_header;
};
+enum {
+ IMAGE_LOAD_SUCCESS = 0,
+ IMAGE_READ_FAILURE = -1,
+ IMAGE_PARSE_FAILURE = -2,
+};
+
/*
* Loads a firmware image from file.
* If archive is provided and file_name is a relative path, read the file from
* archive.
- * Returns 0 on success, otherwise failure.
+ * Returns IMAGE_LOAD_SUCCESS on success, IMAGE_READ_FAILURE on file I/O
+ * failure, or IMAGE_PARSE_FAILURE for non-vboot images.
*/
int load_firmware_image(struct firmware_image *image, const char *file_name,
struct archive *archive);