Commit graph

5469 commits

Author SHA1 Message Date
Tao Bao
ec2e8c6c1e update_verifier: Support verifying product partition.
We have added the support for building /product partition in build
system (the CL in [1]), where /product is an optional partition that
contains system files. This CL adds the matching support if /product
needs to be verified during A/B OTA (i.e. listed in care_map file).

[1]: commit b7735d81054002961b681f4bdf296d4de2701135,
https://android-review.googlesource.com/c/platform/build/+/598454

Bug: 63974895
Test: Run update_verifier test on walleye.
Change-Id: Ia1c35e9583b8e66c98a4495b1f81a5ea7e65036f
2018-03-23 11:41:32 -07:00
Jaegeuk Kim
28dcad554c Merge "f2fs: support f2fs by setting unmovable bit for package file" 2018-03-22 21:40:44 +00:00
Jaegeuk Kim
b6e6ee7587 f2fs: support f2fs by setting unmovable bit for package file
This enables to use uncrypt for f2fs update-on-reboot.
It requires kernel patch named:
    "f2fs: add an ioctl to disable GC for specific file"

If any operation fails during uncrypt, please delete package file as soon as
possible, and create the file again to move forward. IOWs, don't leave the
package file for a long time.

Bug: 70309376
Bug: 30170612
Change-Id: I3b4233e7da756f107be35364521699deaf2e7139
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-03-22 12:10:08 -07:00
Treehugger Robot
e0b05ba553 Merge "tests: Split ApplyPatchModesTest.PatchModeEmmcTarget." 2018-03-20 19:56:04 +00:00
Tao Bao
e3499f902e tests: Split ApplyPatchModesTest.PatchModeEmmcTarget.
We have been seeing flakiness in continuous test, but unable to
reproduce locally. Break it down into smaller units to narrow down the
cause.

Bug: 67849209
Test: Run recovery_component_test on marlin.
Change-Id: Ia24b0c5d137bad27d502575fcd18d3ca9c9828b6
2018-03-20 10:38:17 -07:00
Treehugger Robot
3537a2659e Merge "tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test." 2018-03-13 15:48:33 +00:00
Tao Bao
d612b23dfd tests: Add ApplyPatchModesTest.PatchModeEmmcTargetWithBsdiffPatch test.
/system/bin/applypatch on device is expected to work with bsdiff based
recovery-from-boot patch automatically. Adding a test to ensure that's
always the case.

Bug: 72731506
Test: Run recovery_component_test on marlin.
Change-Id: I56283cd3ce7cf0215cc3bb3619b206fa01d552c4
2018-03-12 21:21:41 -07:00
Yifan Hong
fc39f3ffd7 Merge "recovery: add libhidl-gen-utils depedency" 2018-03-12 20:50:25 +00:00
Tianjie Xu
0acbdac82b Merge "Set the update locations to default in CacheLocation's constructor" 2018-03-09 04:17:30 +00:00
Tianjie Xu
b4e3a370bf Set the update locations to default in CacheLocation's constructor
Otherwise the applypatch executable will fail to back up the source
file to /cache when patching the recovery image.

Bug: 74198354
Test: run applypatch from boot to recovery
Change-Id: I6e5b9cd06d6ed0b26066b779a348437ecf984b92
2018-03-08 14:24:02 -08:00
Yifan Hong
495c521ed3 recovery: add libhidl-gen-utils depedency
introduced as a depedency to libvintf.

