summaryrefslogtreecommitdiff
path: root/scripts/update_payload
Commit message (Collapse)AuthorAgeFilesLines
* Update update_metadata_pb2.pyYifan Hong2019-10-081-151/+210
| | | | | | | | | Generated with: aprotoc --python_out scripts/update_payload update_metadata.proto Test: cd system/update_engine/scripts && ./run_unittests Change-Id: I68b0659e5de7545fb0143a930859c703ec50ae13
* update_payload: uprev to minor version 6Amin Hassani2019-01-102-5/+2
| | | | | | | | BUG=chromium:920699 TEST=unittest TEST=check_update_payload --check # with a delta payload Change-Id: I40bc1e535ed241b74c6d889757a8dcf046bac0de
* Merge aosp/upstream-master into aosp/master.Sen Jiang2019-01-042-18/+29
|\ | | | | | | | | | | | | Added BinderUpdateEngineClient::AttemptInstall(). Test: update_engine_unittests Change-Id: Id6911f49d763b0d572658acb7d66857016bf6969
| * update_payload: Fix problem with signature size on unsigned payloadsAmin Hassani2018-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the payload is unsigned (e.g. for test image), then the checker.sigs_file would not exist. So check for that variable before using it. BUG=chromium:794404 BUG=chromium:914705 TEST=manually signing the payload ran update_payload_check with signed and unsigned image TEST=unittests Change-Id: I871137eadef00d012ee926d12fd4eee36a454487 Reviewed-on: https://chromium-review.googlesource.com/1375023 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * update_payload: Add the remaining major version 2 signature supportsAmin Hassani2018-12-102-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the issues with signatures (sizes) in major version 2 and a few minor issues with the payload and metadata sizes. BUG=chromium:862679 TEST=manually signing the payload and running update_payload_check TEST=unittests Change-Id: I9b431379b0574a150474a913f1ec4a11e86288ae Reviewed-on: https://chromium-review.googlesource.com/1363339 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* | Update update_metadata_pb2.pySen Jiang2018-11-151-11/+164
|/ | | | | | | | | Generated with: protoc --python_out scripts/update_payload update_metadata.proto Bug: 119222724 Test: None Change-Id: I384f370358a3e97e038b2350416f422d47fe999a
* update_payload: Make paycheck take "root" instead of "rootfs"Tudor Brindus2018-07-113-14/+15
| | | | | | | | | | | | | | | This commit makes paycheck take "root" as the rootfs partition label instead of "rootfs", which makes it consistent with other tooling like delta_generator. BUG=chromium:794404 TEST=test_paycheck.sh and run_unittests Change-Id: I20835e93adbcde459bc86d832e695b38bca55e38 Reviewed-on: https://chromium-review.googlesource.com/1132843 Commit-Ready: Tudor Brindus <tbrindus@chromium.org> Tested-by: Tudor Brindus <tbrindus@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
* update_payload: Implement applying for major version 2 payloadsTudor Brindus2018-06-261-29/+44
| | | | | | | | | | | | | | | | | | | This commit adds payload major version 2 support to paycheck.py applying. BUG=b:794404 TEST=no errors during run_unittests and paycheck.py <major version 2 payload> --part_names boot system --out_dst_part_paths /tmp/boot_part /tmp/system_part (./test_paycheck.sh does not pass for major version 2 payloads since it currently does not detect version 2 payloads, and specifies rootfs/kernel as the partitions to paycheck.py instead of system/boot; no regressions when running on major version 1 payloads) Change-Id: Ic411607cee6f032851d1fa9545bed68fe2d3da77 Reviewed-on: https://chromium-review.googlesource.com/1106656 Commit-Ready: Tudor Brindus <tbrindus@chromium.org> Tested-by: Tudor Brindus <tbrindus@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
* update_payload: Implement checking for major version 2 payloadsTudor Brindus2018-06-262-66/+141
| | | | | | | | | | | | | | | | | | | | This commit adds payload major version 2 support to paycheck.py --check. For consistency, report messages for affected fields are kept the same across both major version 1 and 2 checks, even if the particular field name does not exist in one version. BUG=b:794404 TEST=no errors during run_unittests and paycheck.py --check <major version 2 payload> (./test_paycheck.sh does not pass for major version 2 payloads since applying is not implemented yet; no regressions when running on major version 1 payloads) Change-Id: I3c5d0cbca3336c8136326ca52b19f659c7c741c9 Reviewed-on: https://chromium-review.googlesource.com/1105610 Commit-Ready: Tudor Brindus <tbrindus@chromium.org> Tested-by: Tudor Brindus <tbrindus@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
* update_payload: Allow specifying partition options for major version 2Tudor Brindus2018-06-254-41/+36
| | | | | | | | | | | | | | | | | | | | | | | This commit adds the ability to specify partition options for more than just kernel/rootfs. This supersedes -p/--root-part-size, -P/--kern-part-size, --dst_kern, --dst_root, --src_kern, --src_root, --out_dst_kern, and --out_dst_root. They are replaced by --part_names used in conjunction with --part_sizes, --dst_part_paths, --src_part_paths, and --out_dst_part_paths. Backwards-compatibility with the old flags is kept, so long as they are not used alongside the new flags. BUG=b:794404 TEST=no errors during run_unittests and test_paycheck.sh Change-Id: Icc1118abbf89dd268be3eafe41723657c5178197 Reviewed-on: https://chromium-review.googlesource.com/1103063 Commit-Ready: Tudor Brindus <tbrindus@chromium.org> Tested-by: Tudor Brindus <tbrindus@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
* update_payload: De-duplicate paycheck partition handling for major version 2Tudor Brindus2018-06-213-75/+83
| | | | | | | | | | | | | | | This commit makes handling of major version 2 rootfs/kernel partitions more generic, with the goal of reusing the same code paths for major version 2 (which has an arbitrary number of partitions per payload). BUG=b:794404 TEST=no errors during run_unittests and test_paycheck.sh Change-Id: Ic6e8cdaae557c10dfbd302dba0e52ff8b2870c9f Reviewed-on: https://chromium-review.googlesource.com/1101500 Commit-Ready: Tudor Brindus <tbrindus@chromium.org> Tested-by: Tudor Brindus <tbrindus@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
* Merge remote-tracking branch 'cros/upstream' into cros/masterAmin Hassani2018-06-041-3/+3
|\ | | | | | | | | | | | | | | | | BUG=chromium:815356 TEST=unittest TEST=precq TEST=cros flash Change-Id: I8d9c37411708d0cae61613b285123a090ce6deb1
| * Correct some spellings.Sen Jiang2018-04-041-3/+3
| | | | | | | | | | Test: mma Change-Id: Icc49a4ee76f12d302ed18982d334f2f70b7263a8
* | update_payload: Allow check for given metadata sizeAmin Hassani2018-03-233-7/+23
|/ | | | | | | | | | | | | | | Allow passing metadata size to check_update_payload so we can verify the metadata size in omaha equals to the one in the payload. BUG=chromium:820243 TEST=run paycheck.py with both valid and invalid metadata sizes reports as expected TEST=unittests Change-Id: Ib41ce77af77636fffec6752201c363e7fbbf868d Reviewed-on: https://chromium-review.googlesource.com/955679 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
* Merge remote-tracking branch 'aosp/upstream-master'.Sen Jiang2018-03-0913-188/+271
|\ | | | | | | | | | | | | Bug: 30989362 Test: update_engine_unittests Change-Id: I04417ac21508f4da3ead29b1dea34886f2fc84af Merged-In: I04417ac21508f4da3ead29b1dea34886f2fc84af
| * update_engine: Disable puffin in minor version 4Amin Hassani2018-02-084-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch disables puffin for minor version 4, but keeps BROTLI_BSDIFF in the same minor version. Also adds puffin for minor version 5, but it does not enable it. BUG=b:72815313 BUG=chromium:810184 TEST=update_engine unittests pass TEST=update_payload unittests pass TEST=test_paycheck.sh on two images with minor version 4 pass TEST=brill_update_payload generate/verify pass Change-Id: I814fc126d67207501d419cff9c575cd13d877b48 Reviewed-on: https://chromium-review.googlesource.com/907223 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
| * update_payload: migrate the license headers to AOSPAmin Hassani2018-01-3012-36/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | update_engine/scripts/* have CROS license but the rest of UE have android license. This cl just migrates all CROS licenses to AOSP. BUG=None TEST=repo upload did not complain about the mismatched licenses. Change-Id: Id947be3e860baf7a523163965336f47d268c6808 Reviewed-on: https://chromium-review.googlesource.com/891688 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
| * update_payload: remove block tracerAmin Hassani2018-01-292-134/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | block tracing was useful for minor version 1 with move operations (before having A/B updates). But, we do not create that operation anymore and we are in the process of moving to major version 2. So this needs to go BUG=chromium:794404 TEST=unit tests Change-Id: I56d24ef81e8f37c481669d47e5878eb3a321131f Reviewed-on: https://chromium-review.googlesource.com/888546 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * Relanding 'update_payload: Add XZ compression support'Amin Hassani2018-01-234-12/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for checking a payload that has REPLACE_XZ operations. REPLACE_XZ was added in minor version 3. BUG=chromium:758792 TEST=unittests pass; paycheck.py with a xz generated payload pass; CQ-DEPEND=CL:823234 Change-Id: I6ec8068e233f2d595fda93a985923d85c59f150e Reviewed-on: https://chromium-review.googlesource.com/872124 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* | Merge remote-tracking branch 'goog/upstream-master'.Sen Jiang2018-01-1112-189/+261
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | The following commits were reverted: 840703a Fix update over cellular network on guest account eaad5d0 Do not merge to AOSP: Fixes the link to brillo-clang-format in CrOS 740efad Reboot even if a system update is not available. Fixed a few sign compare warnings. Had to ifdef out 2 SquashfsFilesystemTest because it depends on unsquashfs -m. Test: update_engine_unittests Change-Id: I6f4ca5003e78c76064ec60d0797505d8c18d00bf Merged-In: I6f4ca5003e78c76064ec60d0797505d8c18d00bf
| * update_payload: Fix most of lint styling issues.Amin Hassani2018-01-0511-132/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a lot of pylint issues in the update_engine scripts. Majority of this changes are based on recommendation found in: https://www.chromium.org/chromium-os/python-style-guidelines It is a good idea to do these changes now, because if there are many pylint errors when performing 'repo upload', serious problems can be overshadowed by a lot of noise and eventually cause problems. These fixes include: - Fixing executable shebangs to /usr/bin/python2. - Fixing import-error problems by disabiling them. - Removing pylint disables that are not valid anymore. - Changing all imports to proper absolute import format. - Change the import of PayloadError from update_payload.PayloadError for simplicity. - Add pydoc strings for functions and classes that were missing. The remaining unchanged pylint problmes include: - The header files of these scripts are in CrOS copyright format, but the the cros lint hook is configured to AoSP copyright format. - The test* functions in unittests are not compatible with CamelCase format. BUG=chromium:796338 TEST=unittests pass TEST=start_devserver TEST=cros flash TEST=scripts/paycheck.py Change-Id: I7eed4d1625eb7c510c7949fada120de5a6a26c7b Reviewed-on: https://chromium-review.googlesource.com/834875 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * Fix pylint issue in payload.pySen Jiang2018-01-041-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ************* Module update_payload.payload W: 12, 0: Relative import 'applier', should be 'update_payload.applier' (relative-import) W: 13, 0: Relative import 'block_tracer', should be 'update_payload.block_tracer' (relative-import) W: 14, 0: Relative import 'checker', should be 'update_payload.checker' (relative-import) W: 15, 0: Relative import 'common', should be 'update_payload.common' (relative-import) W: 16, 0: Relative import 'error', should be 'update_payload.error' (relative-import) W: 17, 0: Relative import 'update_metadata_pb2', should be 'update_payload.update_metadata_pb2' (relative-import) C:222, 4: Missing function docstring (missing-docstring) E:261,33: Instance of 'DeltaArchiveManifest' has no 'partitions' member (no-member) Test: repo upload Change-Id: Ib3e99c6a3a5ea4575b442e672a871adc7b985289 (cherry picked from commit c2527f492e7a1389b2a3f248bd2b22d6cf5d9eb8) Reviewed-on: https://chromium-review.googlesource.com/834874 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * Revert "update_payload: Add XZ compression support"Amin Hassani2017-12-154-72/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f1d6ceaedbcf81044d6af6b716c63ed79996f0a4. Reason for revert: <canaries failing> Original change's description: > update_payload: Add XZ compression support > > This patch adds support for checking a payload that has REPLACE_XZ > operations. REPLACE_XZ was added in minor version 3. > > BUG=chromium:758792 > TEST=unittests pass; paycheck.py with a xz generated payload pass; > CQ-DEPEND=CL:823234 > > Change-Id: If82c767a201b189e464f459d5c19485e5278d9b1 > Reviewed-on: https://chromium-review.googlesource.com/823227 > Commit-Ready: Amin Hassani <ahassani@chromium.org> > Tested-by: Amin Hassani <ahassani@chromium.org> > Reviewed-by: Ben Chan <benchan@chromium.org> > Reviewed-by: Sen Jiang <senj@chromium.org> TBR=benchan@chromium.org,senj@chromium.org,ahassani@chromium.org Change-Id: I931ff3be081a41fe5fceef0e049ba4165c6acb49 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:795313 Reviewed-on: https://chromium-review.googlesource.com/830054 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * update_payload: Add XZ compression supportAmin Hassani2017-12-144-12/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for checking a payload that has REPLACE_XZ operations. REPLACE_XZ was added in minor version 3. BUG=chromium:758792 TEST=unittests pass; paycheck.py with a xz generated payload pass; CQ-DEPEND=CL:823234 Change-Id: If82c767a201b189e464f459d5c19485e5278d9b1 Reviewed-on: https://chromium-review.googlesource.com/823227 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * update_payload: Add puffin binary path to paycheck.pyAmin Hassani2017-12-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We forgot to add the path to the puffin binary to paycheck.py and payload.py and this caused the canary builds fail for minor version 4. This patch fixes it. BUG=chromium:791079 TEST=tryjob Change-Id: I194ab9d9d0b93fc9d456b994f73424d7dedbf181 Reviewed-on: https://chromium-review.googlesource.com/803656 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
| * update_engine: Adds BROTLI_BSDIFF operationAmin Hassani2017-11-225-30/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Brotli compression creates on average 10%-20% smaller output than bzip2 in addition to having faster decompressor. With recent changes in bsdiff to compress the its patch with brotli, we can use it in the update_engine as a new operation BROTLI_BSDIFF. This operation will be turned on in minor version 4. However, this CL only adds support for it in the client. It will not generate BROTLI_BSDIFF operations yet. BUG=chromium:783437 TEST=unittests pass for both update_engine and update_payload; 'brillo_update_payload {generate|verify}' passes; 'scripts/paycheck.py payload.delta' passes; Change-Id: Ie791ba5431561c95de6fbc031a8196dbfd912288 Reviewed-on: https://chromium-review.googlesource.com/764791 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
| * update_payload: Add puffdiff support.Amin Hassani2017-10-312-35/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for applier.py to be able to apply PUFFDIFF operation using puffin binary. It also fixes minor deficiencies for the PUFFDIFF operation. BUG=chromium:768461 TEST=unittests pass; TEST=scripts/paycheck.py payload-puffin.delta new_kern.dat new_root.dat old_kern.dat old_root.dat Change-Id: I5612ead8d8b8176e7263cfcb15403e8d36319642 Reviewed-on: https://chromium-review.googlesource.com/713540 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * update_payload: Add zero operation supportAmin Hassani2017-10-243-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currenlty the applier.py and checker.py does not support ZERO operation. This patch adds support for it. In addition, when generating ZERO operation, we were not clearing the source length and extent properties out of the protobuf. ZERO operation has no source length or extent. BUG=chromium:768461 TEST=unittest pass; scripts/paycheck.py --check payload.delta; Change-Id: I766deaca4380686797893c2686036d59525546f4 Reviewed-on: https://chromium-review.googlesource.com/713539 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * update_payload: Fix larger source issueAmin Hassani2017-10-162-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the _CheckOperations() function passes the new usable partition size as the old usable partition size. If the source image is larger than the target image, this will be errornous as some checks fail. BUG=chromium:773336 TEST=scripts/paycheck.py --check delta.bin (10002.0.0 reef -> 10019.0.0 reef) Change-Id: I8c30129831daff8e70df3dcb9639ff240e4a37ba Reviewed-on: https://chromium-review.googlesource.com/713463 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
| * update_engine: Change imgdiff/imgpatch to a dummy puffdiff/puffpatchAmin Hassani2017-08-095-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we never create imgdiff operation as it was never activated. In near future we will be adding puffdiff and puffpatch operations which replaces the imgdiff. This CL does not actually adds puffdiff, but adds a placeholder for it. BUG=none TEST=cros_workon_make --board=amd64-generic --test update_engine Change-Id: I6453048acb65c052354a1658f0c6fd41ad33e242 Reviewed-on: https://chromium-review.googlesource.com/602733 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* | update_device.py: support OTA zip if use omaha too.Sen Jiang2017-09-301-4/+9
| | | | | | | | | | | | | | | | Pass the offset and size to UpdateHandler. Also added support for payload offset in update_payload.Payload. Test: applied a local OTA Change-Id: Ib116ef2c23a11e298118f203814c4ea8dd1629af
* | Fix pylint issue in payload.pySen Jiang2017-09-301-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ************* Module update_payload.payload W: 12, 0: Relative import 'applier', should be 'update_payload.applier' (relative-import) W: 13, 0: Relative import 'block_tracer', should be 'update_payload.block_tracer' (relative-import) W: 14, 0: Relative import 'checker', should be 'update_payload.checker' (relative-import) W: 15, 0: Relative import 'common', should be 'update_payload.common' (relative-import) W: 16, 0: Relative import 'error', should be 'update_payload.error' (relative-import) W: 17, 0: Relative import 'update_metadata_pb2', should be 'update_payload.update_metadata_pb2' (relative-import) C:222, 4: Missing function docstring (missing-docstring) E:261,33: Instance of 'DeltaArchiveManifest' has no 'partitions' member (no-member) Test: repo upload Change-Id: Ib3e99c6a3a5ea4575b442e672a871adc7b985289
* | update_engine: Change imgdiff/imgpatch to a dummy puffdiff/puffpatchAmin Hassani2017-08-235-26/+33
|/ | | | | | | | | | | | | | | | | Currently we never create imgdiff operation as it was never activated. In near future we will be adding puffdiff and puffpatch operations which replaces the imgdiff. This CL does not actually adds puffdiff, but adds a placeholder for it. BUG=none TEST=cros_workon_make --board=amd64-generic --test update_engine Change-Id: I6453048acb65c052354a1658f0c6fd41ad33e242 Reviewed-on: https://chromium-review.googlesource.com/602733 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* paycheck: Support minor version 4.Sen Jiang2016-06-304-30/+43
| | | | | | | | | From https://chromium-review.googlesource.com/#/c/333160/ Bug: 27156473 Test: ./scripts/update_payload/checker_unittest.py Change-Id: I940debd5c878f622970e214fce75588f96d78407
* update_payload: Regenerate protobuf to include IMGDIFF.Sen Jiang2016-04-043-9/+16
| | | | | | | | | | | | | Generated from update_metadata.proto using protoc 2.5.0 BUG=b:26456666 TEST=./checker_unittest.py Change-Id: I9dc7db00be8afb2f78e80bec910f9ca83a55a9a1 Reviewed-on: https://chromium-review.googlesource.com/329237 Commit-Ready: Sen Jiang <senj@chromium.org> Tested-by: Sen Jiang <senj@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org>
* paycheck: Allow minor version 3 in applier.Sen Jiang2015-12-123-6/+8
| | | | | | | | | | | | | | | Also fixed nits in checker. BUG=chromium:568473 TEST=./checker_unittest.py Change-Id: Ia791f4dc636e9c3a2921aeaa5f9dd01c247bf5bb Reviewed-on: https://chromium-review.googlesource.com/317780 Trybot-Ready: Sen Jiang <senj@chromium.org> Tested-by: Sen Jiang <senj@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Sen Jiang <senj@chromium.org>
* paycheck: support minor version 3.Sen Jiang2015-12-113-7/+33
| | | | | | | | | | | | | | | | | Added check for mandatory source operation hash in minor version 3. Fixed unittest. BUG=chromium:568473 TEST=./paycheck.py <minor v3 payload>; ./checker_unittest.py Change-Id: Id96ddce8c59f28b3449524b786c54a6c69ca798f Reviewed-on: https://chromium-review.googlesource.com/317573 Trybot-Ready: Sen Jiang <senj@chromium.org> Tested-by: Sen Jiang <senj@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
* update_payload: Fix IsDelta to support payload v2.Sen Jiang2015-11-171-13/+18
| | | | | | | | | | | | | | | | | Added check for the old_partition_info field which is used by major version 2 payload. Other changes are needed in order to pass presubmit lint check. BUG=None TEST=Run devserver with a v2 delta payload. Change-Id: I3d7057fde44bd24d768177d5ed5c36bc2d4ca94b Reviewed-on: https://chromium-review.googlesource.com/312952 Commit-Ready: Sen Jiang <senj@chromium.org> Tested-by: Sen Jiang <senj@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org>
* Parse Payload v2 header.Alex Deymo2015-10-152-22/+79
| | | | | | | | | | | | | | | The update payload v2 contains an extra field in the header with the size of the metadata signatures and the metadata signatures stored right after the metadata. This patch parses the new payload format. BUG=b:22024447 TEST=cros payload show payload-v2.bin; served a payload v2 with devserver.py Change-Id: I8ce85af1df505f82f62a9d1cd57910cee6921f84 Reviewed-on: https://chromium-review.googlesource.com/306090 Commit-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org>
* paycheck: Update generated protobuf code.Alex Deymo2015-09-241-12/+26
| | | | | | | | | | | | | | This patch updates the generated update_metadata_pb2.py file with the latest changes in the udpate_metadata.proto file. BUG=None TEST=paycheck unittests Change-Id: Ibba40eb94535496654447c23895677cacb69f26b Reviewed-on: https://chromium-review.googlesource.com/302191 Commit-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org>
* update_payload: Regenerate protobuf with protoc 2.5Alex Deymo2015-09-151-80/+47
| | | | | | | | | | | | | | | | | | Goobuntu trusty uses protobuf 2.5.0 python modules, but the chroot uses version 2.6.1. Protobufs compiled with protoc 2.6.1 (inside the chroot) are not compatible with the python modules installed in trusty, so they can only run inside the chroot. Nevertheless, protobufs compiled with protoc 2.5.0 work with the new library version. BUG=chromium:531884 TEST=`./paycheck.py` inside and outside the chroot with libprotobuf 2.5.0 Change-Id: Ifeaf203a9c891156dd487249673a8264c74fd7e3 Reviewed-on: https://chromium-review.googlesource.com/299814 Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
* paycheck: Update generated protobuf code.Alex Deymo2015-09-144-136/+294
| | | | | | | | | | | | | | | | This patch updates the generated update_metadata_pb2.py file with the latest changes in the udpate_metadata.proto file. Some other changes in the update_payload library were required to match the changes in the .proto file. BUG=b:23179128 TEST=paycheck unittests Change-Id: I482d67d4a35f69438a26395eea77286994108b7a Reviewed-on: https://chromium-review.googlesource.com/299498 Commit-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org>
* paycheck: Small improvements to the block tracer utility.Gilad Arnold2015-07-221-10/+11
| | | | | | | | | | | | | | This prepends the current block number to the output, simplifies some logic, and tightens argument validation in the command-line parser. BUG=None TEST=paycheck -B/-b works. Change-Id: I90d5cdf721612cdd12e49f4e4181849fc699807f Reviewed-on: https://chromium-review.googlesource.com/286547 Tested-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org>
* paycheck: Fix printing of operation index while tracing.Gilad Arnold2015-07-171-3/+2
| | | | | | | | | | | | | | | | | | | | The block tracer is meant to scan operations in reverse order, to discover the latest operation that writes to a block. Strangely, it only reversed the operation indexes but scanned the actual operations in the original order, which is both incorrect in the general case, but even when it works the printed results are confusing (operations shown with the wrong index). This fixes it. Also some cosmetic changes to pacify the linter. BUG=chromium:510909 TEST=paycheck -B now prints the correct operation indexes. Change-Id: I65c44eeb450c229a2d5251737a0953716e124687 Reviewed-on: https://chromium-review.googlesource.com/286220 Commit-Queue: Gilad Arnold <garnold@chromium.org> Tested-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org>
* paycheck: Disambiguate hash error messages.Gilad Arnold2015-07-171-4/+4
| | | | | | | | | | | | | | | Before we've been emitting the exact same error message when failing to verify the hash of either pre- or post-update partition. This prefixes the partition name with "old" or "new", respectively. BUG=chromium:510909 TEST=None Change-Id: Icf302d0a3b26d3f9860c4ccb03dba38493296794 Reviewed-on: https://chromium-review.googlesource.com/286143 Tested-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org>
* paycheck: Properly infer usable target partition size.Gilad Arnold2015-07-172-19/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The payload checker used to restrict read/write block indexes to the reported target filesystem size, unless explicitly given a partition size value to use instead. So far this value was easy for clients (like paygen) to come up with, because it was constant at 2GB for all known boards. However this is no longer the case, and there is no an easy way for clients to know the actual target partition size after the payload has been generated (nor is it encoded in the payload). This adds logic for inferring the usable target partition size into PayloadChecker() itself, as follows: 1) If a partition size was given, use that. 2) Else, if this is an old delta (minor version < 2), use the aforementioned default. This is necessary because older deltas may actually read/write data beyond the filesystem size. It is also sufficient because any old delta payload we generate should write to a 2GB target partition. 3) In all other cases, just use the new filesystem size, as encoded in the payload. This is a safe choice for full updates and newer deltas. The command-line tool is updated accordingly. Note that the usable kernel partition size inference remains unaffected. BUG=chromium:508566 TEST=Unit tests (revised) Change-Id: I987f28fdfe1d82d0f6f565ae9852b7b11bce13e8 Reviewed-on: https://chromium-review.googlesource.com/285447 Reviewed-by: Gilad Arnold <garnold@chromium.org> Tested-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org>
* paycheck: Improve minor_version checking.Gilad Arnold2015-07-173-38/+50
| | | | | | | | | | | | | | | | | | | | 1) We explicitly catch whether this field is not set. This means we might fail payloads generated by an old delta_generator, but ensures that we catch such a failure in current payload generation. Test logic slightly restructured to reduce duplication. 2) Slight changes to the checker method signature, for better uniformity with the rest of the code. This also lets us test that we actually read the minor_version field. BUG=chromium:508566 TEST=Unit tests (revised) Change-Id: Ib2d1999964ba892ef778ffc16bd1ca1c7d02bcd5 Reviewed-on: https://chromium-review.googlesource.com/285446 Tested-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org>
* paycheck: Fix linter errors.Gilad Arnold2015-07-171-13/+0
| | | | | | | | | | | | | All whitespace related. BUG=None TEST=None Change-Id: I18694b7f3f86b3970de31fa0d366560234767632 Reviewed-on: https://chromium-review.googlesource.com/286142 Commit-Queue: Gilad Arnold <garnold@chromium.org> Tested-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org>
* Fix linter errors.Gilad Arnold2015-07-151-8/+6
| | | | | | | | | | | BUG=None TEST=None Change-Id: I65434c5e7d00006b89d71aadb5a4721ee16ff289 Reviewed-on: https://chromium-review.googlesource.com/285445 Tested-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Chris Sosa <sosa@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org>
* update_payload: Remove ctypes dependency.Alex Deymo2015-06-131-3/+1
| | | | | | | | | | | | | | | | | ctypes requires libffi.so to be installed in the system, but old test_images don't have it, preventing "cros flash" to work there. This patch removes the need for ctypes from common.py so cros flash can work. BUG=None TEST=cros flash from R29 on link. Change-Id: Idd0732660780081c26375a5214167b53f625e3ed Reviewed-on: https://chromium-review.googlesource.com/277070 Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>