aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert "Move error_code.h into otautil.""Tao Bao2017-10-091-1/+1
| | | | | | | | | | | | | | | | This reverts commit 26436d6d6010d5323349af7e119ff8f34f85c40c to re-land "Move error_code.h into otautil.". This way it stops requiring relative path ".." in LOCAL_C_INCLUDES (uncrypt and edify). Soong doesn't accept non-local ".." in "local_include_dirs". This CL needs to land with device-specific module changes (e.g. adding the dependency on libotautil). Test: lunch aosp_{angler,bullhead,dragon,fugu,sailfish}-userdebug; mmma bootable/recovery Change-Id: If193241801af2dae73eccd31ce57cd2b81c9fd96
* Revert "Move error_code.h into otautil."Tao Bao2017-10-051-1/+1
| | | | | | | | This reverts commit 623fe7e701d5d0fb17082d1ced14498af1b44e5b. Reason for revert: Need to address device-specific modules. Change-Id: Ib7a4191e7f193dfff49b02d3de76dda856800251
* Move error_code.h into otautil.Tao Bao2017-10-041-1/+1
| | | | | | | | | This way it stops requiring relative path ".." in LOCAL_C_INCLUDES (uncrypt and edify). Soong doesn't accept non-local ".." in "local_include_dirs". Test: mmma bootable/recovery Change-Id: Ia4649789cef2aaeb2785483660e9ea5a8b389c62
* roots: Fix an issue with volume_for_path().Tao Bao2017-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The earlier commit in 2dfc1a38982c4052bb32bc7fc06edeadf3908fb9 unintentionally changed the behavior. It gives a different result when looking up non-existent mount points (e.g. /cache on marlin). The logic behind volume_for_path("/xyz") is unclear: - It's fine to return non-null value if it's called by ensure_path_mounted() before accessing that file "/xyz". (Just based on the function name, we're not actually having this case.) - It should return nullptr if the caller is interested in the existence of that particular mount point "/xyz". This CL renames the function to volume_for_mount_point(), which does an exact match by querying the given mount point from libfs_mgr. The former volume_for_path() has been moved down to function scope for serving ensure_path_mounted() only. Test: Build and boot into recovery on bullhead and marlin respectively. 'View recovery logs'. Test: 'Mount /system' Test: 'Apply update from ADB' Change-Id: I1a16390f57540cae08a2b8f3d439d17886975217
* Remove EXPAND/STRINGIFY macros.Tao Bao2017-09-131-1/+1
| | | | | | | | | | | | | | | | | | | This reverts commit 8be0f39fec7f26164fd0791ff6d15bde65fc849c to reland the change that removes EXPAND/STRINGIFY macros. It's error-prone by putting anything into a string (e.g. EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we forgot to pass -DRECOVERY_API_VERSION=3). The initial attempt put RECOVERY_API_VERSION into common.h, which might be included by device-specific codes but without defining that when compiling the module. This CL avoids the issue by using a constant in the header, with a static_assert in recovery.cpp that guards the consistency. Test: recovery_component_test Test: Sideload OTAs on bullhead and sailfish respectively. Change-Id: I12af3f73392a85554ba703f04970ec9d984ccbaa
* Merge "Add missing report of error code under recovery"Tianjie Xu2017-08-241-0/+3
|\
| * Add missing report of error code under recoveryTianjie Xu2017-08-231-0/+3
| | | | | | | | | | | | | | | | Add report of kMapFileFailure, kForkUpdateBinaryFailure and kUpdateBinaryCommandFailure. Test: unit test pass; kMapFileFailure reports correctly. Change-Id: I858c81b6c750b5e300b1b12760b1f0fa8e23b47d
* | Allow comparison against multi serial nums for A/B packageTianjie Xu2017-08-221-5/+15
|/ | | | | | | | | | | | | The metadata file now can have multiple serial numbers in the format: serialno=serialno1|serialno2|serialno3 ... Verifier will pass the check if the device serial number matches any of these numbers. Bug: 64802465 Test: Create a metadata file with 1000 numbers and sideload in sailfish. The checker detects both match and mismatch cases. Change-Id: I3f12b75e15f4179df260778e37f4563d65db0fa8
* Fix the android-cloexec-* warnings in bootable/recoveryTianjie Xu2017-07-191-1/+1
| | | | | | | | Add the O_CLOEXEC or 'e' accordingly. Bug: 63510015 Test: recovery tests pass Change-Id: I7094bcc6af22c9687eb535116b2ca6a59178b303
* avoid assuming build number is a 32-bit integerDaniel Micay2017-06-261-13/+9
| | | | | | | | | | | | | | | | | | | | | | | The install logging currently assumes that the build number is a 32-bit integer and prints an error when that doesn't hold true. However, that's only a convention used by Google builds. From build/core/version_defaults.mk: ifeq "" "$(BUILD_NUMBER)" # BUILD_NUMBER should be set to the source control value that # represents the current state of the source code. E.g., a # perforce changelist number or a git hash. Can be an arbitrary string # (to allow for source control that uses something other than numbers), # but must be a single word and a valid file name. # # If no BUILD_NUMBER is set, create a useful "I am an engineering build # from this date/time" value. Make it start with a non-digit so that # anyone trying to parse it as an integer will probably get "0". BUILD_NUMBER := eng.$(shell echo $${USER:0:6}).$(shell $(DATE) +%Y%m%d.%H%M%S) endif Change-Id: I8e7cec0618783f69545ba76d0dce2bbc1681784c
* Fix a race condition for temperature_loggerTianjie Xu2017-06-081-3/+7
| | | | | | | | | It's a rare deadlock that happens on fugu when the updater exits too fast due to a format error. Bug: 62379170 Test: fake-ota fails gracefully without hanging. Change-Id: Icbd6cff4f6b44ca20f4d75f8039332111f696cc5
* Add a binary path param to update_binary_command().Tao Bao2017-05-081-21/+23
| | | | | | | | | | | This allows writing native tests for non-A/B update_binary_command(). Prior to this CL, it was extracting the updater to a hard-coded location (/tmp/update_binary) that's not available under the test environment. Test: recovery_component_test on angler and marlin respectively. Test: Sideload OTA packages on angler and marlin respectively. Change-Id: I78b9cc211d90c0a16a84e94e339b65759300e2a8
* Revert "Remove EXPAND/STRINGIFY macros."Tao Bao2017-05-031-1/+1
| | | | | | | | | | This reverts commit ec9706738f35a859f66fd0758b73381055804f63. Reason for revert: It's not a good idea to put RECOVERY_API_VERSION in common.h, which might be included by device-specific codes (but with RECOVERY_API_VERSION undefined). Change-Id: I9feb9c64a5af3e9165164622a59b043aa28a8b8c
* Remove EXPAND/STRINGIFY macros.Tao Bao2017-05-031-1/+1
| | | | | | | | | | | | | | | | They are error-prone by putting anything into a string (e.g. EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we forgot to pass -DRECOVERY_API_VERSION=3). RECOVERY_API_VERSION is the only user (in bootable/recovery) that gets stringified. Assign it to a typed var and sanity check the value. Don't see other reference to the macros from device-specific recovery directories (they can still define that locally if really needed). Test: recovery_component_test Test: Sideload an OTA on angler and marlin respectively. Change-Id: I358bbdf8f0a99db5ce4c7bc2fdcafe8013501b64
* Move sysMapFile and sysReleaseMap into MemMapping class.Tao Bao2017-05-011-5/+1
| | | | | | | Test: recovery_component_test Test: recovery_unit_test Test: Apply an OTA on angler. Change-Id: I7170f03e4ce1fe06184ca1d7bcce0a695f33ac4d
* recovery: Change install_package() to take std::string.Tao Bao2017-05-011-69/+72
| | | | | | | | | Also change the parameter type for log_buffer from reference to pointer, so the styles for parameters look consistent. Test: mmma bootable/recovery Test: sideload a package with the new recovery image Change-Id: I8f25580ccf22977624648b3e2181cca44dd67c1b
* librecovery: Remove -Wno-unused-parameter and add -Wall.Tao Bao2017-04-241-1/+1
| | | | | Test: mmma bootable/recovery Change-Id: I5598d32bebb9dbda4a183a1502e0b7dc4918392e
* Merge "Call libvintf to verify package compatibility."Tao Bao2017-04-191-5/+10
|\
| * Call libvintf to verify package compatibility.Tao Bao2017-04-191-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | The libvintf API has landed. Hook up to do the actual verification. Bug: 36597505 Test: recovery_component_test Test: m recoveryimage; adb sideload on angler and sailfish, with packages that contain dummy compatibility entries. Test: m recoveryimage; adb sideload on angler and sailfish, with packages that don't contain any compatibility entries. Change-Id: Idbd6f5aaef605ca51b20e667505d686de5ac781f (cherry picked from commit da320ac6ab53395ddff3cc08b88a61f977ed939a)
* | Add tests for read_metadata_from_package().Tao Bao2017-04-191-43/+39
|/ | | | | Test: recovery_component_test Change-Id: I672a6a4f101c72e82b9f25f165dccd1c9520627b
* Minor clean up to install.cpp.Tao Bao2017-04-191-66/+61
| | | | | | | | | - Move some macros / constants into functions; - Remove unneeded #include "minui/minui.h"; - Remove two dead constants (DEFAULT_{FILES,IMAGES}_PROGRESS_FRACTION). Test: mmma bootable/recovery Change-Id: Ib808f14b7569e06e23a8a7cc9b2d4e9aa5469de1
* Add tests for update_binary_command().Tao Bao2017-04-171-82/+80
| | | | | | | | | | | | | | | Expose update_binary_command() through private/install.h for testing purpose. Also make minor clean-ups to install.cpp: a) adding more verbose logging on ExtractToMemory failures; b) update_binary_command() taking std::string instead of const char*; c) moving a few macro and global constants into update_binary_command(). Bug: 37300957 Test: recovery_component_test on marlin Test: Build new recovery and adb sideload on angler and sailfish. Change-Id: Ib2d9068af3fee038f01c90940ccaeb0a7da374fc
* Fix the double free in verify_package_compatibility().Tao Bao2017-04-171-1/+0
| | | | | | | | | | | | | | | | | """ void* cookie; std::unique_ptr<void, decltype(&EndIteration)> guard(cookie, EndIteration); ... EndIteration(cookie); """ The above pattern is buggy that frees 'cookie' twice. Bug: 37413730 Test: Build new recovery and adb sideload a previously crashed package that contains 'compatibility.zip'. Change-Id: I183c33827fb28a438ebaedda446e84cabe7cb92d (cherry picked from commit f978278995d02a58e311fe017bdbb2c3702dd3bc)
* Verify the package compatibility with libvintf.Tao Bao2017-04-131-0/+73
| | | | | | | | | | | | | | | | verify_package_compatibility() is added to parse the compatibility entry (compatibility.zip) in a given OTA package. If entry is present, the information is sent to libvintf to check the compatibility. This CL doesn't actually call libvintf, since the API there is not available yet. Bug: 36597505 Test: Doesn't break the install with existing packages (i.e. w/o the compatibility entry). Test: recovery_component_test Change-Id: I3903ffa5f6ba33a5c0d761602ade6290c6752596 (cherry picked from commit 62e0bc7586077b3bde82759fb34b51b982cea20f)
* Log temperature during OTA updateTianjie Xu2017-03-281-5/+47
| | | | | | | | | | | | Log the maximum temperature as well as the start/end temperature of an update to last_install. Check the temperature at the end of each block_image_update(verify). To get the maximum temp, we iterate through /sys/class/thermal/thermal_zone*/temp and find the maximum value present. Bug: 32518487 Test: temperature logs in last_install Change-Id: Iaf22a9fbc5b18611bbc5320ffea995417872e514
* 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 Merged-In: I277c87a50a72fdb499be790ee25b97f815d980be
* 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
* 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
* 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
* 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
* Print with newline for ui_print.Tao Bao2017-01-211-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
* 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
* 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
* 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."""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.""Dan Albert2016-10-261-0/+2
|\| | | | | | | | | | | am: 9514eb1934 Change-Id: Id96135ffde5adaebd45811b9c3d319a99fe28ecd
| * Revert "Some cleanups to recovery."Dan Albert2016-10-261-0/+2
| | | | | | | | | | | | | | | | This reverts commit c0319b60f56d445c2d1c74f551e01f069b028fe6. Reason for revert: Broke builds. Change-Id: I82aa880b83de5ae6c36fd7567cb001920559a972
* | Merge "Some cleanups to recovery."Tao Bao2016-10-261-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-181-36/+43
|\| | | | | | | Change-Id: I2fa8b85109309ec88c1f8d8def593aa65ab885d7
| * Replace minzip with libziparchiveTianjie Xu2016-10-171-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-131-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
* | 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