summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2022-04-14 09:04:58 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-19 15:03:15 +0000
commit12ae8f10b21d4ff320aa74863ad19ac4f5f09934 (patch)
tree66af3c507105fe5695a29ed7dcbf8e964cbacfd1
parent7e8e3e0d75b3dda4bea6a866ba14f8bfe13947d0 (diff)
downloadchrome-ec-factory-cherry-14455.B-cr50_stab.tar.gz
gsctool: update apro boot cmd to support triggering ro verifyfactory-cherry-14455.B-cr50_stab
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> (cherry picked from commit a5339d70a3bfbbbbc7c90b2dda66deaae872b064) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3841047 Tested-by: Knox Chiou <knoxchiou@chromium.org> Auto-Submit: Knox Chiou <knoxchiou@chromium.org> Reviewed-by: Yu-An Wang <wyuang@google.com> Commit-Queue: Yu-An Wang <wyuang@google.com>
-rw-r--r--extra/usb_updater/gsctool.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index cf28976755..ea6c6b3d37 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));