summaryrefslogtreecommitdiff
path: root/futility/updater_manifest.c
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_manifest.c
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_manifest.c')
-rw-r--r--futility/updater_manifest.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/futility/updater_manifest.c b/futility/updater_manifest.c
index ca338c40..6d7d9d41 100644
--- a/futility/updater_manifest.c
+++ b/futility/updater_manifest.c
@@ -10,10 +10,6 @@
#include <sys/types.h>
#endif
-#ifdef HAVE_CROSID
-#include <crosid.h>
-#endif
-
#include "updater.h"
#include "util_misc.h"
@@ -619,30 +615,6 @@ static int manifest_from_simple_folder(struct manifest *manifest)
return 0;
}
-/**
- * get_manifest_key() - Wrapper to get the firmware manifest key from crosid
- *
- * @manifest_key_out - Output parameter of the firmware manifest key.
- *
- * Returns:
- * - <0 if libcrosid is unavailable or there was an error reading
- * device data
- * - >=0 (the matched device index) success
- */
-static int get_manifest_key(char **manifest_key_out)
-{
-#ifdef HAVE_CROSID
- return crosid_get_firmware_manifest_key(manifest_key_out);
-#else
- ERROR("This version of futility was compiled without libcrosid "
- "(perhaps compiled outside of the Chrome OS build system?) and "
- "the update command is not fully supported. Either compile "
- "from the Chrome OS build, or pass --model to manually specify "
- "the machine model.\n");
- return -1;
-#endif
-}
-
/*
* Finds the existing model_config from manifest that best matches current
* system (as defined by model_name).
@@ -665,7 +637,7 @@ const struct model_config *manifest_find_model(const struct manifest *manifest,
return &manifest->models[0];
if (!model_name) {
- matched_index = get_manifest_key(&manifest_key);
+ matched_index = dut_get_manifest_key(&manifest_key);
if (matched_index < 0) {
ERROR("Failed to get device identity. "
"Run \"crosid -v\" for explanation.\n");