Commit graph

67 commits

Author SHA1 Message Date
Tianjie Xu
2bb374a86d Add libavb as a dependency
It's needed by libfec

Test: mma
Change-Id: Ic82671f6506e7718afa965a511261b1b329ea38f
2020-02-28 11:41:31 -08:00
Dan Willemsen
5a6784168f Convert update_host_simulator to Android.bp
Bug: 130696912
Test: m update_host_simulator
Change-Id: I7b3c0217268a3edcf76548a5c83030050b2d17f3
2020-01-15 09:39:13 -08:00
Colin Cross
0e643e4d7f Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I0affaa292237bdbc772d3adc36086905ed6fbe9d
2019-09-23 13:54:09 -07:00
Colin Cross
d81519400c Set LOCAL_INJECT_BSSL_HASH for updater
updater is built in Make and statically links libcrypto,
so it needs to set LOCAL_INJECT_BSSL_HASH to make the FIPS self
test pass.

Bug: 137267623
Test: m checkbuild
Change-Id: Ib253c870090ac8026f5cbb005d6b0e935c73edd1
2019-09-05 15:34:50 -07:00
Tianjie Xu
b42281a423 Drop the device specific support for update host simulator
The device specific libs prevent us from building an universal simulator to add
to the otatools. Drop the support since there is currently no active users of the
simulator extension; plus we will unlikely to implement the device specific simulator
runtime.

As a alternation, we will add the commandline arguments to skip certain unsupported
functions, and move the simulator build to the bp file.

Bug: 131911365
Test: mma
Change-Id: I3ff0f45dbebe3ed72d5f4670a869b40e6cfd5a7c
2019-07-12 11:55:59 -07:00
Tianjie Xu
74b0f7cce0 Implement the TargetFile and BuildInfo
The TargetFile class parses a target-file and provides functions to read
its contents. And the BuildInfo tries to simulate the device with files
on host. Some work it does includes parsing the build properties,
and extracting the image files for partitions specified in the fstab.

Bug: 131911365
Test: unit tests pass, run simulator with cuttlefish, wear devices and from extracted TF.
Change-Id: Iefe4a96d619d2e4b3d038e31480f11a0f9a70afa
2019-05-31 17:55:36 -07:00
Tianjie Xu
76e165d143 Disable building simulator for mac
Disable building the simulator and its support libraries to resolve the breakage
on mac host targets. Because the simulator is not intended to use on mac anyway.

Bug: 134047992
Test: mma
Change-Id: I488ab50cab1282f03250010b5334f1895d44f98b
2019-05-30 10:49:18 -07:00
Tianjie Xu
c1a5e26fd9 Implement an update simulator to verify BB OTA packages on host
Implement the simulator runtime and build the updater simulator as a host
executable. The code to parse the target-files and mocks the block devices
will be submitted in the follow-up.

Bug: 131911365
Test: unit tests pass

Change-Id: Ib1ba939aec8333ca68a45139514d772ad7a27ad8
2019-05-28 15:18:25 -07:00
Tianjie Xu
58d59129e1 Add Updater class and remove UpdaterInfo
The UpdaterInfo class is merely a collection of pointers and POD types.
We can replace it with a Updater class that has the ownership of the
resources. This also makes this class extensible as we plan to add more
functionality in the host simulator.

Bug: 131911365
Test: unit tests pass, run an update on cuttlefish and check last_install
Change-Id: I07ca5963bbee8ae3cb85ccc184464910aa73d4e4
2019-05-08 23:07:04 -07:00
Yifan Hong
8ff84d7cfb updater: add functions to modify dynamic partition metadata
Test: sideload full OTA on cuttlefish
Test: sideload incremental OTA on cuttlefish (that grows
      system, shrinks vendor, and move vendor to group foo)
Test: verify that /cache/recovery/cc46ebfd04058569d0c6c1431c6af6c1328458e4
      exists (sha1sum of "system")

Bug: 111801737

Change-Id: Ibdf6565bc1b60f3665c01739b4c95a85f0261ae5
2019-01-14 14:01:13 -08:00
Tianjie Xu
22f11205a1 Remove otafault
Now it's less beneficial to inject I/O faults since we don't see many of
them. Remove the library that mocks I/O failures. And switch to android::base
I/O when possible.

Bug: 113032079
Test: unit tests pass
Change-Id: I9f2a92b7ba80f4da6ff9e2abc27f2680138f942c
2018-08-27 17:16:19 -07:00
Tao Bao
673bb6f051 updater: Move libupdater to Soong.
Test: mmma -j bootable/recovery
Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: I2617b87d13c585addf0ed2fbae8c3ce443ea7200
2018-08-13 09:44:48 -07:00
Tianjie Xu
69ffa15338 Add an updater function to compute hash tree
The new command is part of the transfer.list and allows us to compute the hash
tree on non-ab devices.

The required arguments for the hash_tree computation are:
  hash_tree_ranges
  source_ranges
  hash_algorithm
  salt_hex
  root_hash

