Commit graph

251 commits

Author SHA1 Message Date
Wei Wang
22cf0224fd Merge "tests: Add the missing dependency on libhidlbase." into oc-mr1-dev
am: 1f4229ff95

Change-Id: I80603def879d1837bdcd6ec48aeeef22b635fa00
2017-08-10 02:45:28 +00:00
Tao Bao
102016ce1f tests: Add the missing dependency on libhidlbase.
It fails to build recovery_component_test with the following errors:

out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14:
error: undefined reference to 'android::hardware::hidl_string::hidl_string(android::hardware::hidl_string const&)'
out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14:
error: undefined reference to 'android::hardware::hidl_string::operator=(android::hardware::hidl_string
const&)'
out/soong/.intermediates/hardware/interfaces/boot/1.0/android.hardware.boot@1.0_genc++_headers/gen/android/hardware/boot/1.0/types.h:14:
error: undefined reference to 'android::hardware::hidl_string::~hidl_string()'

libupdate_verifier includes <android/hardware/boot/1.0/IBootControl.h>,
which includes the 'types.h' above. In 'types.h', it defines struct
CommandResult that's using android::hardware::hidl_string.

Since libhidlbase doesn't have a static library target, remove
'LOCAL_FORCE_STATIC_EXECUTABLE := true', which isn't required for
running tests.

Test: mmma -j bootable/recovery
Bug: 64538692
Change-Id: Iaa7c08adc241128d787274fcaea9b363e7ff93f4
2017-08-09 16:41:48 -07:00
Tianjie Xu
8b09001e47 Merge "Add implemention of SortedRangeSet" am: 64cba55fbc am: fbd4b10310
am: a09376ed90

Change-Id: I67b2f4e91133239d4eb35524c7f0ed41f18de8dc
2017-08-01 00:38:21 +00:00
Tianjie Xu
fbd4b10310 Merge "Add implemention of SortedRangeSet"
am: 64cba55fbc

Change-Id: I2174e4f55c85fe57014b31625dbc2d06e41350be
2017-08-01 00:31:20 +00:00
Tianjie Xu
64cba55fbc Merge "Add implemention of SortedRangeSet" 2017-08-01 00:22:33 +00:00
Tianjie Xu
b9e7fc7fa9 Add implemention of SortedRangeSet
This is useful in imgdiff to maintain the block ranges of
splitted source image.

Bug: 34220646
Test: mma && unit tests pass
Change-Id: I6427f2ea50f0e3b0aa3dd01880ec0206679b7429
2017-07-31 15:13:55 -07:00
Tao Bao
06db7363b0 Merge "otautil: Clean up dirCreateHierarchy()." am: 610712101b am: 5507c3d63c
am: 0863373376

Change-Id: Ia2326bca2d8a1344fccd2838e2b376cb9a843a82
2017-07-31 00:21:43 +00:00
Tao Bao
5507c3d63c Merge "otautil: Clean up dirCreateHierarchy()."
am: 610712101b

Change-Id: I95350c4b2aab36dd89ea7813f2eb63d407b5f8ac
2017-07-31 00:15:43 +00:00
Tao Bao
ac3d1edca0 otautil: Clean up dirCreateHierarchy().
- Changed to std::string based implementation (mostly moved from the
  former make_parents() in updater/install.cpp);
- Removed the timestamp parameter, which is only neeed by file-based OTA;
- Changed the type of mode from int to mode_t;
- Renamed dirCreateHierarchy() to mkdir_recursively().

Test: recovery_unit_test passes.
Test: No external user of dirCreateHierarchy() in code search.
Change-Id: I71f8c4b29bab625513bbc3af6d0d1ecdc3a2719a
2017-07-27 10:33:07 -07:00
Tao Bao
9c62f67863 Merge "otautil: Delete dirUnlinkHierarchy()." am: 031661d4a9 am: 993cec5cc9
am: 633aeba594

Change-Id: I9833741fe5d785298d7f99f6b2c9539723f8fcd1
2017-07-25 14:35:50 +00:00
Tao Bao
993cec5cc9 Merge "otautil: Delete dirUnlinkHierarchy()."
am: 031661d4a9

Change-Id: I33a793646f6f11757afc20f16fd3a0f700dd09fb
2017-07-25 14:28:52 +00:00
Tao Bao
7934985e0c otautil: Delete dirUnlinkHierarchy().
This function has become obsolete since we've removed file-based OTA
support (it was needed by 'delete_recursive' edify function earlier).

