summaryrefslogtreecommitdiff
path: root/scripts/update_device.py
AgeCommit message (Collapse)Author
2021-04-19Update shebang line for update_device.py.Yifan Hong
It is no longer python2 compatible. Test: pass Change-Id: Ibb0b7aa33ba1be3e2f40893da70f81c858479f7e
2021-04-15Rename no-care-map flagKelvin Zhang
Since other flags use - instead of _, keep no-care-map flag consistent Test: th Change-Id: Ibf981ecbf7b3804e20c52ef1de8f55732cbe6295
2021-04-15Add 5s timeout to cleanup commandsKelvin Zhang
Sometimes shutdown takes a while due to adb issues, gracefully terminate with a timeout. This will throw an exception if timeout occured, telling the developer that something went wrong. Test: python3 update_device.py ota.zip Change-Id: I44edc6a291fc682b9439ab97f2880d47dc4e457b
2021-04-01Add no postinstall optionKelvin Zhang
Test: th Change-Id: I63904fae1a6900a6fd7a079667332102f2bede55
2021-03-08Add a --verify_only flag, which verifies the payloadKelvin Zhang
Test: update_device.py --verify_only some_ota.zip Change-Id: I4d07dfe138064fd8747699a92b98a17090533179
2021-03-05Fix python3 compatibility issuesKelvin Zhang
Python3 expects write() to accept bytes or str, depending on file type(w or wb). Since zipfile returns bytes, we must open output file with "wb", which is the default. Test: python3 update_device.py some_ota.zip Change-Id: I9f163341921d7681988ee1eb01e98f0ecd5e98c9
2021-03-04Push care_map.pb to device when serving an OTAKelvin Zhang
When rebooting, device will skip update_verifier if care_map.pb isn't found. For better testing, push care_map.pb to device by default Test: python2 update_device.py some_ota.zip Bug: 181499957 Change-Id: Ic47735be7dd7b1c1541613a88cab69ef57394b5a
2021-02-20Add option to invoke AllocateSpaceForPayload from update_device.pyKelvin Zhang
Now AllocateSpaceForPayload() API does non-trivial work, it would be nice if we have an easy way to invoke it from CLI for testing purposes. Test: update_device.py --allocate ota.zip Change-Id: I497fea33e8935a5481d7d831d35dac881e42262e
2020-12-02Fix English typo in update_device.pyKelvin Zhang
Test: treehugger Change-Id: I748be77b7d8fe4bbc63f1edc672e5c32be6e8c91
2020-11-17Add no_slot_switch flag to update_device scriptKelvin Zhang
Test: treehugger Change-Id: I996e8ece01d5a68e9093460f24c84031f8419c53
2020-10-08Make update_device.py script compatible with python3Kelvin Zhang
Test: serve an OTA Change-Id: I2e787db375b8dd4b24bc51dff6fef1002c4b4c5e
2020-08-06Improve payload magic header handlingKelvin Zhang
Currently, we use central directory's extra fields and filenames to determine starting position of a zipentry's file data. However, central directory's extra field might differ from extra field in local file header. For example, the Extended-Timestamp field has different formats depending on whether it's in local file header or central directory. We should use local file header for computing offsets. Test: Serve an OTA by update_device.py Change-Id: I00d150d874b9c874bb713569ea14938e036f854e
2020-07-06Merge remote-tracking branch 'aosp/upstream-master' into mergeTianjie
It's a merge from chrome OS with some reverts. 1. the fd watcher change, because the libbrillo version isn't compatible in aosp. commit 6955bcc4ffe4cc9d62a88186b9a7e75d095a7897 commit 493fecb3f48c8478fd3ef244d631d857730dd14d 2. two libcurl unittest. Because the RunOnce() of the fake message loop seems to have different behavior in aosp. commit d3d84218cafbc1a95e7d6bbb775b495d1bebf4d2 Put preprocessor guards to use the old code in aosp. And we can switch to the new code in the other path after adopting the new libbrillo & libchrome. Test: unit tests pass, apply an OTA Change-Id: Id613599834b0f44f92841dbeae6303601db5490d
2019-11-19update_payload: Port scripts to python3Andrew Lassalle
Update the update_payload scripts to be compatible with python2 and python3. Python2 compatibility is needed since the repo is shared with Android. BUG=chromium:1011631 TEST=Executed aosp/system/update_engine/scripts/run_unittests and cros_generate_update_payload Cq-Depend: chromium:1904837, chromium:1911499 Change-Id: Ie450b80b5f7550051b38d320173ccc0c915f65e7 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1904310 Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org> Tested-by: Andrew Lassalle <andrewlassalle@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Auto-Submit: Andrew Lassalle <andrewlassalle@chromium.org>
2019-11-02Allow update_device install the secondary payloadTianjie Xu
Add an option to support installation of the secondary payload. This is used to verify an android factory OTA, where it has one step to install the secondary payload. The payload and its property file store under the secondary/ directory of the update package. Test: install a secondary payload from a factory OTA package Change-Id: I1d2e1d6945f1daa9afaab6af8ce9aad0f7c2100f
2018-08-21A/B update: Replace the zip FileHeader mechanism for update packageShashikant Baviskar
When the update package gets larger than 2 GiB, payload.bin offset mentioned in metadata file for ota-streaming-property-files gets shifted (CrAU of payload.bin) because ZipInfo FileHeader() returns incorrect value. To solve the issue, offset is re-calculated from fixed bytes of central directory file header, filename length and extra length. Test: manually create an A/B update package and run it using update_device.py Bug: 111198589 Change-Id: Iadb2e8bbff478d9b006bb155d57fea35968d84b7
2017-10-31update_device.py: support passing extra headers.Sen Jiang
Test: update_device.py --extra-headers 'SWITCH_SLOT_ON_REBOOT=0' ... Change-Id: I5902153329243e6dc55d767d87bc974f206d32e0
2017-10-25update_device.py: Handle the package push without 'adb root'.Tao Bao
When using '--file' (and without '--no-push'), it tries to push the package to /data/ota_package/debug.zip. However, that's not allowed directly with 'adb push', unless by restarting adb with 'adb root'. This CL works around the issue by pushing the file to /data/local/tmp first, then moving it over to the desired place. Test: update_device.py --file <marlin-ota.zip> Change-Id: I608284cc90918fc01cf7584569d4d7d4165148ca
2017-10-21Defaults update_device to use only compatible python versionsmarkdr
update_device imports BaseHTTPServer, which is python2 only. If python3 is the default python, an import error will be thrown. Test: Set default python to 3.4. Call update_device.py Change-Id: Id053e695c334c597736b9844e11be389264700ea
2017-09-30update_device.py: support OTA zip if use omaha too.Sen Jiang
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
2017-09-30update_device.py: use the appid from request.Sen Jiang
Recent changes in update_engine are now comparing the appid against the product id. Test: applied a local OTA Change-Id: I2907e94a89bea5ebfa8236c96eec7601af8ad4e5
2017-08-16Add support for omaha in update_device.pySen Jiang
Automatically detect if the device is running an update_engine with USE_OMAHA or not, and use different command based on that. Made the http server serving payload a fake omaha server as well. Added support for overriding the payload public key on the device. Bug: 27316596 Test: update a device that uses omaha Change-Id: I230d58ff105189dc8a624d46ee79cbe90c5f09b0
2017-08-16Fix pylint warnings in update_device.pySen Jiang
We weren't actually using our own pylintrc file in repo upload hook, which will be fixed by https://android-review.googlesource.com/#/c/platform/tools/repohooks/+/458996/ Even though both camel case and snake case are allowed for function and method names, they still have to be consistent in a single file. https://pylint.readthedocs.io/en/latest/user_guide/options.html#multiple-naming-styles Bug: 27316596 Test: repo upload Change-Id: I98adba957a547115ef3d8b00fe2e3e4931707b31
2017-03-21scripts: New script to update a device connected via adbAlex Deymo
This new script allows to execute the update flow on an Android device connected via adb to the host. At the moment, it supports both providing the payload over the network with an "adb reverse" connection and to push the payload to a file on the device. Bug: 35903885 Test: system/update_engine/scripts/update_device.py ota.zip Change-Id: I1c6d4df97ce85b6e30367a53b351353a954efbdc