Bug: 25170618
Test: unit tests pass;  run simulator with compute_hash_tree
Change-Id: I8ff0d582cc8adabb8a060db7845f38b35b28e62c
2018-08-06 12:17:50 -07:00
Tao Bao
6a7e4af7c6 updater: Add Command parsing codes.
The added codes are not used in the updater yet. The switch will happen
in subsequent CLs.

Test: Run recovery_unit_test and recovery_component_test on marlin.
Change-Id: I1ae8a233280f02c2171b43ef028bdccdacb39c59
2018-06-25 13:39:29 -07:00
Tao Bao
c3901231ce updater: Add Commmand class to manage BBOTA commands.
Move the commands map parsing out of PerformBlockImageUpdate(), as this
can be done more easily by the caller.

The goal (not done in this CL) is to decouple command parsing logic from
the performers. This allows (a) focusing on the command logic in the
performer; and (b) extending BBOTA commands syntax separately.

Test: Run recovery_unit_test and recovery_component_test.
Change-Id: Ife202398a7660b152d84a3ba17b90f93d19c55f2
2018-05-25 15:26:42 -07:00
Tao Bao
9a319f01f8 Merge libmounts into libotautil.
Export its header (mounts.h) from there, and drop the dot dot dependency
from libupdater / updater.

Test: mmma bootable/recovery
Test: recovery_component_test
Change-Id: Ic26a6b9b78a34dbe1f178b138f3abaafffbec44c
2018-04-27 21:13:57 -07:00
Tao Bao
99f0d9e52b Drop -Wno-unused-parameter.
The only one left is libedify. Will handle that in a separate CL.

Test: mmma bootable/recovery
Change-Id: I732a5f85229da90fd767bee2e46c5c95f529c396
2017-10-11 16:56:12 -07:00
Tianjie Xu
c89d1e7e2a Turn on -Wall for recovery modules
Turn on -Wall for all modules. Also remove the obsolete file_cmp() in
apply_patch test and now() in wear_ui.

The only exception is lib_edify due to the unused functions in the
intermediate cpp files generated from the lex files. It will be handled
in a seperate CL.

Bug: 64939312
Test: mma, unit tests pass
Change-Id: Ic53f76b60b6401ab20db3d98130d674c08e3702f
2017-08-28 21:56:33 -07: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
Dan Willemsen
edec27a5bd Fix updater include generation w/installclean
Since this was putting the intermediate file in obj/PACKAGING, every
installclean was removing it and triggering updater to rebuild. Instead,
use the standard generated-sources-dir. The dep file can also be removed
now that ninja will re-run the generator if the command line changes.

Test: m -j updater; m installclean; m -j updater
Test: Only change to aosp_fugu updater before/after is the debug info
Change-Id: I20928bd2049d4a3d4e21f83fd64d16cfdc541958
2017-03-21 16:46:24 -07:00
Sen Jiang
25c56979dd Use bspatch from external/bsdiff.
Now ApplyBSDiffPatch() will stream the output to sink as we go instead
of sinking everything at the end.

Test: recovery_host_test
Bug: 26982501

Change-Id: I05b6ed40d45e4b1b19ae72784cf705b731b976e3
2017-02-02 14:41:05 -08:00
Alex Deymo
7c5dbd6751 Remove '_static' suffix from libext2* references.
Bug: 34220783
Test: make checkbuild
Change-Id: Iceea20e440a4bb6a3b254486a65a86401a2241ef
2017-01-23 15:18:29 -08:00
Alex Deymo
67f3aa8804 Remove "_static" suffix from libsparse
Bug: 34220783

Change-Id: I358f931f0b29f5bd526e1475180e477e2e90b936
2017-01-11 14:38:30 -08:00
Alex Deymo
31653660ad Remove "_static" suffix from libext4_utils.
Bug: 34220783
Change-Id: I34ccc3b11da0d1b48805967ad75b9ddade569930
2017-01-11 14:02:13 -08:00
Tao Bao
bedf5fc11c updater: Refactor set_stage() and get_stage() functions.
Add read_bootloader_message_from() and write_bootloader_message_to() to
allow specifying the BCB device (/misc).

Also add testcases for set_stage() and get_stage().

Test: recovery_component_test passes.
Test: Build a recovery image and apply a two-step OTA package.
Change-Id: If5ab06a1aaaea168d2a9e5dd63c07c0a3190e4ae
2016-11-18 12:04:48 -08:00
Tianjie Xu
8cf5c8f60f Replace minzip with libziparchive
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
2016-10-17 17:41:51 -07:00
Tao Bao
0c7839ac14 Refactor libupdater into a seperate module.
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
2016-10-10 16:49:50 -07:00
Tao Bao
de40ba59c8 Update the header path for ext4_utils.
Test: `mmma bootable/recovery`
Change-Id: I70ccddb3ddf46bb012fdc5f632afc46ebdd5473e
2016-10-09 14:02:10 -07:00
Tianjie Xu
7aa88748f6 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
2016-09-29 19:21:24 -07:00
Tianjie Xu
7b0ad9c638 Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging.

Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
2016-09-01 18:33:25 +00:00
Josh Gao
073164f24b Fix references to libcrypto_utils_static.
Bug: http://b/30708454
Change-Id: I7a5048beff1d8b783a9683dcb4a79606a77f20ee
2016-08-05 18:08:03 -07:00
Elliott Hughes
63a319201f Remove obsolete MTD support.
Bug: http://b/29250988
Change-Id: Ia97ba9082a165c37f74d6e1c3f71a367adc59945
2016-06-10 13:45:35 -07:00
Mattias Nissler
452df6d99c Convert recovery to use BoringSSL instead of mincrypt.
This changes the verification code in bootable/recovery to use
BoringSSL instead of mincrypt.