Test: mmma -j bootable/recovery
Test: Code search shows no active user of the function.
Change-Id: If6faaa759d4c849b79acba4e6adb82baadc89f7a
2017-07-24 20:35:48 -07:00
Tao Bao
5cee24f4f1 tests: Add a test to cover legacy care_map.txt handling.
This is to cover the code added by commit
5a1dee01df, where an O update_verifier
should not reject N care_map.txt.

Bug: 63544345
Test: recovery_component_test passes on marlin.
Change-Id: Ia944e16cba3cc635098b3ffd92842d725b570fec
(cherry picked from commit c319613e06)
2017-07-24 12:51:19 -07:00
Tao Bao
2357b0c745 Merge "tests: Add a test to cover legacy care_map.txt handling." am: 6eb23c594c am: dbe9da5331
am: 0148a6f9ab

Change-Id: Id568b7cb5043c444f88032368be57a6f128a44c7
2017-07-24 18:32:01 +00:00
Tao Bao
dbe9da5331 Merge "tests: Add a test to cover legacy care_map.txt handling."
am: 6eb23c594c

Change-Id: Iaad43cb44f4c406e4c07c9399e70e96cbaa4db7b
2017-07-24 18:27:00 +00:00
Tao Bao
c319613e06 tests: Add a test to cover legacy care_map.txt handling.
This is to cover the code added by commit
5a1dee01df, where an O update_verifier
should not reject N care_map.txt.

Bug: 63544345
Test: recovery_component_test passes on marlin.
Change-Id: Ia944e16cba3cc635098b3ffd92842d725b570fec
2017-07-24 09:34:06 -07:00
Tianjie Xu
512283a751 Merge "Fix a case when brotli writer fails to write last few blocks of data" am: e45c8f0057 am: 80acaab52f
am: 75ff0107c8

Change-Id: Ieab5e6e412704599e873c7497d1c0de42453e642
2017-07-21 22:46:00 +00:00
Tianjie Xu
d9759e8a7b Fix a case when brotli writer fails to write last few blocks of data
receive_new_data may exit too early if the zip processor has sent all
the raw data. As a result, the last few 'new' commands will fail even
though the brotli decoder has more output in its buffer.

Restruct the code so that 'NewThreadInfo' owns the decoder state solely;
and receive_brotli_new_data is responsible for the decompression.

Also reduce the test data size to 100 blocks to avoid the test timeout.

Bug: 63802629
Test: recovery_component_test. on bullhead, apply full updates with and
w/o brotli compressed entries, apply an incremental update.

Change-Id: Id429b2c2f31951897961525609fa12c3657216b7
(cherry picked from commit 6ed175d541)
2017-07-21 22:18:34 +00:00
Tianjie Xu
80acaab52f Merge "Fix a case when brotli writer fails to write last few blocks of data"
am: e45c8f0057

Change-Id: I337e8ec26f59a5245ab299080d7251331823e2da
2017-07-21 21:04:17 +00:00
Tianjie Xu
e45c8f0057 Merge "Fix a case when brotli writer fails to write last few blocks of data" 2017-07-21 20:59:24 +00:00
Tianjie Xu
6ed175d541 Fix a case when brotli writer fails to write last few blocks of data
receive_new_data may exit too early if the zip processor has sent all
the raw data. As a result, the last few 'new' commands will fail even
though the brotli decoder has more output in its buffer.

Restruct the code so that 'NewThreadInfo' owns the decoder state solely;
and receive_brotli_new_data is responsible for the decompression.

Also reduce the test data size to 100 blocks to avoid the test timeout.

Bug: 63802629
Test: recovery_component_test. on bullhead, apply full updates with and
w/o brotli compressed entries, apply an incremental update.

Change-Id: I9442f2536b74e48dbf7eeb062a8539c82c6dab47
2017-07-21 11:44:00 -07:00
Tianjie Xu
f2a279adb5 Merge "Fix the android-cloexec-* warnings in bootable/recovery" am: 94a8ea1797 am: 6d8827e0d3
am: 96b5bb9601

Change-Id: I55911c112a34797d7c7098e5e325145667b46715
2017-07-19 23:12:20 +00:00
Tianjie Xu
6d8827e0d3 Merge "Fix the android-cloexec-* warnings in bootable/recovery"
am: 94a8ea1797

Change-Id: I57ae57bab58f603540654bb24df9facca9a7d625
2017-07-19 23:06:50 +00:00
Tianjie Xu
de6735e80c Fix the android-cloexec-* warnings in bootable/recovery
Add the O_CLOEXEC or 'e' accordingly.

Bug: 63510015
Test: recovery tests pass
Change-Id: I7094bcc6af22c9687eb535116b2ca6a59178b303
2017-07-19 12:17:41 -07:00
Tianjie Xu
9f8fd32d95 Merge "Add support to decompress brotli compressed new data" am: 918e6ea1b2 am: 43bdf6cad6
am: 8375ebee37

