Commit graph

3783 commits

Author SHA1 Message Date
Tao Bao
76fdb2419b verify_file: Add constness to a few addresses.
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
2017-03-20 22:13:56 -07:00
Tao Bao
43f5ad6e90 Merge "Add testcases for load_keys()."
am: 110102f37e

Change-Id: I67989c074351f4a9d2a39ee894fd744f4b35c901
2017-03-20 19:28:05 +00:00
Tao Bao
110102f37e Merge "Add testcases for load_keys()." 2017-03-20 19:24:23 +00:00
Tao Bao
b2617e882e Merge "Remove the dead #include's in verifier.cpp."
am: 64d25024b9

Change-Id: I36aed07781b1b9bff0ffe6cabeb5d1f3b8546072
2017-03-20 16:24:23 +00:00
Tao Bao
64d25024b9 Merge "Remove the dead #include's in verifier.cpp." 2017-03-20 16:20:46 +00:00
Tao Bao
3116ce4651 Add testcases for load_keys().
Test: recovery_component_test passes.
Change-Id: I6276b59981c87c50736d69d4af7647c8ed892965
2017-03-18 14:16:21 -07:00
Tao Bao
d7bf82eb53 Remove the dead #include's in verifier.cpp.
A follow-up to commit 5e535014dd.
Also clean up Android.mk, since libverifier no longer needs anything
from libminui.

Test: mmma bootable/recovery
Test: recovery_component_test passes.
Change-Id: I1c11e4bbeef67ca34a2054debf1f5b280d509217
2017-03-18 09:28:42 -07:00
Tao Bao
553c7bd307 resolve merge conflicts of 90d3f20c to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution.
Change-Id: I9c1806eceb56712c4b3d1c67d54f4b21bd3fe50a
2017-03-18 07:33:26 -07:00
Tao Bao
90d3f20c99 Merge "Drop the dependency on 'ui' in verify_file()." 2017-03-18 14:16:16 +00:00
Tao Bao
5e535014dd Drop the dependency on 'ui' in verify_file().
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
2017-03-17 14:07:12 -07:00
Tianjie Xu
9accc96dd1 Merge "Revert "Revert "Print SHA-1 in hex for corrupted blocks"""
am: 73cb75b46c

Change-Id: I81b1dc17eb5947f361d7b31b5bc8d07c34fe24b0
2017-03-17 19:13:35 +00:00
Tianjie Xu
73cb75b46c Merge "Revert "Revert "Print SHA-1 in hex for corrupted blocks""" 2017-03-17 19:06:38 +00:00
Tianjie Xu
5c06706d51 Merge "Add a test to perform block_image_update"
am: 881b08ecd2

Change-Id: Id80b5d9376bbf65dbbeb82aa1c3d7cdd8921c9ff
2017-03-17 18:28:30 +00:00
Tianjie Xu
881b08ecd2 Merge "Add a test to perform block_image_update" 2017-03-17 18:22:11 +00:00
Tao Bao
965021ab8d Merge "Add the missing #include of <functional>."
am: dd553d280f

Change-Id: I9592ef7ff84d12acc027ba4f9f5014abbb45b805
2017-03-17 15:43:17 +00:00
Tao Bao
dd553d280f Merge "Add the missing #include of <functional>." 2017-03-17 15:35:54 +00:00
Tao Bao
9468fc0429 Add the missing #include of <functional>.
For the use of std::function and std::bind. They were relying on the
transitive inclusion from <minui/minui.h>.

Test: mmma bootable/recovery
Change-Id: Ia138e1cbdd035b11d6cdca9e16c5591303b6ee13
2017-03-17 01:00:25 -07:00
Tianjie Xu
2cd36ba522 Revert "Revert "Print SHA-1 in hex for corrupted blocks""
This reverts commit 90eff6a340.
Also fix the bug where stashed blocks are not freed.

Bug: 21124445
Test: Previous failed update succeeded on bullhead
Change-Id: I23d232331a2beb51b6dcc82c957c87bc247d0268
2017-03-16 23:33:01 -07:00
Tianjie Xu
56ebe620a2 Add a test to perform block_image_update
Add the following tests:
stash src
bspatch stashed_src tgt
free stashed_src
(expected a successful update)

stash src
free stashed_src
fail_the_update
(expected stashed_src freed)

Bug: 36242722
Test: Test identified unfreed stashes correctly.
Change-Id: I5a136e8dc31774367972fbfe8c63cbc1ddb3a113
2017-03-16 23:06:37 -07:00
Tianjie Xu
91f8574061 Merge "More cleanup to imgdiff & imgpatch"
am: 3541934ff5

