summaryrefslogtreecommitdiffstats
path: root/install.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Skip logging the warning for uncrypt_status for devices w/o /cacheTianjie Xu2017-03-261-5/+9
| | | | | | | | | This warning may cause confusion for users. Bug: 36590598 Test: Warning line no longer shows for sailfish. Change-Id: I277c87a50a72fdb499be790ee25b97f815d980be (cherry picked from commit bcb5b18630f518835a0768535b43ccfe91683fc9)
* Merge "verify_file: Add constness to a few addresses."Tao Bao2017-03-211-1/+1
|\ | | | | | | | | | | am: 5b2bf90e13 Change-Id: I6e04bf2bc3dc8c978edafafcbb41401189865233
| * verify_file: Add constness to a few addresses.Tao Bao2017-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | We should not touch any data while verifying packages (or parsing the in-memory ASN.1 structures). Test: mmma bootable/recovery Test: recovery_component_test passes. Test: recovery_unit_test passes. Change-Id: Ie990662c6451ec066a1807b3081c9296afbdb0bf
* | resolve merge conflicts of 90d3f20c to stage-aosp-masterTao Bao2017-03-181-19/+21
|\| | | | | | | | | Test: I solemnly swear I tested this conflict resolution. Change-Id: I9c1806eceb56712c4b3d1c67d54f4b21bd3fe50a
| * Drop the dependency on 'ui' in verify_file().Tao Bao2017-03-171-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | verify_file() has a dependency on the global variable of 'ui' for posting the verification progress, which requires the users of libverifier to provide a UI instance. This CL adds an optional argument to verify_file() so that it can post the progress through the provided callback function. As a result, we can drop the MockUI class in verifier_test.cpp. Test: recovery_component_test passes. Test: verify_file() posts progress update when installing an OTA. Change-Id: I8b87d0f0d99777ea755d33d6dbbe2b6d44243bf1
* | Merge "Replace _exit(-1) with _exit(EXIT_FAILURE)." am: 95bcbfdd4eTao Bao2017-02-041-1/+1
|\| | | | | | | | | | | am: 80176c68b2 Change-Id: I6338fc4f929b0887563a0194719c887131538fec
| * Replace _exit(-1) with _exit(EXIT_FAILURE).Tao Bao2017-02-031-1/+1
| | | | | | | | | | | | | | | | | | -1 is not a valid exit status. Also replace a few exit(1) with exit(EXIT_FAILURE). Test: mmma bootable/recovery Change-Id: I4596c8328b770bf95acccc06a4401bd5cabd4bfd
* | Merge "Avoid to call UI functions in child process" am: 0f275ae56eTianjie Xu2017-02-031-1/+5
|\| | | | | | | | | | | am: 5fa2e576f9 Change-Id: I83d52f51ab6c788cc67a75ca6f7a46cd2f8289cd
| * Avoid to call UI functions in child processTianjie Xu2017-02-031-1/+5
| | | | | | | | | | | | | | | | | | | | | | ui_print uses a mutex to protect the critical section. And a forked child process may intialize the mutex inappropriatly, which leads to a hanging child process. So we shall avoid to call the UI functions in child process. Bug: 34769056 Test: fake ota on fugu failed as expected due to updater format mismatch. Change-Id: I81bc942a796878fac19cf712512092c2b0d807c9
* | Merge "Print with newline for ui_print." am: 90deaf9ab7Tao Bao2017-01-241-5/+1
|\| | | | | | | | | | | am: 1313a9636d Change-Id: I1cc5523b0ae213f5091caa6793c549e08dc148dc
| * Print with newline for ui_print.Tao Bao2017-01-221-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the ui_print command between the recovery and updater doesn't append newline. Updater has to send an extra "ui_print" command without any argument to get the line break. This looks unnecessary. And not all the callers (including the ones in bootable/recovery) are following this protocol when sending the ui_print command. This CL simplifies the protocol to always print with a newline for ui_print command. When updating from an old recovery with the new updater, all the ui_print'd strings would appear in one line as a side effect. But a) it would only affect the text-mode UI, which won't be shown to users; b) log files won't be affected. Bug: 32305035 Test: Apply an update with the new updater on top of an old and new recovery image respectively. Change-Id: I305a0ffc6f180daf60919cf99d24d1495d68749b
* | Merge "recovery: Move property_get() to android::base::GetProperty()." am: ebb4e96a71Tao Bao2017-01-141-68/+66
|\| | | | | | | | | | | am: 421d92707d Change-Id: I4f87ad321fba45f98f7adfd12937bf484025873e
| * recovery: Move property_get() to android::base::GetProperty().Tao Bao2017-01-131-68/+66
| | | | | | | | | | | | | | | | Test: Apply two A/B incremental OTAs with the new recovery image. The one with incorrect pre-build should be blocked, while the other works fine. Change-Id: I94d97eb8798599da1630f66343fb603e87464187
* | Merge "recovery: Clean up try_update_binary() in install.cpp." am: 095675a3ebTao Bao2017-01-061-145/+166
|\| | | | | | | | | | | am: 1bbd9c68af Change-Id: Ia502cd3e40fb02ed01e3e91fd0892f952083b1fa
| * recovery: Clean up try_update_binary() in install.cpp.Tao Bao2017-01-061-145/+166
| | | | | | | | | | | | | | | | | | | | | | Move functions over to android::base versions. - strtok(3) => android::base::Split() - strtol(3) => android::base::ParseInt() - strtof(3) => android::base::ParseDouble() Test: Build recovery image and apply a package that calls ui_print / progress / set_progress commands. Change-Id: I953b4985e0bd9e277362ae53e233d755cf27d80c
* | Merge "Remove the obsolete comments for firmware update." am: 833ecb03f2Tao Bao2016-12-141-9/+0
|\| | | | | | | | | | | am: 527f08ed0b Change-Id: I93716c3c455f118b0bac88d18c7c0e157031834b
| * Remove the obsolete comments for firmware update.Tao Bao2016-12-141-9/+0
| | | | | | | | | | | | | | | | The corresponding code was removed in commit e08991e02a7d678f2574e85289a34b2a9a537c82 in 2010 (Froyo). Test: N/A Change-Id: I2b296e1b07d54232bade79fda7501387d65a4c37
* | Merge "Revert "Revert "Some cleanups to recovery.""" am: a7a8262944Tao Bao2016-11-041-2/+0
|\| | | | | | | | | | | am: cb3cbaffac Change-Id: I2536156317b0bcb4a272ce13db251af791bd67be
| * Merge "Revert "Revert "Some cleanups to recovery."""Tao Bao2016-11-041-2/+0
| |\ | | | | | | | | | | | | | | | am: a7a8262944 Change-Id: Iab6de4788c4dbecd33d076144f8324fde53b4024
| | * Revert "Revert "Some cleanups to recovery.""Tao Bao2016-11-031-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8584fcf677dd45b30121bd0490b06297e6be1871. This CL re-lands commit c0319b60f56d445c2d1c74f551e01f069b028fe6. The "stage" and "reason" variables are now declared as global by dropping the static qualifier, because they may be used by vendor recovery libraries. Test: lunch aosp_angler-userdebug; mmma bootable/recovery Test: lunch aosp_dragon-userdebug; mmma bootable/recovery Change-Id: I252c346f450079478cff22bbff01590b8ab2e2b3
* | | Merge "Revert "Some cleanups to recovery."" am: 9514eb1934Dan Albert2016-10-271-0/+2
|\| | | | | | | | | | | | | | | | | am: 0c571e5923 Change-Id: I1a5b89905f24c2f20250a288345b6dbdea486cc1
| * | Merge "Revert "Some cleanups to recovery.""Dan Albert2016-10-271-0/+2
| |\| | | | | | | | | | | | | | | | am: 9514eb1934 Change-Id: Id96135ffde5adaebd45811b9c3d319a99fe28ecd
| | * Revert "Some cleanups to recovery."Dan Albert2016-10-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c0319b60f56d445c2d1c74f551e01f069b028fe6. Reason for revert: Broke builds. Change-Id: I82aa880b83de5ae6c36fd7567cb001920559a972
* | | Merge "Some cleanups to recovery." am: 46fb0a6a6fTao Bao2016-10-271-2/+0
|\| | | | | | | | | | | | | | | | | am: 00f893fe23 Change-Id: Iea4884c8ea12f8edfdd7e39e8ec6e4cfff26f3a5
| * | Merge "Some cleanups to recovery."Tao Bao2016-10-271-2/+0
| |\| | | | | | | | | | | | | | | | am: 46fb0a6a6f Change-Id: Ic247a408b1bd3e2eab1db34eb4b14423d9fd16d6
| | * Some cleanups to recovery.Tao Bao2016-10-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove the duplicate gCurrentUI variable in recovery.cpp; - Refactor the load/save of locale functions; - Clean up ui_print() to get rid of 256-byte buffer limit; - Declare ui in common.h; - Move the typedef of Volume into roots.h. Test: Build and boot into recovery image. Change-Id: Ia28c116858ca754133127a5ff9c722af67ad55b7
| | * Verify wipe package when wiping A/B device in recovery.Yabin Cui2016-10-191-25/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To increase the security of wiping A/B devices, let uncrypt write wipe package in misc partition. Then recovery verifies the wipe package before wiping the device. Based on the original cherrypick, this CL also has additional changes to address the LOG statements and libziparchive changes. Bug: 29159185 Test: Build and boot into recovery. Change-Id: I186691bab1928d3dc036bc5542abd64a81bc2168 (cherry picked from commit 6faf0265c9b58db2c15b53f6d29025629d52f882)
* | | resolve merge conflicts of 6fba98c to stage-aosp-masterTianjie Xu2016-10-191-36/+43
|\| | | | | | | | | | | | | | | | | am: 8176cf232e Change-Id: I01b34cb31604ea5caffe96ad69ab4d4d21bfe28e
| * | resolve merge conflicts of 6fba98c to stage-aosp-masterTianjie Xu2016-10-181-36/+43
| |\| | | | | | | | | | Change-Id: I2fa8b85109309ec88c1f8d8def593aa65ab885d7
| | * Replace minzip with libziparchiveTianjie Xu2016-10-181-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up the duplicated codes that handle the zip files in bootable/recovery; and rename the library of the remaining utility functions to libotautil. Test: Update package installed successfully on angler. Bug: 19472796 Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
| | * Fix the prefix matching for uncrypt status.Tao Bao2016-10-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also change its logging statement from PLOG to LOG, since android::base::StartsWith() doesn't set errno. Test: Build and reboot into recovery image. Check last_log. Change-Id: I55ac7eec24228db76a13580958b4a4330b06cf57
* | | Fix the prefix matching for uncrypt status.Tao Bao2016-10-141-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | Also change its logging statement from PLOG to LOG, since android::base::StartsWith() doesn't set errno. Test: Build and reboot into recovery image. Check last_log. Change-Id: I55ac7eec24228db76a13580958b4a4330b06cf57 (cherry picked from commit ee9b95544a7af548e98f2b7a080e2eb7abaaf981) (cherry picked from commit e30a5b3a44c6c2134750e28a88efd5876a28bfac)
* | Report uncrypt errors in detailsTianjie Xu2016-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | Add the error codes for uncrypt and report the failure details in uncrypt_status. Test: uncrypt_error logs correctly in last_install Bug: 31603820 Change-Id: I8e0de845ce1707b6f8f5ae84564c5e93fd5f5ef5 (cherry picked from commit 0c68675f5ae80cd669e0bf014a69689b6fe08eee)
* | Merge "Report uncrypt errors in details" am: af8b9363c6 am: 7582609d61Tianjie Xu2016-09-271-1/+1
|\| | | | | | | | | | | am: fc887a8fba Change-Id: I5e83be10f4443c8b107821975b3506381fcbdf0c
| * Report uncrypt errors in detailsTianjie Xu2016-09-271-1/+1
| | | | | | | | | | | | | | | | | | Add the error codes for uncrypt and report the failure details in uncrypt_status. Test: uncrypt_error logs correctly in last_install Bug: 31603820 Change-Id: I8e0de845ce1707b6f8f5ae84564c5e93fd5f5ef5
| * Duplicate the last_install content into last_log.Tao Bao2016-09-261-30/+30
| | | | | | | | | | | | | | | | | | | | | | Currently we save the OTA metrics in last_install, which keeps the data for the _last_ install only. This CL logs the same content into last_log so that we keep the metrics for every install. Bug: 31607469 Test: Apply an update (via OTA and sideload) and check last_log and last_install. Change-Id: Id8f174d79534fddc9f06d72a4e69b2b1d8ab186c
* | Duplicate the last_install content into last_log.Tao Bao2016-09-261-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | Currently we save the OTA metrics in last_install, which keeps the data for the _last_ install only. This CL logs the same content into last_log so that we keep the metrics for every install. Bug: 31607469 Test: Apply an update (via OTA and sideload) and check last_log and last_install. Change-Id: Id8f174d79534fddc9f06d72a4e69b2b1d8ab186c (cherry picked from commit f4885adc189f246ac3c651aa5cb2e74a240f3f1e)
* | Fail gracefully when we fail to fork the update binaryMatthew Bouyack2016-09-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | This change was original made in cw-f-dev but caused failures in nyc-mr1-dev-plus-aosp due to lack of support for 'LOGE' This version of the change uses the new 'LOG(ERROR)' style logging instead. See bug b/31395655 Test: attempt a memory intensive incremental OTA on a low-memory device Change-Id: Ia87d989a66b0ce3f48e862abf9b9d6943f70e554
* | Revert "DO NOT MERGE Fail gracefully when we fail to fork the update binary am: de1b53d067"Matthew Bouyack2016-09-211-8/+0
| | | | | | | | | | | | This reverts commit 78563fdf78861884f300a6a874d2a0306f1eb002. Change-Id: I1ea4956a9843130aa41f2f7bc011c72e64fd7b62
* | DO NOT MERGE Fail gracefully when we fail to fork the update binaryMatthew Bouyack2016-09-201-0/+8
|\ \ | | | | | | | | | | | | | | | am: de1b53d067 Change-Id: Ic7a42220ed7e842dad1d5d2aacdd12253bd5ad84
| * | DO NOT MERGE Fail gracefully when we fail to fork the update binaryMatthew Bouyack2016-09-201-0/+8
| | | | | | | | | | | | | | | | | | See bug b/31395655 Change-Id: Ic5a046bc80ea88d7eb52755838bdbf4e1e47da50
| * | Check corruption when reading uncrypt_status fileTianjie Xu2016-09-131-0/+2
| | | | | | | | | | | | | | | | | | Bug: 31383361 Change-Id: I0de920916da213528d73b742e4823b4a98c63ea1 (cherry picked from commit 1c1864f321b129c81883ed527b1da8c69661e51f)
* | | Merge "Check corruption when reading uncrypt_status file" am: 3cf815a6a9 am: 40bae5e1c6Tianjie Xu2016-09-141-0/+2
|\ \ \ | | |/ | |/| | | | | | | | | | am: 1d55666106 Change-Id: I2081d6803377a7bf26175a55b3b5defb7c9d09d1
| * | Check corruption when reading uncrypt_status fileTianjie Xu2016-09-131-0/+2
| | | | | | | | | | | | | | | Bug: 31383361 Change-Id: I0de920916da213528d73b742e4823b4a98c63ea1
| * | save uncrypt status to last_installTianjie Xu2016-09-131-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Save the uncrypt time cost to /cache/recovery/uncrypt_status. Recovery reads the file and saves its contents to last_install. Bug: 31383361 Test: Tested on angler and uncrypt_time reports correctly. Change-Id: I5cd3f7b6ca069d69086d09acfea8fc4f1215c833 Merged-In: I5cd3f7b6ca069d69086d09acfea8fc4f1215c833
| * | Switch recovery to libbase loggingTianjie Xu2016-09-011-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | Clean up the recovery image and switch to libbase logging. Bug: 28191554 Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35 Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
* | | save uncrypt status to last_install am: e16e799dfdTianjie Xu2016-09-131-0/+13
|\ \ \ | | |/ | |/| | | | | | | | | | am: 4769f209dc Change-Id: Ic9056d4af518df3747743ec6b2886fa437029395
| * | save uncrypt status to last_installTianjie Xu2016-09-131-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Save the uncrypt time cost to /cache/recovery/uncrypt_status. Recovery reads the file and saves its contents to last_install. Bug: 31383361 Test: Tested on angler and uncrypt_time reports correctly. (cherry picked from commit fe16b5ccaf80f6e04d5b722c37c1abd70457ad28) Change-Id: Id69681a35c7eb2f0eb21b48e3616dcda82ce41b8
| * | Add inttypes.h for PRIu64.Alex Deymo2016-08-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This missing header is needed to use PRIu64 macros. Bug: 27178350 TEST=`mma bootable/recovery` on the failing branch. Change-Id: I165701e8019256426d3f6a4168db52c6a0197c4d
* | | Fix a typo of variable name in install.cppTianjie Xu2016-09-021-6/+6
| | | | | | | | | | | | Change-Id: I42057bc2fb5096ce009fe6e4b787bc9082cd572f
* | | Switch recovery to libbase loggingTianjie Xu2016-09-011-33/+30
| | | | | | | | | | | | | | | | | | | | | | | | Clean up the recovery image and switch to libbase logging. Bug: 28191554 Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35 (cherry picked from commit 747781433fb01f745529c7e9dd97c5599070ad0d)
* | | Merge "Fix clang-tidy warnings in bootable/recovery." am: 89bf2bdc85 am: 9968866e86Chih-Hung Hsieh2016-08-271-2/+2
|\ \ \ | | |/ | |/| | | | | | | | | | am: d987fe1d57 Change-Id: Idd53009ad61bb4a0b573febdbedc5dc0eee8265f
| * | Fix clang-tidy warnings in bootable/recovery.Chih-Hung Hsieh2016-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use const reference type for read-only parameters. Bug: 30407689 * Use faster overloaded string find function. Bug: 30411878 * Add parentheses around macro parameters. Bug: 28705665 Test: build with WITH_TIDY=1 Change-Id: I4e8e5748bfa4ae89871f1fb5fa4624d372530d75
| * | Merge "Free mmaped area if keys fail to load"Tao Bao2016-08-181-0/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | am: f599414aec Change-Id: Id96153c211ca1fcc1cd78d6e662b0b48795c0d76
| | * | Free mmaped area if keys fail to loadWiZarD2016-08-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keys for package verification is loaded after the update package is mmaped into memory. This mmaped area needs to be freed when exiting the function. Another approach would be to mmap after loading the keys. Change-Id: Ib77711a8acd5c363b5517da12dc311fb8f9f4605 Signed-off-by: WiZarD <WiZarD.Devel@gmail.com>
* | | | Add inttypes.h for PRIu64.Alex Deymo2016-08-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This missing header is needed to use PRIu64 macros. Bug: 27178350 TEST=`mma bootable/recovery` on the failing branch. Change-Id: I165701e8019256426d3f6a4168db52c6a0197c4d
* | | | resolve merge conflicts of 66940b9 to nyc-mr1-dev-plus-aospAlex Deymo2016-08-121-18/+181
|\ \ \ \ | | |_|/ | |/| | | | | | Change-Id: Icd879395a88ff1de0fcf0c754c0633d8fb6cf208
| * | | Call update_engine_sideload from recovery.Alex Deymo2016-08-121-18/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables sideloading an OTA on A/B devices while running from recovery. Recovery accepts the same OTA package format as recent versions of GMS, which consists of .zip file with the payload in it. Bug: 27178350 TEST=`adb sideload` successfully a full OTA (*) TEST=Failed to take several invalid payloads (wrong product, fingerprint, update type, serial, etc). <small>(*) with no postinstall script.</small> Change-Id: I951869340100feb5a37e41fac0ee59c10095659e
* | | | resolve merge conflicts of ed4c49c to nyc-mr1-dev-plus-aospYabin Cui2016-06-211-23/+37
|\| | | | |/ / |/| | | | | Change-Id: I8788cc80473dc77bfa0cd2682f3acb6e17ac36df
| * | Verify wipe package when wiping A/B device in recovery.Yabin Cui2016-06-211-23/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To increase the security of wiping A/B devices, let uncrypt write wipe package in misc partition. Then recovery verifies the wipe package before wiping the device. Bug: 29159185 Change-Id: I186691bab1928d3dc036bc5542abd64a81bc2168
* | | resolve merge conflicts of 179c0d8 to stage-aosp-masterElliott Hughes2016-06-161-2/+0
|\ \ \ | | |/ | |/| | | | Change-Id: Iba5aec266444cabf83f600f2bdb45a3c027e5995
| * | Remove obsolete MTD support.Elliott Hughes2016-06-101-2/+0
| | | | | | | | | | | | | | | Bug: http://b/29250988 Change-Id: Ia97ba9082a165c37f74d6e1c3f71a367adc59945
* | | Log source/target build version to last_installTianjie Xu2016-06-101-0/+55
|\ \ \ | | |/ | |/| | | | | | | | | | am: b0ddae55e5 Change-Id: Ifd9e006588de8bea233a4e90a5c80ed6b894054a
| * | Log source/target build version to last_installTianjie Xu2016-06-101-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parse the build.version.incremental from the metadata of the update package; and log it to last_install. Example: In metadata we read: post-build-incremental=2951741 pre-build-incremental=2943039 In last install we log: source_build: 2943039 target_build: 2951741 Bug: 28658632 Change-Id: I0a9cc2d01644846e18bda31f4193ff40e8924486
* | | resolve merge conflicts of 7ce287d to nyc-dev-plus-aospTianjie Xu2016-06-041-6/+13
|\| | | | | | | | | | | Change-Id: I2194d1170281f58eb508f2ef63b39c8729125f76
| * | Call ioctl before each write on retryTianjie Xu2016-06-031-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | If the update is a retry, ioctl(BLKDISCARD) the destination blocks before writing to these blocks. Bug: 28990135 Change-Id: I1e703808e68ebb1292cd66afd76be8fd6946ee59
* | | resolve merge conflicts of 50f6417 to nyc-dev-plus-aospTianjie Xu2016-05-231-2/+11
|\| | | | | | | | | | | Change-Id: I42c127f7946e678acf6596f6352f090abc0ca019
| * | Allow recovery to return error codesTianjie Xu2016-05-201-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Write error code, cause code, and retry count into last_install. So we can have more information about the reason of a failed OTA. Example of new last_install: @/cache/recovery/block.map package name 0 install result retry: 1 retry count (new) error: 30 error code (new) cause: 12 error cause (new) Details in: go/android-ota-errorcode Bug: 28471955 Change-Id: I00e7153c821e7355c1be81a86c7f228108f3dc37
* | | Add time and I/O info to last_installTianjie Xu2016-05-181-4/+23
|\| | | | | | | | | | | | | | | | | | | | | | | | | | am: dd874b1c87 * commit 'dd874b1c87eb04f28db0db2629df0adde568a74c': Add time and I/O info to last_install Change-Id: I02aa858d5ce488d3acbf5400811e2565cf7d9c75
| * | Add time and I/O info to last_installTianjie Xu2016-05-161-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One example of last_install is: /sideload/package.zip 1 time_total: 101 bytes_written_system: 14574000 bytes_stashed_system: 100 bytes_written_vendor: 5107400 bytes_stashed_vendor: 0 Bug: 28658632 Change-Id: I4bf79ea71a609068d38fbce6b41bcb892524aa7a
* | | resolve merge conflicts of 8febafa to nyc-dev-plus-aospElliott Hughes2016-04-141-6/+8
|\| | | |/ |/| | | Change-Id: I423937b4b20a2079714aa38ab7f8b199782df689
| * Use BoringSSL instead of mincrypt to speed up package verification.Elliott Hughes2016-04-141-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | This changes the verification code in bootable/recovery to use BoringSSL instead of mincrypt. Cherry-pick of 452df6d99c81c4eeee3d2c7b2171901e8b7bc54a, with merge conflict resolution, extra logging in verifier.cpp, and an increase in the hash chunk size from 4KiB to 1MiB. Bug: http://b/28135231 Change-Id: I1ed7efd52223dd6f6a4629cad187cbc383d5aa84
| * Reboot and retry on I/O errorsTianjie Xu2016-03-101-0/+6
| | | | | | | | | | | | | | | | | | When I/O error happens, reboot and retry installation two times before we abort this OTA update. Bug: 25633753 Change-Id: Iba6d4203a343a725aa625a41d237606980d62f69 (cherry picked from commit 3c62b67faf8a25f1dd1c44dc19759c3997fdfd36)
* | Convert recovery to use BoringSSL instead of mincrypt.Mattias Nissler2016-04-061-2/+1
| | | | | | | | | | | | | | This changes the verification code in bootable/recovery to use BoringSSL instead of mincrypt. Change-Id: I37b37d84b22e81c32ac180cd1240c02150ddf3a7
* | Reboot and retry on I/O errorsTianjie Xu2016-03-031-0/+6
| | | | | | | | | | | | | | | | When I/O error happens, reboot and retry installation two times before we abort this OTA update. Bug: 25633753 Change-Id: Iba6d4203a343a725aa625a41d237606980d62f69
* | Fix some memory leaks.Yabin Cui2016-02-111-5/+5
|/ | | | | Bug: 26906328 Change-Id: Iebaf03db0cb3054f91715f8c849be6087d01b27b
* recovery: Refactor verifier and verifier_test.Tao Bao2016-02-031-7/+6
| | | | | | | | Move to using std::vector and std::unique_ptr to manage key certificates to stop memory leaks. Bug: 26908001 Change-Id: Ia5f799bc8dcc036a0ffae5eaa8d9f6e09abd031c
* Log update outputs in orderTao Bao2015-06-031-2/+2
| | | | | | | | | | | | | | Although stdout and stderr are both redirected to log file with no buffering, we are seeing some outputs are mixed in random order. This is because ui_print commands from the updater are passed to the recovery binary via a pipe, which may interleave with other outputs that go to stderr directly. In recovery, adding ui::PrintOnScreenOnly() function to handle ui_print command, which skips printing to stdout. Meanwhile, updater prints the contents to stderr in addition to piping them to recovery. Change-Id: Idda93ea940d2e23a0276bb8ead4aa70a3cb97700
* Update the comments for package installer commandsTao Bao2015-04-111-1/+13
| | | | | | | | These commands are for the communication between the installer and the update binary (edify interpreter). Update the comments in sync with the codes. Change-Id: I7390f022b1447049a974b0b45697ef1d2e71d4e0
* Rotate logs only when there are actual operationsTao Bao2015-04-081-0/+2
| | | | | | | | | | Currently it rotates the log files every time it boots into the recovery mode. We lose useful logs after ten times. This CL changes the rotation condition so that it will rotate only if it performs some actual operations that modify the flash (installs, wipes, sideloads and etc). Bug: 19695622 Change-Id: Ie708ad955ef31aa500b6590c65faa72391705940
* Factor out option variables from int to bool typesTao Bao2015-03-251-5/+5
| | | | Change-Id: Ia897aa43e44d115bde6de91789b35723826ace22
* Add missing includes.Elliott Hughes2015-01-281-0/+1
| | | | Change-Id: I0737456e0221ebe9cc854d65c95a7d37d0869d56
* sideload without holding the whole package in RAMDoug Zongker2014-07-021-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a new method of sideloading over ADB that does not require the entire package to be held in RAM (useful for low-RAM devices and devices using block OTA where we'd rather have more RAM available for binary patching). We communicate with the host using a new adb service called "sideload-host", which makes the host act as a server, sending us different parts of the package file on request. We create a FUSE filesystem that creates a virtual file "/sideload/package.zip" that is backed by the ADB connection -- users see a normal file, but when they read from the file we're actually fetching the data from the adb host. This file is then passed to the verification and installation systems like any other. To prevent a malicious adb host implementation from serving different data to the verification and installation phases of sideloading, the FUSE filesystem verifies that the contents of the file don't change between reads -- every time we fetch a block from the host we compare its hash to the previous hash for that block (if it was read before) and cause the read to fail if it changes. One necessary change is that the minadbd started by recovery in sideload mode no longer drops its root privileges (they're needed to mount the FUSE filesystem). We rely on SELinux enforcement to restrict the set of things that can be accessed. Change-Id: Ida7dbd3b04c1d4e27a2779d88c1da0c7c81fb114
* disable async reboot during package installationDoug Zongker2014-05-231-0/+7
| | | | | | | | | | The default recovery UI will reboot the device when the power key is pressed 7 times in a row, regardless of what recovery is doing. Disable this feature during package installation, to minimize the chance of corrupting the device due to a mid-install reboot. (Debug packages can explicitly request that the feature be reenabled.) Change-Id: I20f3ec240ecd344615d452005ff26d8dd7775acf
* do verification and extraction on memory, not filesDoug Zongker2014-01-161-7/+23
| | | | | | | | | | | | | | | | Changes minzip and recovery's file signature verification to work on memory regions, rather than files. For packages which are regular files, install.cpp now mmap()s them into memory and then passes the mapped memory to the verifier and to the minzip library. Support for files which are raw block maps (which will be used when we have packages written to encrypted data partitions) is present but largely untested so far. Bug: 12188746 Change-Id: I12cc3e809834745a489dd9d4ceb558cbccdc3f71
* Restore default umask after forking for update-binary.Alistair Strachan2013-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | A system/core change made in Mar 26 2012 6ebf12f "init: Change umask of forked processes to 077" changed the default umask of services forked from init. Because recovery is forked from init, it has a umask of 077. Therefore when update-binary is forked from recovery, it too has a umask of 077. This umask is overly restrictive and can cause problems for scripts relying on minzip to extract binaries directly into the target filesystem. Any directories updated by minzip will have their permissions reset to r-x------ and created files will have similarly restrictive permissions. As it seems unlikely this security measure was intended to have this side effect on legacy sideloads that do not have chmods to repair the damage done by minzip, this change reverts the umask to 022 in the fork made for update-binary. Change-Id: Ib1a3fc83aa4ecc7480b5d0c00f3c7d0d040d4887
* recovery: install packages in a known mount environmentDoug Zongker2013-08-211-5/+10
| | | | | | | | | | | When installing a package, we should have /tmp and /cache mounted and nothing else. Ensure this is true by explicitly mounting them and unmounting everything else as the first step of every install. Also fix an error in the progress bar that crops up when you do multiple package installs in one instance of recovery. Change-Id: I4837ed707cb419ddd3d9f6188b6355ba1bcfe2b2
* recovery: move log output to stdoutDoug Zongker2013-07-091-0/+1
| | | | | | | | Recovery currently has a random mix of messages printed to stdout and messages printed to stderr, which can make logs hard to read. Move everything to stdout. Change-Id: Ie33bd4a9e1272e731302569cdec918e0534c48a6
* verifier: update to support certificates using SHA-256Doug Zongker2013-04-101-1/+1
| | | | Change-Id: Ifd5a29d459acf101311fa1c220f728c3d0ac2e4e
* move key loading to verifier codeDoug Zongker2012-11-021-100/+0
| | | | | | | Add an option to verifier_test to load keys from a file, the way the recovery does. Change-Id: Icba0e391164f2c1a9fefeab4b0bcb878e91d17b4
* add simple text to recovery UIDoug Zongker2012-08-231-1/+1
| | | | | | | | | | | | | | | - recovery takes a --locale argument, which will be passed by the main system - the locale is saved in cache, in case the --locale argument is missing (eg, when recovery is started from fastboot) - we include images that have prerendered text for many locales - we split the background states into four (installing update, erasing, no command, error) so that appropriate text can be shown. Change-Id: I731b8108e83d5ccc09a4aacfc1dbf7e86b397aaf
* support version 2 (2048-bit e=65537) keys in recoveryDoug Zongker2012-07-251-1/+25
| | | | Change-Id: I9849c69777d513bb12926c8c622d1c12d2da568a
* minor recovery changesDoug Zongker2012-04-121-0/+2
| | | | | | | | | | | | - add the --just_exit option to make recovery exit normally without doing anything - make it possible to build updater extensions in C++ - add the clear_display command so that the updater binary can request recovery switch to the NONE background UI These are all used to support the notion of using OTA as a factory reflash mechanism. Change-Id: Ib00d1cbf540feff38f52a61a2cf198915b48488c
* refactor ui functions into a classDoug Zongker2011-10-291-14/+20
| | | | | | | | | | | Move all the functions in ui.c to be members of a ScreenRecoveryUI class, which is a subclass of an abstract RecoveryUI class. Recovery then creates a global singleton instance of this class and then invoke the methods to drive the UI. We use this to allow substitution of a different RecoveryUI implementation for devices with radically different form factors (eg, that don't have a screen). Change-Id: I7fd8b2949d0db5a3f47c52978bca183966c86f33
* turn recovery into a C++ binaryDoug Zongker2011-10-281-0/+314
Change-Id: I68a67a4c8edec9a74463b3d4766005ce27b51316