diff options
author | Mary Ruthven <mruthven@chromium.org> | 2022-04-14 09:04:58 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-15 19:21:02 +0000 |
commit | a5339d70a3bfbbbbc7c90b2dda66deaae872b064 (patch) | |
tree | 7cb8634f7898d79e213de3b235a0dbd44c9ef92d | |
parent | 11369639f391f27ec9ad2c91a955beb97c3f5a3d (diff) | |
download | chrome-ec-a5339d70a3bfbbbbc7c90b2dda66deaae872b064.tar.gz |
gsctool: update apro boot cmd to support triggering ro verify
gsctool is running out of short opts. This change replaces
get_apro_boot_status to make it more flexible. We can add future ap ro
vendor commands to this arg.
Replace --get_apro_boot_status with '--apro_boot' to get the AP RO
verification status. Add '--apro_boot start' to trigger AP RO verify.
BUG=b:195693537
TEST=run 'gsctool -aB start' to trigger verification on hatch. Use
'gsctool -aB' to check the status.
Change-Id: I7c8cb73dca8309a5cf61981f7e3154dc85e4590d
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3587153
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | extra/usb_updater/gsctool.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c index 16a83025bb..70696ff2b3 100644 --- a/extra/usb_updater/gsctool.c +++ b/extra/usb_updater/gsctool.c @@ -265,8 +265,8 @@ static const struct option_container cmd_line_options[] = { {{"any", no_argument, NULL, 'a'}, "Try any interfaces to find Cr50" " (-d, -s, -t are all ignored)"}, - {{"get_apro_boot_status", no_argument, NULL, 'B'}, - "get the stored ap ro boot state"}, + {{"apro_boot", optional_argument, NULL, 'B'}, + "[start] get the stored ap ro boot state or start ap ro verify"}, {{"binvers", no_argument, NULL, 'b'}, "Report versions of Cr50 image's " "RW and RO headers, do not update"}, @@ -2284,6 +2284,19 @@ static int process_get_apro_hash(struct transfer_descriptor *td) return 0; } +static int process_start_apro_verify(struct transfer_descriptor *td) +{ + int rv = 0; + + rv = send_vendor_command(td, VENDOR_CC_AP_RO_VALIDATE, NULL, 0, NULL, + NULL); + if (rv != VENDOR_RC_SUCCESS) { + fprintf(stderr, "Error %d starting RO verify\n", rv); + return update_error; + } + return 0; +} + static int process_get_apro_boot_status(struct transfer_descriptor *td) { size_t response_size; @@ -3039,6 +3052,7 @@ int main(int argc, char *argv[]) int tpm_mode = 0; int get_apro_hash = 0; int get_apro_boot_status = 0; + int start_apro_verify = 0; bool show_machine_output = false; int tstamp = 0; const char *tstamp_arg = NULL; @@ -3063,7 +3077,6 @@ int main(int argc, char *argv[]) */ const struct options_map omap[] = { { 'b', &binary_vers }, - { 'B', &get_apro_boot_status }, { 'c', &corrupt_inactive_rw }, { 'D', &is_dauntless }, { 'f', &show_fw_ver }, @@ -3119,6 +3132,12 @@ int main(int argc, char *argv[]) /* Try dev_xfer first. */ td.ep_type = dev_xfer; break; + case 'B': + if (optarg && !strcmp(optarg, "start")) + start_apro_verify = 1; + else + get_apro_boot_status = 1; + break; case 'd': if (!parse_vidpid(optarg, &vid, &pid)) { fprintf(stderr, @@ -3277,6 +3296,7 @@ int main(int argc, char *argv[]) !show_fw_ver && !sn_bits && !sn_inc_rma && + !start_apro_verify && !openbox_desc_file && !tstamp && !tpm_mode && @@ -3390,6 +3410,9 @@ int main(int argc, char *argv[]) if (get_apro_boot_status) exit(process_get_apro_boot_status(&td)); + if (start_apro_verify) + exit(process_start_apro_verify(&td)); + if (get_boot_mode) exit(process_get_boot_mode(&td)); |