summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2023-02-10 16:05:53 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-13 22:53:17 +0000
commit8921a785e4a0f696d33ec06ab3b6eaa438502784 (patch)
tree2da2bf654054d3bd2b9c658c5a0db6f93229d100
parent69b054e3276806a2fa86b4894d5f5d90912e1ef9 (diff)
downloadvboot-8921a785e4a0f696d33ec06ab3b6eaa438502784.tar.gz
futility: updater: detect DUT type
Detect if we are going to update a remote DUT (by checking if the flash parameter has been changed), and ignore all the local system properties if needed. This should help 'updating a Chromebook from a Chromebox via servo' to behave the same as updating from a non-ChromeOS Linux desktop. BUG=b:247428499,b:255617349 TEST=make; run test BRANCH=None Change-Id: I4aa0e98efa21179708d8b593fc619b7f7b65f418 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4181582 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
-rw-r--r--futility/updater.c5
-rw-r--r--futility/updater.h1
-rw-r--r--futility/updater_dut.c22
-rw-r--r--futility/updater_quirks.c9
4 files changed, 34 insertions, 3 deletions
diff --git a/futility/updater.c b/futility/updater.c
index d4d44f9d..b08e70ad 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -1437,6 +1437,11 @@ int updater_setup_config(struct updater_config *cfg,
if (arg->force_update)
cfg->force_update = 1;
+ /* Identify DUT type. Currently only local/remote (via servo). */
+ cfg->dut_is_remote = arg->use_flash;
+ if (cfg->dut_is_remote)
+ INFO("Configured to update a remote DUT via Servo.\n");
+
/* Check incompatible options and return early. */
if (arg->do_manifest) {
if (!!arg->archive == !!arg->image) {
diff --git a/futility/updater.h b/futility/updater.h
index 4382217d..788bf65f 100644
--- a/futility/updater.h
+++ b/futility/updater.h
@@ -90,6 +90,7 @@ struct updater_config {
int override_gbb_flags;
uint32_t gbb_flags;
bool detect_model;
+ bool dut_is_remote;
};
struct updater_config_arguments {
diff --git a/futility/updater_dut.c b/futility/updater_dut.c
index 7062a614..102859ae 100644
--- a/futility/updater_dut.c
+++ b/futility/updater_dut.c
@@ -24,6 +24,11 @@
*/
int dut_get_manifest_key(char **manifest_key_out, struct updater_config *cfg)
{
+ if (cfg->dut_is_remote) {
+ WARN("Cannot retrieve the remote DUT manifest info. "
+ "Please specify the DUT type by --model.\n");
+ return -1;
+ }
#ifdef HAVE_CROSID
return crosid_get_firmware_manifest_key(manifest_key_out);
#else
@@ -38,25 +43,40 @@ int dut_get_manifest_key(char **manifest_key_out, struct updater_config *cfg)
int dut_set_property_string(const char *key, const char *value,
struct updater_config *cfg)
-
{
+ if (cfg->dut_is_remote) {
+ WARN("Ignored setting property %s on a remote DUT.\n", key);
+ return -1;
+ }
return VbSetSystemPropertyString(key, value);
}
const char *dut_get_property_string(const char *key, char *dest, size_t size,
struct updater_config *cfg)
{
+ if (cfg->dut_is_remote) {
+ WARN("Ignored getting property %s on a remote DUT.\n", key);
+ return NULL;
+ }
return VbGetSystemPropertyString(key, dest, size);
}
int dut_set_property_int(const char *key, const int value,
struct updater_config *cfg)
{
+ if (cfg->dut_is_remote) {
+ WARN("Ignored setting property %s on a remote DUT.\n", key);
+ return -1;
+ }
return VbSetSystemPropertyInt(key, value);
}
int dut_get_property_int(const char *key, struct updater_config *cfg)
{
+ if (cfg->dut_is_remote) {
+ WARN("Ignored getting property %s on a remote DUT.\n", key);
+ return -1;
+ }
return VbGetSystemPropertyInt(key);
}
diff --git a/futility/updater_quirks.c b/futility/updater_quirks.c
index 31b376c5..aadb9e72 100644
--- a/futility/updater_quirks.c
+++ b/futility/updater_quirks.c
@@ -76,9 +76,14 @@ static int is_ec_software_sync_enabled(struct updater_config *cfg)
{
const struct vb2_gbb_header *gbb;
+ int vdat_flags = dut_get_property_int("vdat_flags", cfg);
+ if (vdat_flags < 0) {
+ WARN("Failed to identify DUT vdat_flags.\n");
+ return 0;
+ }
+
/* Check if current system has disabled software sync or no support. */
- if (!(dut_get_property_int("vdat_flags", cfg) & VBSD_EC_SOFTWARE_SYNC))
- {
+ if (!(vdat_flags & VBSD_EC_SOFTWARE_SYNC)) {
INFO("EC Software Sync is not available.\n");
return 0;
}