summaryrefslogtreecommitdiffstats
path: root/updater
Commit message (Collapse)AuthorAgeFilesLines
* update-binary: support reboot_now on older recoveriesBrint E. Kriebel2015-11-251-0/+5
| | | | | | | | Attempt to reboot using older methods in case the recovery that we are updating does not support init reboots Ticket: CYNGNOS-1242 Change-Id: I9d6ec23c65291221e99d67b2361a2bd150319eee
* updater: Add LZMA support to blockimgSteve Kondik2015-11-252-2/+7
| | | | | | | | | * This adds support for LZMA compressed blockimages. The space savings from doing this is significant and will reduce our CDN costs by quite a bit. * I'll spend the saved $$$ on beer. Change-Id: I6679220aaa29592fe6bbccd4136f0c239e45e2ae
* updater: Allow devices to suppress BLKDISCARDandi342015-11-252-0/+6
| | | | | | | * On some devices TRIM is disabled for security reasons. Don't fail flashing the ROM because discard isn't possible in this case. Change-Id: I044619c3e0b01a496d967ef136501d0190240ad4
* recovery: autodetect filesystem typeDan Pasanen2015-11-252-0/+14
| | | | | | | | | | | | | | | * Multiple fstab lines (supported in android) cause recovery to fail to mount partitions if the fs type is not the same as the first fstab entry. So when we attempt to find an fstab entry that matches a path for an f2fs, ext4 or vfat type, check it against blkid's determination of what filesystem type it is. If there is a discrepancy, query fs_mgr for the next possible entry that matches that path until either we find one that is good, or run out of fstab entries. * Also attempt to autodetect the filesystem type for mounting from update.zips. Change-Id: Ib6f4535dd88ef714ae1ca6fb0ffae1c7dac0f7ce
* sr: updater: Fix multi-stage docsTom Marshall2015-11-251-4/+5
| | | | | | * Fix reboot_now comments to reflect actual usage. Change-Id: I692d626185af24620382f7b318c2b77f643ccfb8
* Allow custom bootloader msg offset in block miscMatt Mower2015-11-252-0/+13
| | | | | | | | | | | | Use board define BOARD_RECOVERY_BLDRMSG_OFFSET with a decimal integer to define a custom offset where the bootloader message should be read/written. Edify commands get_stage and set_stage need to be aware of the custom bootloader msg offset because they write the stage directly to the BCB. Change-Id: Id13a23dd41bb7d907b96d657b8e21eb839dfeaa9
* Suppress some compiler warnings due to signedness.Tao Bao2015-11-071-1/+1
| | | | Change-Id: I63f28b3b4ba4185c23b972fc8f93517295b1672a
* updater: Hoist fsync() to outer loop.Tao Bao2015-11-071-6/+5
| | | | | | | | | | Currently the fsync() inside write_all() may be called multiple times when performing a command. Move that to the outer loop and call it only after completing the command. Also remove the O_SYNC flag when writing a stash. Change-Id: I71e51d76051a2f7f504eef1aa585d2cb7a000d80
* recovery: Switch to clangTao Bao2015-11-071-0/+2
| | | | | | And a few trival fixes to suppress warnings. Change-Id: I38734b5f4434643e85feab25f4807b46a45d8d65
* Fix build: fprintf without modifierTao Bao2015-11-071-2/+1
| | | | Change-Id: I66ae21a25a25fa3c70837bc54a7d406182d4cf37
* Log update outputs in orderTao Bao2015-11-071-0/+6
| | | | | | | | | | | | | | 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
* Stop using libstdc++.Dan Albert2015-11-071-1/+1
| | | | | | | | These are already getting libc++, so it isn't necessary. If any of the other static libraries (such as adb) use new or delete from libc++, there will be symbol collisions. Change-Id: I55e43ec60006d3c2403122fa1174bde06f18e09f
* Add error and range checks to parse_rangeSami Tolvanen2015-11-071-10/+71
| | | | | | | | | | | Only trusted input is passed to parse_range, but check for invalid input to catch possible problems in transfer lists. Bug: 21033983 Bug: 21034030 Bug: 21034172 Bug: 21034406 Change-Id: Ia17537a2d23d5f701522fbc42ed38924e1ee3366
* Remove ext4 guardsMichael Bestas2015-11-072-8/+0
| | | | | | * Fix compilation on yaffs targets Change-Id: Icd571dce3ee8c232b13ae199df6e0a4feeb7fb68
* recovery:updater: Changes to support 32->64 bit upgradespadarshr2015-10-062-1/+79
| | | | | | | | | | | | | We now support upgrading from 32 to 64 bit builds. The check for device to package compatibility now takes into account if the product name on the device vs the product name on the upgrade build differs only by the _32 or _64 trailing chars. In addition we also force compile the updater binary as 32 bit executable so that it can run on the 32 bit build we are upgrading from. Change-Id: Iebe6107e55719141fbcc496efa0c60ef1f9368c8
* udpater: Call fsync() after rename().Tao Bao2015-08-041-0/+20
| | | | | | | | We need to ensure the renamed filename reaches the underlying storage. Bug: 22840552 Change-Id: I824b6e9d8a9c5966035be7b42a73678d07376342 (cherry picked from commit dc3922622a94af4f6412fd68e8f075f839ab2348)
* Revert "Zero blocks before BLKDISCARD"Tao Bao2015-06-301-17/+1
| | | | | | | | | | This reverts commit b65f0272c860771f2105668accd175be1ed95ae9. It slows down the update too much on some devices (e.g. increased from 8 mins to 40 mins to take a full OTA update). Bug: 22129621 Change-Id: I4e8d4f6734967caf4f0d19c734027f7b6c107370
* More accurate checking for overlapped ranges.Tao Bao2015-06-261-1/+1
| | | | | | | | | A RangeSet has half-closed half-open bounds. For example, "3,5" contains blocks 3 and 4. So "3,5" and "5,7" are actually not overlapped. Bug: 22098085 Change-Id: I362d259f8b5d62478858ad0422b635bc5068698d (cherry picked from commit c0f56ad76680df555689d4a2397487ef8c16b1a6)
* Zero blocks before BLKDISCARDSami Tolvanen2015-06-101-1/+17
| | | | | | | | | | | Due to observed BLKDISCARD flakiness, overwrite blocks that we want to discard with zeros first to avoid later issues with dm-verity if BLKDISCARD is not successful. Bug: 20614277 Bug: 20881595 Change-Id: I4f6f2db39db990879ff10468c9db41606497bd6f (cherry picked from commit a3c75e3ea60d61df93461f5c356befe825c429d2)
* Revert "Zero blocks before BLKDISCARD"Sami Tolvanen2015-06-101-5/+9
| | | | | | This reverts commit 604c583c9dd3d47906b1a57c14a7e9650df7471e. Change-Id: I2b0b283dc3f44bae55c5e9f7231d7c712630c2b5
* Zero blocks before BLKDISCARDSami Tolvanen2015-06-091-9/+5
| | | | | | | | | | | Due to observed BLKDISCARD flakiness, overwrite blocks that we want to discard with zeros first to avoid later issues with dm-verity if BLKDISCARD is not successful. Bug: 20614277 Bug: 20881595 Change-Id: I0280fe115b020dcab35f49041fb55b7f8e793da3 (cherry picked from commit 96392b97f6bf1670d478494fb6df89a3410e53fa)
* Really don't use TEMP_FAILURE_RETRY with close in recovery.Elliott Hughes2015-05-291-1/+1
| | | | | | | | I missed one last time. Bug: http://b/20501816 Change-Id: I9896ee2704237d61ee169f898680761e946e0a56 (cherry picked from commit b3ac676192a093c561b7f15064cbd67733407b12)
* Handle BLKDISCARD failuresSami Tolvanen2015-05-291-2/+1
| | | | | | | | | | | | In the block updater, if BLKDISCARD fails, the error is silently ignored and some of the blocks may not be erased. This means the target partition will have inconsistent contents. If the ioctl fails, return an error and abort the update. Bug: 20614277 Change-Id: I33867ba9337c514de8ffae59f28584b285324067 (cherry picked from commit cc2428c8181d18c9a88db908fa4eabd2db5601ad)
* Don't use TEMP_FAILURE_RETRY on close in recovery.Elliott Hughes2015-05-151-2/+2
| | | | | | Bug: http://b/20501816 Change-Id: I35efcd8dcec7a6492ba70602d380d9980cdda31f (cherry picked from commit b47afedb42866e85b76822736d915afd371ef5f0)
* Check all lseek calls succeed.Elliott Hughes2015-04-291-28/+20
| | | | | | | | Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek. Bug: http://b/20625546 Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b (cherry picked from commit 7bad7c4646ee8fd8d6e6ed0ffd3ddbb0c1b41a2f)
* Don't remove existing explicitly stashed blocksSami Tolvanen2015-04-171-10/+28
| | | | | | | | | | | | | | | | When automatically stashing overlapping blocks, should the stash file already exist due to an explicit stash command, it's not safe to remove the stash file after the command has completed. Note that it is safe to assume that the stash file will remain in place during the execution of the next command, so we don't have take other measures to preserve overlapping blocks. The stash file itself will be removed by a free command when it's no longer needed. Bug: 20297065 Change-Id: I8ff1a798b94086adff183c5aac03260eb947ae2c
* Always use strerror to report errno in recovery.Elliott Hughes2015-03-231-19/+20
| | | | Change-Id: I7009959043150fabf5853a43ee2448c7fbea176e
* Remove more dead code from minzip.Narayan Kamath2015-02-271-1/+1
| | | | | | | | | | | | I've added explanatory comments to mzExtractRecursive because that function will live on as a utility even after we move the zip format related logic to libziparchive. bug: 19472796 (cherry-picked from commit c9ccdfd7a42de08c47ab771b94dc5b9d1f957b95) Change-Id: I8b7fb6fa3eafb2e7ac080ef7a7eceb691b252d8a
* Initialize stashbase even stash_max_blocks = 0Jesse Zhao2015-02-171-1/+1
| | | | | Change-Id: I480c02ffedd811f4dda9940ef979a05ff54f1435 Bug: 19410117
* am 42b09d25: am 6a0d2fbc: Merge "There\'s no GPL code in \'updater\'."Elliott Hughes2015-02-092-339/+0
|\ | | | | | | | | * commit '42b09d255afdb47bc0546183cbc68e86147baaab': There's no GPL code in 'updater'.
| * am 6a0d2fbc: Merge "There\'s no GPL code in \'updater\'."Elliott Hughes2015-02-072-339/+0
| |\ | | | | | | | | | | | | * commit '6a0d2fbcaa1740da7bb0e7a0ef8280e8b7b9bb05': There's no GPL code in 'updater'.
| | * There's no GPL code in 'updater'.Elliott Hughes2015-02-052-339/+0
| | | | | | | | | | | | | | | | | | | | | This notice was added for libsyspatch and libxdelta3, but that code has been removed since. Change-Id: I4008878ded56ca1d5094a8208728f8c02fe1fe03
* | | Merge "Support resuming block based OTAs"Sami Tolvanen2015-02-061-346/+1460
|\ \ \ | |/ / |/| |
| * | Support resuming block based OTAsSami Tolvanen2015-01-301-346/+1460
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for transfer list version 3, which allows us to verify the status of each command and resume an interrupted block based OTA update. Notes on the changes: - Move the previous BlockImageUpdateFn to a shorter and reusable PerformBlockImageUpdate, which can be used also in BlockImageVerifyFn for verification. - Split individual transfer list commands into separate functions with unified parameters for clarity, and use a hash table to locate them during execution. - Move common block reading and writing to ReadBlocks and WriteBlocks to reduce code duplication, and rename the readblock and writeblock to less confusing read_all and write_all. The coding style of the new functions follows the existing style in the updater/edify code. Needs matching changes from Ia5c56379f570047f10f0aa7373a1025439495c98 Bug: 18262110 Change-Id: I1e752464134aeb2d396946348e6041acabe13942
* | | am aeecac54: Merge "Add missing includes."Elliott Hughes2015-01-301-0/+1
|\ \ \ | |/ / |/| / | |/ | | * commit 'aeecac5444ce55d2e82ee1b2aa35ff61a038c14e': Add missing includes.
| * Add missing includes.Elliott Hughes2015-01-291-0/+1
| | | | | | | | Change-Id: I06ea08400efa511e627be37a4fd70fbdfadea2e6
* | am c43b17f0: Merge "Fix recovery image build for 32p"Ying Wang2014-12-021-1/+1
|\ \ | |/ | | | | | | * commit 'c43b17f0adac1092e221ce6166ca8bc464090525': Fix recovery image build for 32p
| * Fix recovery image build for 32pBruce Beare2014-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | When building for 32p, we need to be explicit that we wish to build the 32bit version of the binaries that will be placed in the recovery image. The recovery image doesn't actually care... but if we are not explicit in this, the makefiles will ask for the 64bit binaries but the Android.mk for the binaries will supply the 32bit images (causing the build to fail). Change-Id: Iea2d5f412740c082795da4358765751138a4b167
* | am b278c252: Add support for tune2fs file operationsMichael Runge2014-11-242-0/+43
|\ \ | | | | | | | | | | | | * commit 'b278c252e148798346f85fc92eeea6afeb33fbf0': Add support for tune2fs file operations
| * | Add support for tune2fs file operationsMichael Runge2014-11-212-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows tune2fs to be executed from within OTA scripts, allowing for file system modifications without formatting the partition Bug: 18430740 Change-Id: I0c2e05b5ef4a81ecea043e9b7b99b545d18fe5e6
* | | am 5ddf4293: Log mount/unmount errors to UIMichael Runge2014-10-241-5/+9
|\ \ \ | |/ / | | | | | | | | | * commit '5ddf4293df45a051c7900eeb62fb5ec4950b6cb6': Log mount/unmount errors to UI
| * | Log mount/unmount errors to UIMichael Runge2014-10-241-5/+9
| | | | | | | | | | | | | | | Bug: 18092022 Change-Id: I6c42038ebeb1cfc1e7ca0d3e12310fdce1b990b0
* | | am 68802416: unconditionally apply SELinux labels to symlinksNick Kralevich2014-10-241-10/+9
|\ \ \ | |/ / | | | | | | | | | * commit '688024169df70336cc128ea8cc929174c53a501e': unconditionally apply SELinux labels to symlinks
| * | unconditionally apply SELinux labels to symlinksNick Kralevich2014-10-231-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the end of the OTA script, we walk through /system, updating all the permissions on the filesystem, including the UID, GID, standard UNIX permissions, capabilities, and SELinux labels. In the case of a symbolic link, however, we want to skip most of those operations. The UID, GID, UNIX permissions, and capabilities don't meaningfully apply to symbolic links. However, that's not true with SELinux labels. The SELinux label on a symbolic link is important. We need to make sure the label on the symbolic link is always updated, even if none of the other attributes are updated. This change unconditionally updates the SELinux label on the symbolic link itself. lsetfilecon() is used, so that the link itself is updated, not what it's pointing to. In addition, drop the ENOTSUP special case. SELinux has been a requirement since Android 4.4. Running without filesystem extended attributes is no longer supported, and we shouldn't even try to handle non-SELinux updates anymore. (Note: this could be problematic if these scripts are ever used to produce OTA images for 4.2 devices) Bug: 18079773 Change-Id: I87f99a1c88fe02bb2914f1884cac23ce1b385f91
* | | am 168f7778: Allow passing of mount args to mountFnMichael Runge2014-10-231-5/+18
|\ \ \ | |/ / | | | | | | | | | * commit '168f77787700f0e9f66675beef33c593a777e64e': Allow passing of mount args to mountFn
| * | Allow passing of mount args to mountFnMichael Runge2014-10-231-5/+18
| | | | | | | | | | | | | | | | | | | | | Bug: 18079773 Bug: 18092222 Change-Id: Ifc3f3e123de729dfbb2f49414b3207afa96268d5
* | | am 473967d8: Merge "Log to UI any metadata setting errors" into lmp-devBrian Carlstrom2014-10-231-34/+50
|\ \ \ | |/ / | | | | | | | | | * commit '473967d87ff9fc7a541c16ebdc56364c285d2862': Log to UI any metadata setting errors
| * | Merge "Log to UI any metadata setting errors" into lmp-devBrian Carlstrom2014-10-231-34/+50
| |\ \
| | * | Log to UI any metadata setting errorsMichael Runge2014-10-231-34/+50
| | |/ | | | | | | | | | | | | Bug: 18079773 Change-Id: Ic6fddbcbcb6ddb9e1cbd1698df98387c0033ae15
* | | am 2f0ef730: Treat already-renamed files as having no problems.Michael Runge2014-10-231-0/+3
|\ \ \ | |/ / | | | | | | | | | * commit '2f0ef73029fc51c6404121f338b034c8b516652c': Treat already-renamed files as having no problems.