summaryrefslogtreecommitdiff
path: root/futility/updater_utils.h
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2023-01-19 23:27:57 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-12 10:37:39 +0000
commit9813a9b4470bd1609c853a2381f050faebd4902e (patch)
tree76e1c3eb7a280d0fa96285ad137c15f5f432e192 /futility/updater_utils.h
parent4634c11de5939f1f14fb0a3a7bc685048e5dd875 (diff)
downloadvboot-9813a9b4470bd1609c853a2381f050faebd4902e.tar.gz
futility: updater: refactor DUT system info retrieval
When developers (or the lab) runs 'futility update' on a Chromebox to update a remote DUT connected via servo, the updater will incorrectly recognize the Chromebox as the 'host' = 'system' = 'DUT', selecting wrong config and setting wrong cookies. To fix that, we want to isolate and refactor how we identify and access 'host' and 'DUT'. The first step is to rename and move the 'system property' related functions to 'dut properties' in the `updater_dut.c`. No functional changes in this patch. Only renamed functions and moved the implementation to different places. BUG=b:247428499,b:255617349 TEST=make; run test BRANCH=None Change-Id: I5c1f9bb67a14fbcdd80958597290a2789f4c2dac Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4181581 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Diffstat (limited to 'futility/updater_utils.h')
-rw-r--r--futility/updater_utils.h47
1 files changed, 30 insertions, 17 deletions
diff --git a/futility/updater_utils.h b/futility/updater_utils.h
index a5d012b8..93964a4d 100644
--- a/futility/updater_utils.h
+++ b/futility/updater_utils.h
@@ -156,6 +156,11 @@ int preserve_firmware_section(const struct firmware_image *image_from,
const char *section_name);
/*
+ * Returns rootkey hash of firmware image, or NULL on failure.
+ */
+const char *get_firmware_rootkey_hash(const struct firmware_image *image);
+
+/*
* Finds the GBB (Google Binary Block) header on a given firmware image.
* Returns a pointer to valid GBB header, or NULL on not found.
*/
@@ -223,29 +228,37 @@ const char *cbfs_extract_file(const char *image_file,
const char *cbfs_name,
struct tempfile *tempfiles);
-/* Utilities for accessing system properties */
-struct system_property {
- int (*getter)(void);
+/* DUT related functions (implementations in updater_dut.c) */
+
+struct dut_property {
+ int (*getter)(struct updater_config *cfg);
int value;
int initialized;
};
-enum system_property_type {
- SYS_PROP_MAINFW_ACT,
- SYS_PROP_TPM_FWVER,
- SYS_PROP_FW_VBOOT2,
- SYS_PROP_PLATFORM_VER,
- SYS_PROP_WP_HW,
- SYS_PROP_WP_SW,
- SYS_PROP_MAX
+enum dut_property_type {
+ DUT_PROP_MAINFW_ACT,
+ DUT_PROP_TPM_FWVER,
+ DUT_PROP_FW_VBOOT2,
+ DUT_PROP_PLATFORM_VER,
+ DUT_PROP_WP_HW,
+ DUT_PROP_WP_SW,
+ DUT_PROP_MAX
};
-/* Helper function to initialize system properties. */
-void init_system_properties(struct system_property *props, int num);
+/* Helper function to initialize DUT properties. */
+void dut_init_properties(struct dut_property *props, int num);
-/*
- * Returns rootkey hash of firmware image, or NULL on failure.
- */
-const char *get_firmware_rootkey_hash(const struct firmware_image *image);
+/* Gets the DUT system property by given type. Returns the property value. */
+int dut_get_property(enum dut_property_type property_type,
+ struct updater_config *cfg);
+
+int dut_set_property_string(const char *key, const char *value);
+const char *dut_get_property_string(const char *key, char *dest, size_t size);
+int dut_set_property_int(const char *key, const int value);
+int dut_get_property_int(const char *key);
+
+/* Gets the 'firmware manifest key' on the DUT. */
+int dut_get_manifest_key(char **manifest_key_out);
#endif /* VBOOT_REFERENCE_FUTILITY_UPDATER_UTILS_H_ */