summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-12-03 13:16:45 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-28 22:15:51 +0000
commitb5ca19dc6b20cbad5283f250f50e1dd177b4f258 (patch)
treeeeb1ead7bd7b0aab18a189cbeeed096615ef2e73
parentc7638c758fbe13e24c713ef891afc39d244a9d4a (diff)
downloadchrome-ec-stabilize-12951.B-cr50_stab.tar.gz
gsctool: add 'force_ro' optionstabilize-12951.B-cr50_stab
By design gsctool does not update the inactive RO unless the running RO version is lower than the version in the Cr50 image being transferred. With transition to the new RO version, keys and rollback map state, there is a need to enforce that both ROs on the device are updated. This patch adds a command line option which allows to update the inactive RO to the contents of the Cr50 image. BRANCH=none BUG=b:136284186 TEST=running 'gsctool -q cr50.bin' updates the inactive RO section. Change-Id: I79c21fc2cd41c40070352d8fbce0b71dd3ae2b1f Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949547 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit 53f59f6b361e8cf0a8d1af70306146db90ffae23) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2058127 Tested-by: Namyoon Woo <namyoon@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
-rw-r--r--extra/usb_updater/gsctool.c8
-rw-r--r--extra/usb_updater/gsctool.h6
2 files changed, 12 insertions, 2 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 6db8f7cb10..4540814e56 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -296,6 +296,8 @@ static const struct option_container cmd_line_options[] = {
"Set or clear CCD password. Use 'clear:<cur password>' to clear it"},
{{"post_reset", no_argument, NULL, 'p'},
"Request post reset after transfer"},
+ {{"force_ro", no_argument, NULL, 'q'},
+ "Force inactive RO update"},
{{"sn_rma_inc", required_argument, NULL, 'R'},
"RMA_INC%Increment SN RMA count by RMA_INC. RMA_INC should be 0-7."},
{{"rma_auth", optional_argument, NULL, 'r'},
@@ -1013,7 +1015,8 @@ static void pick_sections(struct transfer_descriptor *td)
* Is it newer in the new image than the running RO section on
* the device?
*/
- if (a_newer_than_b(&sections[i].shv, &targ.shv[0]))
+ if (a_newer_than_b(&sections[i].shv, &targ.shv[0]) ||
+ td->force_ro)
sections[i].ustatus = needed;
}
}
@@ -2761,6 +2764,9 @@ int main(int argc, char *argv[])
case 'O':
openbox_desc_file = optarg;
break;
+ case 'q':
+ td.force_ro = 1;
+ break;
case 'r':
rma = 1;
rma_auth_code = optarg;
diff --git a/extra/usb_updater/gsctool.h b/extra/usb_updater/gsctool.h
index d58c3ba71f..0be6faeb1c 100644
--- a/extra/usb_updater/gsctool.h
+++ b/extra/usb_updater/gsctool.h
@@ -32,7 +32,11 @@ struct transfer_descriptor {
* the cr50 versioning scheme.
*/
int background_update_supported;
-
+ /*
+ * Unconditionally update the inactive RO, helps to make sure both RO
+ * sections are at the same level.
+ */
+ int force_ro;
/*
* offsets of RO and WR sections available for update (not currently
* active).