summaryrefslogtreecommitdiff
path: root/common/boot_control_interface.h
Commit message (Collapse)AuthorAgeFilesLines
* BootControl: is slot marked successfulYifan Hong2020-03-051-0/+3
| | | | | | | | Test: update_engine_unittests Bug: 147696014 Change-Id: I316efda7a0936e2dee0f766efb5c18ff30790274 Merged-In: I316efda7a0936e2dee0f766efb5c18ff30790274
* Remove BootControlInterface::CleanupYifan Hong2019-11-131-3/+0
| | | | | | | | | It is just a wrapper around GetDynamicPartitionControl()->Cleanup(). Delete it and let callers call it instead. Test: update_engine_unittests Change-Id: I068228a43dac122828c28bbc49a0f6f77e5b6ff2
* Remove BootControlInterface::PreparePartitionsForUpdateYifan Hong2019-11-131-11/+4
| | | | | | | | Replace with GetDynamicPartitionControl()->PreparePartitionsForUpdate( GetCurrentSlot(), ...). Test: update_engine_unittests Change-Id: Ib03ee97a25727a9292cbb0c9aab5dbe75a2b6913
* BootControl exposes DynamicPartitionControl.Yifan Hong2019-11-131-0/+4
| | | | | | | | | | | | | | | | | | | | Add BootControlInterface::GetDynamicPartitionControl, which exposes the internal DynamicPartitionControlInterface object. BootControlStub / FakeBootControl / BootControlChromeOS uses DynamicPartitionControlStub (all functions succeeds). BootControlAndroid uses DynamicPartitionControlAndroid. GetPartitionDevice is exposed so that BootControlAndroid can use it. Follow-up CLs delete duplicated PreparePartitionsForUpdate and Cleanup from BootControlInterface so that BootControlAndroid remains a thin wrapper of the HAL (+GetPartitionDevice, which exists before dynamic partitions.) Test: update_engine_unittests Change-Id: Ifc2aa2ee8a63ef581c8ebc562ec158794ac51dfd
* [REFACTOR] Pass DeltaArchiveManifest to DynamicPartitionControlYifan Hong2019-09-231-21/+9
| | | | | | | | | | | | | | DynamicPartitionControl need the list of operations to calculate COW sizes. - Remove BootControlInterface::PartitionMetadata. Replace all references with DeltaArchiveManifest. DeltaArchiveManifest has all information that PartitionMetadata has. - Rename all InitPartitionMetadata to PreparePartitionsForUpdate - Change all PreparePartitionsForUpdate to use new signature Bug: 138816109 Test: update_enigne_unittests --gtest_filter=*BootControl*:*Dynamic* Change-Id: I4389ba2b1801addf8c3bc8395e2ea6a9a3ed27a0
* Call InitPartitionMetadata when resuming an update.Tao Bao2019-01-041-8/+10
| | | | | | | | | | | | | BootControlAndroid::InitPartitionMetadata() should always be called when starting / resuming an update that uses dynamic partitions. This allows updating the metadata for the target slot, as well as setting up the internal state for accessing the dynamic partitions in the target slot. Bug: 122097567 Test: Run update_engine_unittests on taimen and blueline. Test: Apply a payload that uses dynamic partitions. Reboot before it finishes, then resume the update. Change-Id: I1353f7460a61c0183654b6349689beaa9bf12129
* Support updateable groups.Yifan Hong2018-10-261-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds updateable group support to OTA. * DeltaPerformer combines partition sizes with dynamic_partition_metadata to BootControlInterface::PartitionMetadata. * BootControlAndroid::InitPartitionMetadata: * Copy all groups / partitions from source metadata slot * Remove all groups / partitions mentioned in the manifest (of the target slot) * Re-add all groups / partitions mentioned in the manifest. * BootControlAndroid::InitPartitionMetadata can check the incoming PartitionMetadata to see if a partition is dynamic or not. The guessing logic is completely removed. * Because a partition is removed then re-added, there is no need for preserving the entry with size 0 to indicate that a partition is removed. When update_engine sees a partition in a group "foo" on the device, but manifest contains group "foo" without the partition, it removes the partition. * Hence, Removing a partition does NOT require keeping the entry (i.e. RemovePartition is used instead of ShrinkPartition(0) ). This makes retrofitting dynamic partitions on older devices easier. The following is now allowed: - Adding / removing / resizing partitions - Adding / resizing groups It is not allowed to remove a group, but a group can always be resized to zero to deprecate it. Test: update_engine_unittests Bug: 117182932 Change-Id: I39d77f1d1d1fc52fc245f3de699635e6a429015e
* PartitionSizes -> PartitionMetadataYifan Hong2018-10-261-4/+4
| | | | | | | | | In a following CL, InitPartiitonMetadata not only takes sizes but also group of each partition. Rename the struct to a more generic name. Test: builds Change-Id: Ie8a7e58b0cccc45e533de368e24f5a73d556de65
* update_engine resize dynamic partitions during OTA.Yifan Hong2018-09-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | update_engine uses device mapper to resize dynamic partitions before opening the devices to apply the update. * DeltaPerformer calls BootControlInterface::InitPartitionMetadata when parsing the update manifest. The implementation for BootControlAndroid::InitPartitionMetadata does the following if sizes for dynamic partitions are incorrect (assuming updating from slot A to B): * Load metadata from metadata slot A * Delete all extents of partitions at slot B (with _b suffix) * Add extents for partitions at slot B * Write metadata to metadata slot B * Re-map all partitions at slot B using metadata slot B with force_writable = true * BootControlAndroid::GetPartitionDevice() checks device-mapper before returning static partitions. * PostinstallRunnerAction::Cleanup calls BootControlInterface::Cleanup which unmaps all partitions at slot B. A partition "foo" is considered dynamic if foo_a exists as a dynamic partition OR foo_b does NOT exist as a static partition. Bug: 110717529 Test: manual ota Test: update_engine_unittests --gtest_filter=*BootControlAndroid* Change-Id: I50f410b486a874242663624801c3694151bdda18
* Split payload application code into a subdirectory.Alex Deymo2015-11-121-0/+98
This patch splits from the main libupdate_engine code the part that is strictly used to download and apply a payload into a new static library, moving the code to subdirectories. The new library is divided in two subdirectories: common/ and payload_consumer/, and should not depend on other update_engine files outside those two subdirectories. The main difference between those two is that the common/ tools are more generic and not tied to the payload consumer process, but otherwise they are both compiled together. There are still dependencies from the new libpayload_consumer library into the main directory files and DBus generated files. Those will be addressed in follow up CLs. Bug: 25197634 Test: FEATURES=test emerge-link update_engine; `mm` on Brillo. Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23