Change-Id: I3eea508486f48d316644b68278f42976ffd4698d
2017-07-10 22:47:10 +00:00
Tianjie Xu
43bdf6cad6 Merge "Add support to decompress brotli compressed new data"
am: 918e6ea1b2

Change-Id: I4fd9cea71716ad1574ecb4bb7f612bc8734711c5
2017-07-10 22:33:37 +00:00
Tianjie Xu
107a34f9fc Add support to decompress brotli compressed new data
Add a new writer that can decode the brotli-compressed system/vendor
new data stored in the OTA zip.

Brotli generally gives better compression rate at the cost of slightly
increased time consumption. The patch.dat is already compressed
by BZ; so there's no point to further compress it.

For the given 1.9G bullhead system image:
Size: 875M -> 787M; ~10% reduction of package size.
Time: 147s -> 153s; ~4% increase of the block_image_update execution time.
(I guess I/O takes much longer time than decompression.)

Also it takes 4 minutes to compress the system image on my local
machine, 3 more minutes than zip.

Test: recovery tests pass && apply a full OTA with brotli compressed
system/vendor.new.dat on bullhead

Change-Id: I232335ebf662a9c55579ca073ad45265700a621e
2017-07-07 16:08:18 -07:00
Tianjie Xu
79c1562dc9 Merge "Fix a rare failure for imgdiff when random data equals gzip header" am: b87a166a16 am: 8542502f1f
am: 233f4b0b4b

Change-Id: If7e81b8e794f34d374d385eb5603353cdfec524f
2017-07-07 18:11:59 +00:00
Tianjie Xu
8542502f1f Merge "Fix a rare failure for imgdiff when random data equals gzip header"
am: b87a166a16

Change-Id: Ic3c7d102cc7a2b992c699add012076a4bda549c6
2017-07-07 17:52:26 +00:00
Tianjie Xu
14ebc1e5ae Fix a rare failure for imgdiff when random data equals gzip header
In a rare case, a random chunk will pass both the gzip header check
and the inflation process; but fail the uncompressed length check in the
footer. This leads to a imgdiff failure. So, we should treat this chunk
as 'normal' instead of 'inflated' while generating the patch.

Bug: 63334984
Test: imgdiff generates patch successfully on previous failing images.
Change-Id: Ice84f22d3653bce9756bda91e70528c0d2f264a0
2017-07-06 16:49:11 -07:00
Tianjie Xu
617b702104 Merge "Remove the obsolete package_extract_dir() test" am: e916cca8a9 am: af913974a5
am: e002d96194

Change-Id: If4887683362c1a00ee20b0d6e447d70bff442c28
2017-06-23 04:58:26 +00:00
Tianjie Xu
e002d96194 Merge "Remove the obsolete package_extract_dir() test" am: e916cca8a9
am: af913974a5

Change-Id: I6afcdb92726231325a7d2e8171e3e2b1b3b940e0
2017-06-23 04:53:56 +00:00
Tianjie Xu
e916cca8a9 Merge "Remove the obsolete package_extract_dir() test" 2017-06-23 04:46:14 +00:00
Tianjie Xu
bb7e005a79 Remove the obsolete package_extract_dir() test
package_extract_dir() was removed in go/aog/402383, and the
corresponding UpdaterTest should be removed as well.

Bug: 62918308
Test: mma && code search
Change-Id: Ibe9c473a5d41d2fa4d26abca5684e71b104891b0
2017-06-22 17:35:06 -07:00
David Zeuthen
0f6a109f14 Merge "update_verifier: Support AVB." am: e248e434ea am: 1f108dae49
am: b0c38f1cce

Change-Id: If4e8be8b8277143cad9447a487a674e39ba5a832
2017-06-22 19:56:37 +00:00
David Zeuthen
b0c38f1cce Merge "update_verifier: Support AVB." am: e248e434ea
am: 1f108dae49

Change-Id: I85544f829783fade5e91cfa1d48013047056924d
2017-06-22 19:26:10 +00:00
Treehugger Robot
e248e434ea Merge "update_verifier: Support AVB." 2017-06-22 19:15:15 +00:00
Tianjie Xu
1905e3665a Merge "kill package_extract_dir" am: 99e7216907 am: 49f9c969eb am: 66e53f59b9
am: d1b65aa645

Change-Id: Idb46742fd2b73e927a14e12dd1b7ae5854e35334
2017-05-31 22:01:19 +00:00
Tianjie Xu
d1b65aa645 Merge "kill package_extract_dir" am: 99e7216907 am: 49f9c969eb
am: 66e53f59b9

