diff options
author | Wei-Han Chen <stimim@google.com> | 2018-10-08 11:21:00 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-15 23:28:42 -0700 |
commit | e89911e940dc94ebf3765e785716d4431a9d646e (patch) | |
tree | 1fa8a6f65865fff46e97d1b4544f99af112a6393 /util/unpack_ftb.py | |
parent | 582dfdbe15bbd9118fc2b53cf423544f16cc2d19 (diff) | |
download | chrome-ec-e89911e940dc94ebf3765e785716d4431a9d646e.tar.gz |
touchpad_st: embed FTB header in unpacked TP FW
To make it easier to decide if full panel initialization is required,
we put the original FTB header in the beginning of unpacked TP FW.
touchpad_update_write will clear CX data if CX version will be
different.
CQ-DEPEND=CL:*697971
BRANCH=nocturne
BUG=b:117203130
TEST=manual on whiskers
Signed-off-by: Wei-Han Chen <stimim@chromium.org>
Change-Id: I60351783b8c015fcb23431811c156bfca8d15b67
Reviewed-on: https://chromium-review.googlesource.com/1267876
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'util/unpack_ftb.py')
-rwxr-xr-x | util/unpack_ftb.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/util/unpack_ftb.py b/util/unpack_ftb.py index 49f4d0ab5b..1777d5eec6 100755 --- a/util/unpack_ftb.py +++ b/util/unpack_ftb.py @@ -41,7 +41,15 @@ FLASH_SEC_ADDR = [ None # This section shouldn't exist ] -OUTPUT_FILE_SIZE = 128 * 1024 # 128KB +UPDATE_PDU_SIZE = 4096 + +# Bin file format: +# FTB header (padded to `UPDATE_PDU_SIZE`) +# Flash sections +# CODE +# CX +# CONFIG +OUTPUT_FILE_SIZE = UPDATE_PDU_SIZE + 128 * 1024 def main(): @@ -85,6 +93,9 @@ def main(): f.seek(OUTPUT_FILE_SIZE - 1, os.SEEK_SET) f.write('\x00') + f.seek(0, os.SEEK_SET) + f.write(bs[0 : ctypes.sizeof(header)]) + offset = 0 # write each sections for i, addr in enumerate(FLASH_SEC_ADDR): @@ -94,7 +105,7 @@ def main(): if size == 0: continue - f.seek(addr, os.SEEK_SET) + f.seek(UPDATE_PDU_SIZE + addr, os.SEEK_SET) f.write(data[offset : offset + size]) offset += size |