Change-Id: Icd54cbc1ca04fbe959a16fa6ac59ac4c20aeddcf
2017-03-17 01:00:20 +00:00
Treehugger Robot
3541934ff5 Merge "More cleanup to imgdiff & imgpatch" 2017-03-17 00:52:50 +00:00
Tao Bao
8209daeff1 Merge "updater: Minor clean up to EnumerateStash()."
am: 4fc7659612

Change-Id: I2e51c81a9742dd71e487784eb51d472ee8a9fd04
2017-03-16 23:24:12 +00:00
Tao Bao
4fc7659612 Merge "updater: Minor clean up to EnumerateStash()." 2017-03-16 23:15:06 +00:00
Tianjie Xu
12b90553d7 More cleanup to imgdiff & imgpatch
Also remove the utils in applypatch and replace them with the
corresponding libbase functions.

Test: recovery tests pass.
Change-Id: I77254c141bd3e7d3d6894c23b60e866009516f81
2017-03-16 12:09:49 -07:00
Tao Bao
40e144dae8 applypatch: Drop the support for patching non-EMMC targets.
Patching regular files is used in file-based OTA only, which has become
obsolete.

Bug: 35853185
Test: Apply an incremental that patches the boot.img.
Test: /system/bin/install-recovery.sh works.
Test: recovery_component_test passes.
Change-Id: Id44e42c4bc63f2162ecc8a6df1cb528b7ae6b0a9
2017-03-16 00:49:49 -07:00
Tao Bao
ec8272f6e3 updater: Minor clean up to EnumerateStash().
Test: Apply an incremental BBOTA package with the new updater.
Test: Resume an interrupted BBOTA (so it cleans up the partial stash).
Change-Id: I620cc57ee6366845bcffbc19210f7a01e2196052
2017-03-16 00:00:46 -07:00
Tao Bao
8acce85be8 Merge "Revert "Print SHA-1 in hex for corrupted blocks""
am: 06f6227f1d

Change-Id: I8a7a1653cdadf4748508d38b69da51fa5d5be877
2017-03-15 18:35:51 +00:00
Tao Bao
06f6227f1d Merge "Revert "Print SHA-1 in hex for corrupted blocks"" 2017-03-15 18:31:21 +00:00
Tao Bao
90eff6a340 Revert "Print SHA-1 in hex for corrupted blocks"
This reverts commit bb0cd75a0e.

Broke the 'free' command that deletes a stash.

Bug: 36242722
Test: The previously failed incremental applies successfully.
Change-Id: I1237cb0a33adfbeea57e0465b629704862ba13aa
2017-03-15 09:57:06 -07:00
Tao Bao
000f364c19 Merge "updater: Remove some obsoleted functions for file-based OTA."
am: 342717d148

Change-Id: I773ec06188a884ebdefe5194ede39974a4b1f419
2017-03-14 17:12:31 +00:00
Tao Bao
342717d148 Merge "updater: Remove some obsoleted functions for file-based OTA." 2017-03-14 17:08:02 +00:00
Tianjie Xu
821592aff4 Merge "Print SHA-1 in hex for corrupted blocks"
am: 59383b383c

Change-Id: Ib1e6c3c853a52e619f053996c45913cfc9a70703
2017-03-13 20:25:18 +00:00
Tianjie Xu
59383b383c Merge "Print SHA-1 in hex for corrupted blocks" 2017-03-13 20:18:12 +00:00
Tianjie Xu
bb0cd75a0e Print SHA-1 in hex for corrupted blocks
It will be helpful for debug if we know which blocks are corrupted after
a verification failure. This CL prints the SHA-1 for each source block
in a transfer command if these blocks don't have an expected hash. And
along with the correct SHA-1, we will catch the corrupted blocks.

Bug: 21124445
Test: Printed the mismatched SHA-1 for bullhead during an update.
Change-Id: I683d4bdaf9a335035045b3f532b3a265b2fcbbfc
2017-03-13 11:32:56 -07:00
Tao Bao
63d786cf22 updater: Remove some obsoleted functions for file-based OTA.
This CL removes the updater support for delete(), symlink(), rename(),
set_metadata() and set_metadata_recursive(). Such functions have been
removed from the generation script in commit
f388104eaacd05cfa075d6478369e1d0df5ddbf3 (platform/build).

Note: This CL also removes delete_recursive() which seems to have never
been supported in generation script.

Bug: 35853185
Test: recovery_component_test passes.
Change-Id: I51e1ec946fa73761118fa1eaa082423df6d588e9
2017-03-13 10:02:08 -07:00
Tao Bao
6c6861d7c5 Merge "update_verifier: Set the success flag if dm-verity is not enabled."
am: a7211b3c16

