summaryrefslogtreecommitdiff
path: root/futility/updater.h
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-10-06 03:15:19 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-13 21:59:21 -0700
commit3e6397d3d612a6436052c163b8686020357e7442 (patch)
tree9ac5583599f3d7963afb305ac13d9b68278f3e4f /futility/updater.h
parent7c94d5be063a5950b8af558739b7c351eddd3ced (diff)
downloadvboot-3e6397d3d612a6436052c163b8686020357e7442.tar.gz
futility: updater: Add --manifest to scan and print archive info
The firmware updater packages used to rely on a pre-generated VERSION file to report what files were included and their image versions. Its format was hard to parse, and may be out-dated if people repack without updating VERSION file. The firmware updater today has the ability to read and parse version, key hash, ... etc everything we need, so it seems more reasonable to just let firmware updater scan updater package and print the information in JSON format, so it will be very easy to fetch latest information. To make sure the output is purely JSON, the start and end messages are now sent to stderr instead of stdout. BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Ifa468fbb3adf798c7931f015258e6c6ce93de993 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1260804
Diffstat (limited to 'futility/updater.h')
-rw-r--r--futility/updater.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/futility/updater.h b/futility/updater.h
index a6cb3a72..366ecf10 100644
--- a/futility/updater.h
+++ b/futility/updater.h
@@ -118,6 +118,20 @@ struct updater_config_arguments {
int verbosity;
};
+struct model_config {
+ char *name;
+ char *image, *ec_image, *pd_image;
+ char *signature_id;
+};
+
+struct manifest {
+ int num;
+ int default_model;
+ int has_keyset;
+ struct model_config *models;
+ struct archive *archive;
+};
+
enum updater_error_codes {
UPDATE_ERR_DONE,
UPDATE_ERR_NEED_RO_UPDATE,
@@ -265,4 +279,16 @@ int archive_has_entry(struct archive *ar, const char *name);
int archive_read_file(struct archive *ar, const char *fname,
uint8_t **data, uint32_t *size);
+/*
+ * Creates a new manifest object by scanning files in archive.
+ * Returns the manifest on success, otherwise NULL for failure.
+ */
+struct manifest *new_manifest_from_archive(struct archive *archive);
+
+/* Releases all resources allocated by given manifest object. */
+void delete_manifest(struct manifest *manifest);
+
+/* Prints the information of objects in manifest (models and images) in JSON. */
+void print_json_manifest(const struct manifest *manifest);
+
#endif /* VBOOT_REFERENCE_FUTILITY_UPDATER_H_ */