Test: builds
Bug: 73556059
Change-Id: Ia51ba81ef462879481dcacb80d9ea9ea35e8b0bb
2018-03-07 18:35:15 -08:00
Treehugger Robot
ddf93c0055 Merge "Export fuse_sideload.h for libfusesideload." 2018-03-07 22:05:54 +00:00
Treehugger Robot
242d41b808 Merge "Drop the no-op Android.bp." 2018-03-07 20:17:06 +00:00
Treehugger Robot
56160b2b03 Merge "minadbd: Move to Soong." 2018-03-07 18:56:50 +00:00
Tao Bao
e8fdb1ab0b Drop the no-op Android.bp.
The "subdirs=" statement no longer has any effect (with the CL in [1]
that's merged last November). All the Android.bp's will be picked up
automatically.

[1] commit 4f21237342e715cbbac6e409cd67e86a304483c4 in
https://android-review.googlesource.com/c/platform/build/blueprint/+/530115.

Test: mmma -j bootable/recovery
Change-Id: Idd39af1fff907e8c1886f91eea0dd4a9e38a4079
2018-03-07 18:03:23 +00:00
Tao Bao
4b51c3ab40 Export fuse_sideload.h for libfusesideload.
Move the module into a separate directory so that we can export only the
expected header.

With this change, minadbd no longer needs to include bootable/recovery.

Test: mmma -j bootable/recovery
Change-Id: I69b888ceb160a33a67d79c5bda208dc17ad6ed86
2018-03-07 10:01:51 -08:00
Tao Bao
8c7761edec minadbd: Move to Soong.
Test: mmma -j bootable/recovery
Change-Id: Ic4cd676a842f0e8c4735cc6731fcbf13b844510c
2018-03-06 20:36:35 -08:00
Tianjie Xu
47cd789eed Merge "Add a singleton CacheLocation to replace the hard coded locations" 2018-03-01 18:36:05 +00:00
Tianjie Xu
3bbb20f557 Add a singleton CacheLocation to replace the hard coded locations
This class allows us to set the following locations dynamically:
cache_temp_source, last_command_file, stash_directory_base.

In the updater's main function, we reset the values of these variables
to their default locations in /cache; while we can set them to temp
files in unit tests or host simulation.

Test: unit tests pass
Change-Id: I528652650caa41373617ab055d41b1f1a4ec0f87
2018-02-28 11:19:11 -08:00
Tianjie Xu
ac4818d6af Merge "Fix the behavior of undefined commands in BlockImageVerify" 2018-02-28 18:49:56 +00:00
Tianjie Xu
c242084539 Fix the behavior of undefined commands in BlockImageVerify
In BlockImageVerify some commands are undefined, e.g. "erase", "new",
"zero". And we should not error out if the corresponding function
pointer of these commands is null; otherwise we will fail the
verification.

The old code is:
if (cmd->f != nullptr && cmd->f(params) == -1)
  return false;

In the last_command_file change the logic was wrongly modified to
if (cmd->f == nullptr)
  return false;
...
if (cmd->f(params) == -1)
  return false;

Test: sideload an incremental OTA twice on bullhead
Change-Id: I2561c365badb850da0e416629ccd61f0df7da5d7
2018-02-27 23:04:14 -08:00
Treehugger Robot
cc3446a7f7 Merge "Remove the assumption of target chunk size in imgdiff" 2018-02-23 21:12:39 +00:00
Tianjie Xu
572abbb81c Remove the assumption of target chunk size in imgdiff
In the split mode of imgdiff, we used to assume that the size of a split
target chunk is always greater than the blocksize i.e. 4096. This may
lead to the following assertion failure:
I0221 04:57:33.451323 818464 common.py:205 imgdiff F 02-21 04:57:33 821203 821203 imgdiff.cpp:999]
Check failed: tgt_size >= BLOCK_SIZE (tgt_size=476, BLOCK_SIZE=4096)

This CL removes the assumption and handles the edge cases.

Test: generate and verify the incremental update for TFs in the bug; unit test passes

Bug: 73757557
Bug: 73711365
Change-Id: Iadbb4ee658995f5856cd488f3793980881a59620
2018-02-23 10:44:05 -08:00
Treehugger Robot
21b381622d Merge "Replace vfork() with fork()." 2018-02-23 17:04:34 +00:00
George Burgess IV
1cfb361129 Replace vfork() with fork().
The static analyzer complained about the function calls we were doing
here to vector::data() and vector::operator[]:
bootable/recovery/roots.cpp:193:11: warning: This function call is
prohibited after a successful vfork

Since it's not clear that vfork() is needed here, just use fork()
instead.

Bug: None
Test: Reran the static analyzer with only this patch applied. Bug
disappeared
Change-Id: I580f8243a21899f1e1678c8aee6948dfa7f69a1d
2018-02-22 19:25:22 -08:00
hansson
bf52b7e00b Merge "Set LOCAL_SDK_VERSION where possible." 2018-02-21 17:20:44 +00:00
Anton Hansson
6cc499ae07 Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Change-Id: I82fee834c5d92e699e9571933faded11c6d4596e
2018-02-21 14:11:02 +00:00
Treehugger Robot
c1e1d7e711 Merge "Disable building libapplypatch on mac" 2018-02-18 08:15:13 +00:00
Tianjie Xu
7a4dacf724 Disable building libapplypatch on mac
The sdk_mac on build server fails with the error:
bootable/recovery/applypatch/freecache.cpp:23:10: fatal error: 'sys/statfs.h' file not found

So we will disable libapplypatch on mac.

Test: the library still builds on linux; and check the other host targets in the same cl.
Change-Id: Ie4a30708726e51c810f7ad7f1085d38154076cca
2018-02-17 22:06:31 -08:00
Tianjie Xu
31bcd7c002 Merge "Skip the cache size check on host" 2018-02-17 00:15:19 +00:00
Tao Bao
15e376d792 Merge "recovery: Porting screensave mode for new platform." 2018-02-16 05:07:57 +00:00
Tianjie Xu
9818283da7 Merge "Reorder the functions in updater/install.cpp" 2018-02-13 05:32:10 +00:00
Tianjie Xu
e40c80d021 Skip the cache size check on host
When running the update simulation, we choose to skip the cache size
check for now due to the lack of "/cache" on host. And in later cls we
can implement a cache size estimator to make the check more constrained.

Also build the host version of support libraries.

Test: unit test pass
Change-Id: I3ed93c857fd02f7b62f5baba9130f75c3236e717
2018-02-12 15:19:37 -08:00
Tianjie Xu
5419ad31e7 Reorder the functions in updater/install.cpp
There is no logical change to the file; merely the function definition
reorder and some comestic change to make the future review easier.