Change-Id: I37b37d84b22e81c32ac180cd1240c02150ddf3a7
2016-04-06 15:54:17 +02:00
Tao Bao
d80a99883d Fix the improper use of LOCAL_WHOLE_STATIC_LIBRARIES.
If two libraries both use LOCAL_WHOLE_STATIC_LIBRARIES and include a same
library, there would be linking errors when generating a shared library
(or executable) that depends on the two libraries both.

Also clean up Android.mk files.

Remove the "LOCAL_MODULE_TAGS := eng" line for the updater module. The
module will then default to "optional" which won't be built until needed.

Change-Id: I3ec227109b8aa744b7568e7f82f575aae3fe0e6f
2016-03-03 14:52:44 -08:00
Jed Estep
a7b9a4660c IO fault injection for OTA packages
Bug: 25951086
Change-Id: I31c74c735eb7a975b7f41fe2b2eff042e5699c0c
(cherry-picked from commit f1fc48c6e6)
2016-02-10 10:49:38 -08:00
Sen Jiang
c48cb5e597 Switch from mincrypt to BoringSSL in applypatch and updater.
Bug: 18790686
Change-Id: I7d2136fb39b2266f5ae5be24819c617b08a6c21e
2016-02-04 16:27:43 +08:00
Sami Tolvanen
0a7b47397d Error correction: Use libfec in blockimg.cpp for recovery
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
2015-10-19 10:04:38 +01:00
Tao Bao
ba8a6789f7 updater: libapplypatch needs libbase now.
Change-Id: I18da9e6da64fccab495dc5a96e3efd95cc6d88bf
(cherry picked from commit 1b1ea17d55)
2015-07-24 11:09:36 -07:00
Tao Bao
ba9a42aa7e recovery: Switch applypatch/ and updater/ to cpp.
Mostly trivial changes to make cpp compiler happy.

Change-Id: I69bd1d96fcccf506007f6144faf37e11cfba1270
2015-07-13 17:21:31 -07:00
Tao Bao
80e46e08de recovery: Switch to clang
And a few trival fixes to suppress warnings.

Change-Id: I38734b5f4434643e85feab25f4807b46a45d8d65
2015-06-03 11:30:03 -07:00
Dan Albert
e49a9e527a Stop using libstdc++.
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
2015-05-19 11:33:18 -07:00
Ying Wang
cdce7f7e55 am c43b17f0: Merge "Fix recovery image build for 32p"
* commit 'c43b17f0adac1092e221ce6166ca8bc464090525':
  Fix recovery image build for 32p
2014-12-02 00:07:35 +00:00
Bruce Beare
4c3c7a962f Fix recovery image build for 32p
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
2014-11-30 19:21:19 -08:00
Michael Runge
b278c252e1 Add support for tune2fs file operations
This allows tune2fs to be executed from within OTA scripts,
allowing for file system modifications without formatting the
partition

Bug: 18430740
Change-Id: I0c2e05b5ef4a81ecea043e9b7b99b545d18fe5e6
2014-11-21 13:02:03 -08:00
Doug Zongker
5f875bf577 remove code for original block OTA mechanism
Superseded by newer code.

Bug: 16984795
Change-Id: I842299f6a02af7ccf51ef2ca174d813ca53deef1
2014-08-26 13:54:24 -07:00
Doug Zongker
bc7ffeda98 installer for new block OTA system
(Cherry-pick back from master.)

Bug: 16984795
Change-Id: Ifa3d8345c5e2a0be86fb28faa080ca82592a96b4
2014-08-19 16:53:39 -07:00
Doug Zongker
f2ff0a2097 Merge "clean up some warnings when building recovery" 2014-02-18 17:48:19 +00:00
Doug Zongker
3eb681d1de remove remaining libminelf references
Change-Id: Id38b08607829bccc031693cc03e60e849903b6f8
2014-02-13 15:49:35 -08:00
Doug Zongker
0d32f259cd clean up some warnings when building recovery
Change-Id: I1541534ee6978ddf8d548433986679ce9507d508
2014-02-13 15:34:18 -08:00
Doug Zongker
52b4036eb8 add syspatch support to updater
Add the syspatch() function, which can apply xdelta3+xz patches using
the libsyspatch library.

Change-Id: Idc1921e449020923bcaf425a1983bec0833e47ed
2014-02-13 14:15:26 -08:00