summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup ReadArgs & ReadValueArgs usageTianjie Xu2016-11-011-30/+24
| | | | | | | | ReadArgs will switch to using std::string and std::unique_ptr. Also cleanup the callers. Test: mma & component test passed. Change-Id: I4724406ae6c0c134a27bbd1cdd24ad5d343b2a3b
* Replace minzip with libziparchiveTianjie Xu2016-10-181-47/+26
| | | | | | | | | | | 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
* Change StringValue to use std::stringTianjie Xu2016-10-151-81/+73
| | | | | | | | | | | Changing the field of 'Value' in edify to std::string from char*. Meanwhile cleaning up the users of 'Value' and switching them to cpp style. Test: compontent tests passed. Bug: 31713288 Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
* Refactor libupdater into a seperate module.Tao Bao2016-10-111-2/+2
| | | | | | | | | So that we can write native tests for updater functions. This CL adds a testcase for getprop() function. Test: mmma bootable/recovery; Run recovery_component_test on device. Change-Id: Iff4c1ff63c5c71aded2f9686fed6b71cc298c228
* Check an edge case when read(2) returns 0Tianjie Xu2016-09-011-0/+4
| | | | | | | | | | We might end up in an infinite loop if read(2) reached EOF unexpectedly. The problematic code in uncrypt mentioned in the bug has been fixed by switching to libbase ReadFully(). So I grepped through the recovery code and fixed some other occurences of the issue. Bug: 31073201 Change-Id: Ib867029158ba23363b8f85d61c25058a635c5a6b
* Check the results from applypatchTianjie Xu2016-06-161-4/+10
|\ | | | | | | | | | | am: 31f8cc84cf Change-Id: I2ea241fb3e688f5f8b0558d638dd3ed502223f97
| * Check the results from applypatchTianjie Xu2016-06-161-4/+10
| | | | | | | | | | | | | | | | Check the results from applypatch in PerformCommandDiff; and abort the update on failure. Bug:29339536 Change-Id: I5087d79ba532b54250f4c17560524255c8a4fabc
* | resolve merge conflicts of 7ce287d to nyc-dev-plus-aospTianjie Xu2016-06-041-7/+52
|\| | | | | | | Change-Id: I2194d1170281f58eb508f2ef63b39c8729125f76
| * Call ioctl before each write on retryTianjie Xu2016-06-031-7/+52
| | | | | | | | | | | | | | | | 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-28/+56
|\| | | | | | | Change-Id: I42c127f7946e678acf6596f6352f090abc0ca019
| * Allow recovery to return error codesTianjie Xu2016-05-201-27/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+12
|\| | | | | | | | | | | | | | | | | 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-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Skip stashing source blocks in verify modeTianjie Xu2016-03-231-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently block_image_verify() stashes source blocks to /cache and in some case triggers I/O errors. To avoid this risk, We create a map from the hash value to the source blocks' range_set. When executing stash command in verify mode, source range is saved but block contents aren't stashed. And load_stash could get its value from either the stashed file from the previous update, or the contents on the source partition specified by the saved range. Bug: 27584487 Bug: 25633753 Change-Id: I775baf4bee55762b6e7b204f8294afc597afd996
| * DO NOT MERGE Control fault injection with config files instead of build flagsJed Estep2016-03-161-1/+1
| | | | | | | | | | Bug: 26570379 Change-Id: I76109d09276d6e3ed3a32b6fedafb2582f545c0c
| * resolve merge conflicts of 7b6027dde4 to master.Tao Bao2016-02-041-10/+9
| |\ | | | | | | | | | Change-Id: I1d5232f61744bb18ca5de3a16a340bc3afd110bb
| * \ Merge "IO fault injection for OTA packages"Jed Estep2016-01-091-6/+7
| |\ \
| | * | IO fault injection for OTA packagesJed Estep2016-01-061-6/+7
| | | | | | | | | | | | | | | | | | | | Bug: 25951086 Change-Id: I31c74c735eb7a975b7f41fe2b2eff042e5699c0c
| * | | updater: Add a function to check first blockTianjie Xu2015-12-181-0/+55
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Add and register a function to check if the device has been remounted since last update during incremental OTA. This function reads block 0 and executes before partition recovery for version >= 4. Bug: 21124327 Change-Id: I8b915b9f1d4736b3609daa9d16bd123225be357f
| * | Merge "updater: Output msg when recovery is called"Tianjie Xu2015-12-111-1/+4
| |\ \
| | * | updater: Output msg when recovery is calledTianjie Xu2015-12-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Output messages in log when recovery is attempted or succeeded during incremental OTA update. Change-Id: I4033df7ae3aaecbc61921d5337eda26f79164fda
* | | | Merge "Fix google-explicit-constructor warnings."Chih-hung Hsieh2016-04-301-1/+1
|\ \ \ \
| * | | | Fix google-explicit-constructor warnings.Chih-Hung Hsieh2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Bug: 28341362 Change-Id: I5b35ae16c069e7e9229e66963386f322bd808af1
* | | | | updater: Don't zero out CommandParameters with memset(3).Tao Bao2016-04-271-2/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [1] switched a few things to android::base::unique_fd including CommandParameters.fd. However, we were using memset(3) to zero out the struct, which effectively assigned unique_fd(0) to fd. When it called fd.reset(), file descriptor 0 was unintentionally closed. When FD 0 was later reassigned via open(2), it led to lseek(2) errors: "Bad file descriptor". This CL switches to using braced-init (i.e. '= {}') instead, so that the default constructor unique_fd(-1) would be called. [1]: commit bcabd0929316fdd022ea102cc86396547ad9f070 Bug: 28391985 Change-Id: If1f99932b15552714c399e65c8b80550344b758a
* | | | Switch to <android-base/unique_fd.h>.Elliott Hughes2016-03-291-25/+17
| | | | | | | | | | | | | | | | Change-Id: I13ba3f40bd52b5f3e3fe9002a45a9a8630040129
* | | | Skip stashing source blocks in verify modeTianjie Xu2016-03-251-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently block_image_verify() stashes source blocks to /cache and in some case triggers I/O errors. To avoid this risk, We create a map from the hash value to the source blocks' range_set. When executing stash command in verify mode, source range is saved but block contents aren't stashed. And load_stash could get its value from either the stashed file from the previous update, or the contents on the source partition specified by the saved range. Bug: 27584487 Bug: 25633753 Change-Id: I775baf4bee55762b6e7b204f8294afc597afd996 (cherry picked from commit 0188935d55206e8c2becb29e995f166cb7040355)
* | | | Control fault injection with config files instead of build flagsJed Estep2016-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 26570379 Change-Id: I76109d09276d6e3ed3a32b6fedafb2582f545c0c (cherry picked from commit d940887dde23597dc358b16d96ca48dd7480fee6)
* | | | IO fault injection for OTA packagesJed Estep2016-02-101-12/+13
| |_|/ |/| | | | | | | | | | | | | | Bug: 25951086 Change-Id: I31c74c735eb7a975b7f41fe2b2eff042e5699c0c (cherry-picked from commit f1fc48c6e62cfee42d25ad12f443e22d50c15d0b)
* | | Switch from mincrypt to BoringSSL in applypatch and updater.Sen Jiang2016-02-041-10/+9
| | | | | | | | | | | | | | | Bug: 18790686 Change-Id: I7d2136fb39b2266f5ae5be24819c617b08a6c21e
* | | updater: Add a function to check first blockTianjie Xu2016-01-071-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add and register a function to check if the device has been remounted since last update during incremental OTA. This function reads block 0 and executes before partition recovery for version >= 4. Bug: 21124327 Change-Id: I8b915b9f1d4736b3609daa9d16bd123225be357f (cherry picked from commit 30bf4765593e639966df9f460df22c3fe912e7bf)
* | | updater: Output msg when recovery is calledTianjie Xu2015-12-111-1/+4
|/ / | | | | | | | | | | | | | | Output messages in log when recovery is attempted or succeeded during incremental OTA update. Change-Id: I4033df7ae3aaecbc61921d5337eda26f79164fda (cherry picked from commit b686ba211443490111729ba9d82eb0c0b305e185)
* / updater: Replace strtok() with android::base::Split().Tao Bao2015-12-071-133/+144
|/ | | | Change-Id: I36346fa199a3261da1ae1bc310b3557fe1716d96
* Track rename from base/ to android-base/.Elliott Hughes2015-12-051-2/+2
| | | | Change-Id: I354a8c424d340a9abe21fd716a4ee0d3b177d86f
* updater: Bump up the BBOTA version to 4.Tao Bao2015-10-231-1/+1
| | | | | | | | | To accommodate new changes in N release, such as error correction [1] and other potential changes to the updater. [1]: commit 0a7b47397db3648afe6f3aeb2abb175934c2cbca Change-Id: I4dd44417d07dd0a31729894628635a0aa1659008
* Error correction: Use libfec in blockimg.cpp for recoverySami Tolvanen2015-10-191-0/+76
| | | | | | | | | | | | Add block_image_recover function to rewrite corrupted blocks on the partition. This can be attempted if block_image_verify fails. Note that we cannot use libfec during block_image_update as it may overwrite blocks required for error correction. A separate recovery pass in case the image is corrupted is the only viable option. Bug: 21893453 Change-Id: I6ff25648fff68d5f50b41a601c95c509d1cc5bce
* updater: Skip empty lines in the transfer list file.Tao Bao2015-09-261-0/+4
| | | | | | | | | We have the last line being empty as a result of android::base::Split("a\nb\n"), which leads to "missing command" warnings in the update. Just skip all the empty lines. Bug: 24373789 Change-Id: I5827e4600bd5cf0418d95477e4592fec47bbd3a9
* updater: Use android::base::ParseInt() to parse integers.Tao Bao2015-09-241-40/+25
| | | | Change-Id: Ic769eafc8d9535b1d517d3dcbd398c3fd65cddd9
* updater: Manage buffers with std::vector.Tao Bao2015-09-101-228/+168
| | | | Change-Id: Ide489e18dd8daf161b612f65b28921b61cdd8d8d
* updater: Replace the pointers in LoadSrcTgtVersion[1-3]() parameter.Tao Bao2015-09-081-29/+26
| | | | | | And inline the call to LoadSrcTgtVersion1() into SaveStash(). Change-Id: Ibf4ef2bfa2cc62df59c4e8de99fd7d8039e71ecf
* updater: Clean up C codes.Tao Bao2015-09-011-602/+429
| | | | | | | Replace C-string with std::string, pointers with references, and variable-size arrays in struct with std::vector. Change-Id: I57f361a0e58286cbcd113e9be225981da56721b2
* updater: Remove the unused isunresumable in SaveStash().Tao Bao2015-08-261-3/+3
| | | | Change-Id: I6a8d9bea4c1cd8ea7b534682061b90e893b227a2
* GOOGLEGMS-749 Fix integer overflow while applying block based OTA packageShrinivas Sahukar2015-08-221-46/+48
| | | | | | | There is an integer overflow when the size of system goes beyond the signed int limits. Hence changing pos to size_t. Change-Id: I6e5e1b2f0e72030b30a6df09a01642f4c82abc79
* updater: Clean up char* with std::string.Tao Bao2015-08-061-261/+141
| | | | | | | So we can remove a few free()s. And also replace a few pointers with references. Change-Id: I4b6332216704f4f9ea4a044b8d4bb7aa42a7ef26
* 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: Ide2e753a2038691d472b6ee173cbf68ac998a084
* updater: Hoist fsync() to outer loop.Tao Bao2015-07-271-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 applypatch/ and updater/ to cpp.Tao Bao2015-07-141-0/+1991
Mostly trivial changes to make cpp compiler happy. Change-Id: I69bd1d96fcccf506007f6144faf37e11cfba1270