Change-Id: Iec9ae5171aaa2d8a0eb92de12b78e65aeb0136a4
2017-05-31 21:59:21 +00:00
David Zeuthen
8ed9738b62 update_verifier: Support AVB.
When using AVB, PRODUCT_SUPPORTS_VERITY is not set so check for
BOARD_ENABLE_AVB as well. Also AVB sets up the root filesystem as
'vroot' so map that to 'system' since this is what is
expected. Managed to test at least that the code is at least compiled
in:

 $ fastboot --set-active=_a
 Setting current slot to 'a'...
 OKAY [  0.023s]
 finished. total time: 0.023s

 $ fastboot reboot
 rebooting...

 finished. total time: 0.050s

 $ adb wait-for-device

 $ adb logcat |grep update_verifier
 03-04 05:28:56.773   630   630 I /system/bin/update_verifier: Started with arg 1: nonencrypted
 03-04 05:28:56.776   630   630 I /system/bin/update_verifier: Booting slot 0: isSlotMarkedSuccessful=0
 03-04 05:28:56.776   630   630 W /system/bin/update_verifier: Failed to open /data/ota_package/care_map.txt: No such file or directory
 03-04 05:28:56.788   630   630 I /system/bin/update_verifier: Marked slot 0 as booted successfully.
 03-04 05:28:56.788   630   630 I /system/bin/update_verifier: Leaving update_verifier.

Bug: None
Test: Manually tested on device using AVB bootloader.
Change-Id: I13c0fe1cc5d0f397e36f5e62fcc05c8dfee5fd85
2017-05-24 14:14:11 -04:00
Tianjie Xu
53c38b1538 kill package_extract_dir
It's only used by file-based OTA which has been deprecated for O.

Test: mma
Change-Id: I439c93155ca94554d827142c99aa6c0845cc7561
2017-05-23 17:09:45 -07:00
Tianjie Xu
f158a7d29e Merge "Print SHA1 of the patch if bsdiff fails with data error" am: 1f9808bd48 am: 8f68accc9d am: 1562f41348
am: 0abe9860d8

Change-Id: Id8d4e4b369f30a33a37ca1895d5dd36eb2bf8aff
2017-05-18 22:25:55 +00:00
Tianjie Xu
0abe9860d8 Merge "Print SHA1 of the patch if bsdiff fails with data error" am: 1f9808bd48 am: 8f68accc9d
am: 1562f41348

Change-Id: I7b605673eb3cee6a615459ca9fe2fc00c532ed9d
2017-05-18 22:20:55 +00:00
Tianjie Xu
ce5fa5e538 Print SHA1 of the patch if bsdiff fails with data error
This will help us to identify the patch corruption.

Meanwhile fix a wrong size parameter passed to bspatch.
(patch->data.size() into patch->data.size() - patch_offset).

Also remove the only usage of "ApplyBSDiffPatchMem()" and inline its
Sink function for simplicity.

Bug: 37855643
Test: Prints SHA1 for corrupted patch in imgdiff_test.
Change-Id: Ibf2db8c08b0ded1409bb7c91a3547a6bf99c601d
2017-05-16 12:39:14 -07:00
Tao Bao
4deb2fb1bd Merge "Add a binary path param to update_binary_command()." am: 197304aada am: f648b5c9fc am: f49c57643d
am: 460e47adfc

Change-Id: I34b789b29f019f730d6c8a7e3a96384a056c1d4a
2017-05-09 00:28:00 +00:00
Tao Bao
460e47adfc Merge "Add a binary path param to update_binary_command()." am: 197304aada am: f648b5c9fc
am: f49c57643d

Change-Id: Iea3496ad9cbcd8389ade9effa7072198cf33a5c3
2017-05-09 00:22:30 +00:00
Tao Bao
00d5757186 Add a binary path param to update_binary_command().
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
2017-05-08 12:16:45 -07:00
Tao Bao
ab1e70647f Merge "fuse_sideload: Change the minimal block size to 4096." am: 4e8e56eaea am: 53b98de866 am: 6bea344d7e
am: bfca876038

Change-Id: I5d1fa644a867b523553127c8bde92000f4cb539a
2017-05-04 00:11:51 +00:00
Tao Bao
bfca876038 Merge "fuse_sideload: Change the minimal block size to 4096." am: 4e8e56eaea am: 53b98de866
am: 6bea344d7e

Change-Id: If7e905a7630ee8cf142752695272afb8e76c28cb
2017-05-04 00:06:38 +00:00
Tao Bao
4e8e56eaea Merge "fuse_sideload: Change the minimal block size to 4096." 2017-05-03 23:52:34 +00:00