summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-03-04 10:21:31 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-06 02:35:12 -0800
commit94388feaf11a1aaca22311138b1060db592aa669 (patch)
treed8c7957af476ad93fed9b372350183a3548629e2
parent049ab52a120f3bff4e862fd2e98098bc66ef1b03 (diff)
downloadchrome-ec-94388feaf11a1aaca22311138b1060db592aa669.tar.gz
gsctool: make sure programmed image size is properly aligned
Flash driver of the g chip requires that the size of the programmed area is evenly divisible by 4. This patch makes sure that gsctool complies with this requirement. BRANCH=none BUG=b:127295653 TEST=without this patch attempts to update Cr50 to an image built from ToT fails, with this patch the same image programs just fine. Change-Id: I064d22130a56e9e703f728bc898fd5de82d365d4 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1499657 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
-rw-r--r--extra/usb_updater/gsctool.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index e24306cbc2..996ac42749 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -720,6 +720,12 @@ static void transfer_section(struct transfer_descriptor *td,
while (data_len && (data_ptr[data_len - 1] == 0xff))
data_len--;
+ /*
+ * Make sure total size is 4 bytes aligned, this is required for
+ * successful flashing.
+ */
+ data_len = (data_len + 3) & ~3;
+
printf("sending 0x%zx bytes to %#x\n", data_len, section_addr);
while (data_len) {
size_t payload_size;