Test: mma
Change-Id: I7ffe952f8c78e840f10aa6bfad0c4b5a58e29896
2018-02-12 11:55:05 -08:00
Tianjie Xu
6a3646fc03 Merge "Log the last command to cache" 2018-02-08 19:53:37 +00:00
Treehugger Robot
7ee7e27400 Merge "Document instructions for using adb under recovery." 2018-02-08 19:20:57 +00:00
Tao Bao
c84a4ef053 Document instructions for using adb under recovery.
Fixes: 72740736
Test: N/A
Change-Id: Ifc96ed785fd80501bc6c276cb649c8cc1f05be0e
2018-02-07 20:55:33 -08:00
Tianjie Xu
284752e2bc Log the last command to cache
When performing an update, save the index and cmdline of the current
command into the last command file if this command writes to the stash
either explicitly of implicitly. This mitigates the overhead to update
the last command file for every command. I ran a simple test on angler
and the time to update 1000 times is ~2.3 seconds.

Upon resuming an update, read the saved index first; then
  1. In verification mode, check if all commands before the saved index
     have already produced the expected target blocks. If not, delete the
     last command file so that we will later resume the update from the
     start of the transfer list.
  2. In update mode, skip all commands before the saved index. Therefore,
     we can avoid deleting stashes with duplicate id unintentionally;
     and also speed up the update.

If an update succeeds or is unresumable, delete the last command file.
Bug: 69858743
Test: Unittest passed, apply a failed update with invalid cmd on angler
and check the last_command content, apply a failed update with invalid
source hash and last_command is deleted.
Change-Id: Ib60ba1e3c6d111d9f33097759b17dbcef97a37bf
2018-02-06 16:16:49 -08:00
Tianjie Xu
bded087f7d Merge "Avoid overwrite of the error message in AbortFn" 2018-01-30 21:44:02 +00:00
Tianjie Xu
5ad802839d Avoid overwrite of the error message in AbortFn
The AbortFn() used to overwrite the error message, hiding the real
failure reported in ErrorAbort(). And we will miss the failure in
the script patterns like 'blockimageupdate() || abort()'

We will ensure there's one line break at the end of ErrorAbort's
error message; and append to the existing error message when calling
abort().

Test: Message from ErrorAbort shows up in the log
Change-Id: I3aebd06629c5129330250c7fe5e8cdead2ae85bc
2018-01-29 11:42:59 -08:00
Sen Jiang
63eb1a4444 Merge "Add update_channel field to bootloader_message_ab." 2018-01-26 00:48:09 +00:00
Sen Jiang
7191bf0492 Add update_channel field to bootloader_message_ab.
The update_channel field is used to store the Omaha update channel
if update_engine is compiled with Omaha support.

We need it to be in misc to persist through factory reset.

Bug: 72332119
Test: mma
Change-Id: Ied4fecc6e78cc69d33a36ba4d101d675100f9d82
2018-01-22 15:03:53 -08:00
Treehugger Robot
80ccac2fff Merge "StartsWith allows a std::string prefix now." 2017-12-21 02:11:08 +00:00
Elliott Hughes
1d65c95fe8 StartsWith allows a std::string prefix now.
Bug: N/A
Test: builds
Change-Id: I5183ec8133f5dc9a81a438223c6d3d2ea11ef0ec
2017-12-20 12:36:31 -08:00
katao
c35c1b0797 recovery: Porting screensave mode for new platform.
On new board platform the brightness path of
sys/class/leds/lcd-backlight is deprecated,instead of
/sys/class/backlight/panel0-backlight/.

Test: reboot into recovery on sdm845.
Change-Id: Idf0027ab888f9f982a8eef7de230ce3635e7c300
Signed-off-by: katao <katao@xiaomi.com>
2017-12-14 21:09:52 +08:00
Isaac Chen
3fe230a1e4 Merge "Let update_verifier work on non-AB update devices" 2017-12-14 04:18:41 +00:00
Isaac Chen
26fd78c024 Let update_verifier work on non-AB update devices
Make update_verifier check if it runs on A/B update devices at the
beginning, and quit immediately if it doesn't, instead of re-boot.

Bug: 70541023
Test: On aosp/master:
    $ lunch aosp_x86_64-userdebug; m -j # boot to home screen
    # On goog/master:
    $ lunch aosp_walleye-userdebug; m -j # boot to home screen

Change-Id: Ib71a3a3b272cfa5dd0b479eaa067eedaec8fde7d
2017-12-14 10:20:07 +08:00
Tao Bao
9203e77e7d Merge "applypatch: Remove the 'st' field from FileContents." 2017-12-09 17:27:39 +00:00
Jaegeuk Kim
4eaf7a157d Merge "add sload.f2fs for recovery format" 2017-12-08 00:57:41 +00:00
Tao Bao
47e5a8d085 applypatch: Remove the 'st' field from FileContents.
It used to keep track of the stat(2) info (e.g. st_mode/st_gid/st_uid)
while patching a file in file-based OTA.

Test: Build and use the new updater to apply an update on bullhead.
Change-Id: Ibf8f0f4b14298a9489bf24a2678bb279c5d9c8f3
2017-12-07 10:01:57 -08:00