Change-Id: I4e516463fe7a7a7f97e7bb6c7c7c42f5f320f7ef
2017-03-11 01:38:39 +00:00
Tao Bao
a7211b3c16 Merge "update_verifier: Set the success flag if dm-verity is not enabled." 2017-03-11 01:32:44 +00:00
Tao Bao
db57f0d7f4 update_verifier: Set the success flag if dm-verity is not enabled.
For devices that are not using dm-verity, update_verifier can't verify
anything, but to mark the successfully booted flag unconditionally.

Test: Successfully-booted flag is set on devices w/o dm-verity.
Test: Successfully-booted flag is set after verification on devices w/
      dm-verity.
Change-Id: I79ab2caec2d4284aad0d66dd161adabebde175b6
2017-03-10 15:16:27 -08:00
Bowgo Tsai
1a23257214 Merge "recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs"
am: 7a0dfec771

Change-Id: I99394806f787e6a6acc55d240720fd22f57ac523
2017-03-10 16:09:44 +00:00
Treehugger Robot
7a0dfec771 Merge "recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs" 2017-03-10 16:06:01 +00:00
Bowgo Tsai
d13b6cf29c recovery: replacing fs_mgr_read_fstab() with new fs_mgr APIs
The fstab settings of early-mounted partitions (e.g., /vendor) will be in
kernel device tree. Switch to the new API to get the whole settings with
those in device tree:

    fs_mgr_read_fstab_with_dt("/etc/recovery.fstab")

The original default /fstab.{ro.hardware} might be moved to
/vendor/etc/. or /odm/etc/. Use another new API to get the default fstab
instead of using the hard-coded /fstab.{ro.hardware}. This API also
includes the settings from device tree:

    fs_mgr_read_fstab_default()

Bug: 35811655
Test: boot sailfish recovery
Change-Id: Iaa56ac7f7b4c4dfc7180c65f03e9a37b94f1de09
2017-03-10 17:27:31 +08:00
Tao Bao
316610763b Merge "recovery: Fix the FIXME in get_menu_selection()."
am: f0e8f0727e

Change-Id: Ia944d71ea0ef89d3ed73abf53e1efc740302a630
2017-03-08 19:24:41 +00:00
Tao Bao
f0e8f0727e Merge "recovery: Fix the FIXME in get_menu_selection()." 2017-03-08 19:16:19 +00:00
Tao Bao
b97f06a5dd Merge "recovery: Move a few int to bool."
am: cbb2bcf541

Change-Id: I73b44ccf00d361ca3dfa47832ef8a4cb253c83ff
2017-03-08 01:11:59 +00:00
Tao Bao
cbb2bcf541 Merge "recovery: Move a few int to bool." 2017-03-08 01:07:13 +00:00
Tao Bao
50dd532934 recovery: Fix the FIXME in get_menu_selection().
It used to return a REBOOT action on timeout, until the CL in commit
daefc1d442 that redefined the return value
of get_menu_selection() (changing from action to a menu index).

Prior to this CL, it was returning 0 (i.e. the value of Device::REBOOT)
to trigger the reboot. This CL specifies a return value of -1 to
indicate the timeout.

Test: Boot into a user build recovery; it reboots automatically on
      timeout (120 sec).
Change-Id: I4aedb7a4628bf258017078fe73eb8b48a21d0ea8
2017-03-07 15:35:17 -08:00
Tao Bao
fc5499f22b recovery: Move a few int to bool.
Most of the changes are trivial.

Also update a dead reference to device_handle_key() in device.h comment,
and add some comments to get_menu_selection() function.

Test: `mmma bootable/recovery`
Change-Id: I59ef9213ec88ab35c0e7b8a7813ccf9c56dbd5c5
2017-03-07 15:35:12 -08:00
Tao Bao
d988b56999 Merge "recovery: Add the missing #include."
am: b7f56f9b91

Change-Id: I2d1801e9bbbea854ef3a81b02514a79adf7a3003
2017-03-07 21:45:47 +00:00
Tao Bao
b7f56f9b91 Merge "recovery: Add the missing #include." 2017-03-07 21:37:54 +00:00
Tao Bao
ed4a537bf0 recovery: Add the missing #include.
Although I checked there's no reference to 'stage' in device-specific
recovery codes (for commit a8d72bc3b4),
it's insufficient to capture the missing #include issue.

Test: lunch aosp_dragon-userdebug; mmma bootable/recovery
Change-Id: I4c5dbe9acf38918491c3aa776ce358be03f9ecca
2017-03-07 13:33:27 -08:00