If no opeartions is to be executed on a partition, it is
possible that no snapshot is created for it. In that case,
don't crash when initalizing snapshots.
Test: libsnapshot_test
Change-Id: I7bb0b5596aa6e4eca319e9c88f6552d1907a6944
A single number is not enough to represent the ranges
that needs to be snapshotted in the target partition. For
prototyping now, just use device_size instead.
Add test in PartitionCowCreatorTest to ensure that this
doesn't regress. Also fix some trivial tests.
In follow-up CLs, snapshot ranges should be represented
with a more complicated structure. See b/141889746.
Bug: 141889746
Test: libsnapshot_test
Change-Id: I1a508c2464abce216ad4049cc2533ffdaa8cd14f
Remove the extra folder of vts_core for vts_core_liblp_test and
vts_libdm_test since we have a better auto-gen option of auto_gen_config.
Bug: 141684102
Test: 1. m -j vts_core_liblp_test
2. m -j vts_libdm_test
3. check out/.../vts_core_liblp_test.config
and
out/.../vts_libdm_test.config
Change-Id: Ibcdf96104205b50b3da522364199330ad0190c70
This function is too big. Refactor it a bit.
- Reorder checks / variable initializations a bit.
They are independent of each other, so they can be
safely reordered.
- Put snapshot creation and initialization to their own
functions so that CreateUpdateSnapshots looks shorter.
Test: libsnapshot_test
Change-Id: I135b415d8e046dd91d31326fe7962ae44be4ccf8
At the second update for Virtual A/B device,
PartitionCowCreator thinks the COW partitions in
the existing super metadata as occupied. In fact, these
partitions aren't used after the merge.
Now, unmap these partitions from the device mapper. If
something bad happens and the previous update has not been
merged yet, the unmap will fail. Then, delete these old
COW partitions from the device.
Test: Virtual A/B update twice
Bug: 135752105
Change-Id: Iab867ded19755089e6e0800e553a10fbcddbb931
- Add TestDeviceInfo(string, string) to avoid holding
the 'rebooted' TestDeviceInfo variable after ownership is
transferred
- OTA client calls BeginUpdate after unmapping partitions.
Test: run libsnapshot_test
Change-Id: Id37e34b421d728eb320c0e0906abef3b61897e7c
Add a new SnapshotTestPropertyFetcher that sets up
good defaults for all test cases in libsnapshot_test.
Test: run libsnapshot_test
Change-Id: I6e0b31872d604bbd5f15b64ab7a8ea56d7c67405
Add libdm_test to vts-core suite and skip the test if the
first-api-level < 29.
Bug: 132702215
Test: atest vts_libdm_test
Change-Id: Ic805a4c08e5bf9f6c69019d4ea01825ae888e1fe
... which handles merge when boot completed. It also
dumps debug information when requested.
Bug: 135752105
Test: adb shell su 0 snapshotctl dump
Test: call snapshotctl merge at different stage of OTA:
- before OTA (exit normally)
- during OTA is applied (exit with error)
- after OTA is applied but before reboot (exit with error)
- after reboot (finish merge and exit normally)
- Manually stop its execution during merge and run again
(finish merge and exit normally)
Change-Id: Idcc6aea8d7bbeb9a1a288c966b8f5e14b3f6a3e7
Add vts_core_liblp_test to vts-core suite and skip the test if the
first-api-level < 29.
Bug: 132702215
Test: atest vts_core_liblp_test
Change-Id: I09ea8ff923b5300bae513146f6d07dc029d36661
There might be partitions like product or system_ext in addition
to the system partition. Those partitions can contain dependencies
required by the system so we need to make the init to recognize
these partitions and mount them accordingly.
Bug: 140092208
Test: gsi_tool install & reboot
Change-Id: Ie5ef063292c3656e79cce9f887f23a8faa1ba2be
This commit constructs the super_vbmeta image to eliminate the
need of adding /vbmeta_system and/or /vbmeta_vendor when AVB
chain partition is used with Android Dynamic Partition.
See BOARD_AVB_VBMETA_SYSTEM under the link:
https://android.googlesource.com/platform/external/avb/#build-system-integration
The structure of super_vbmeta :
| VBMeta Table | (fixed-length 2KiB)
| Backup VBMeta Table | (fixed-length 2KiB)
| VBMeta Images | (fixed-length 64KiB each)
The structure of VBMeta Table :
| Super VBMeta Header | (fixed-length 128B)
| VBMeta Descriptors | (variable-length)
The VBMeta Table records the slot number of each
vbmeta image within the /super_vbmeta partition.
Bug: 137054296
Test: m libvbmeta_test
Test: ./out/host/linux-x86/nativetest/libvbmeta_test/libvbmeta_test
Change-Id: I01aeadd850750ae87d9125484c1b1f570bb84756
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: I5f0b9acfb57f68570f6f58f2395f2bb1bc015365
DeltaArchiveManifest includes full update package metadata.
Now, CreateUpdateSnapshot reads the source
metadata, updates it, and write to target metadata slot as well.
Test: libsnapshot_test
Bug: 140868231
Change-Id: Ia885b336145d02111ecff1aad421cb9b1efd18c2
This class knows how to update super metadata for virtual A/B devices.
Test: libsnapshot_test
Bug: 138816109
Change-Id: I9e375c76814e0dcbb47fc2ea9e4903ba69ccf7f8
We already know 'existing_extent' is non-null (or else we would
have crashed on the previous line). We fix this to check
'existing_linear_extent' against nullptr.
Test: TreeHugger
Change-Id: I03338bca87d1c2bd0cbea0e1ec31244ba9570a40
...so that it can be used by other tests.
Also, clean up the code before exposing it.
Test: libsnapshot_test
Test: liblp_test
Change-Id: I627326f696ea55b7113ff26b313f7dd04e341dc1
Skip importing COW group because they are dynamically
created by OTA clients and will never show up in built
images.
Test: flash
Change-Id: I44e7693cfb4c15e64455b56212a02f9abde88d61
With overlayfs enabled, the scratch partition takes up
super partition, causing retrofit devices to create COW
images.
Test: OTA on retrofit device, no COW images created.
Change-Id: I35a1a2d02c8acf9efc33965c7e015f960bf45296
The super partition usually has some empty space even after
the target partitions are created, especially for retrofit
Virtual A/B devices. Use that empty space for COW before taking
up userdata space.
- PartitionCowCreator computes free regions in super partition metadata
and use that space until it is used up. It returns a pair of numbers
(cow_partition_size, cow_file_size) and let SnapshotManager to create
the partition / images with proper sizes.
- A region is considered free iff it is used by NEITHER target NOR
source partitions
- The list is in PartitionCowCreator's return value so that
SnapshotManager can use it as a guide when creating partitions.
- These partitions are created under the group named "cow".
- Avoid mapping COW partitions directly during init first stage
mount. Init only maps them when they are needed by the top-level
device.
- CreateCowImage no longer zero-fills the first 4 bytes of the image.
(See below)
- CreateUpdatePartitions: after creating the snapshot, also maps the COW
devices (via MapCowDevices()) and zero-fills the first 4 bytes of the
top-level COW device.
- Add a new SnapshotManager::MapCowDevices() function, which maps both
the COW partition (in super) and the COW image (through
IImageManager) (if necessary). Then, create a dm-linear target that
concatenates them (if necessary).
- Add a new SnapshotManager::UnmapCowDevices() functions that does the
reverse MapCowDevices().
- DeleteSnapshot also unmaps the top-level COW device and COW partition
before unmapping the COW images (before deleting them).
Test: libsnapshot_test
Change-Id: I0098b7e842ab48b0b4dd2a59142098b098d23d34
Add CreateCowForUpdate / MapSnapshotDevicesForUpdate
that update_engine and init can call them directly.
Bug: 134536978
Test: libsnapshot_test
Change-Id: If53c48855931db27454fd2893745915c77fd37f8
It has too many arguments.
Also fixed CreateLogicalPartitionParams::InitDefaults because
it doesn't use the provided partition opener to read metadata
(which breaks tests).
Test: libsnapshot_test
Test: liblp_test
Change-Id: I74cf8d468274f741c6f3743438fe8855b2aef15b