SDV enables A/B updates for the custom /oem_ab partition. Use the OEM AB
Updater library to trigger and to roll back updates for the custom /oem_ab
partition, with similar capabilities to Android system A/B updates.
See the sample code for an OEM AB Updater library implementation in
system/software_defined_vehicle/samples/oem_partition_update_client.
The guide describes how to use the OEM AB Updater library and integrate it with your own Updater Service implementation. This guide assumes you are using Cuttlefish to build and test your changes.
Library location
The OEM AB Updater library is in the
system/software_defined_vehicle/platform/oem directory.
Build required custom images
The OEM AB Updater library requires custom slot and metadata partition images, which are built automatically when you build the SDV Core Cuttlefish target:
On Android 17 QPR2 and higher:
device/google/sdv/sdv_core_base/oem_ab/Android.bpdefines two separate non-sparse 64 MiB slot images (oem_ab_a.imgandoem_ab_b.img) and a 1 MiB metadata image (oem_ab_metadata.img):source build/envsetup.sh lunch aosp_cf_x86_64_sdv_core-aosp_current-userdebug mOn Android 17:
device/google/sdv/sdv_core_base/oem_ab/Android.bpdefines the 64 MiBoem_ab.imgand 1 MiBoem_ab_metadata.imgpartition images (registered inBOARD_CUSTOMIMAGES_PARTITION_LISTbyoem_ab.mkandoem_ab_metadata.mk):source build/envsetup.sh lunch sdv_core_cf-aosp_current-userdebug m
Specify custom block devices
Verify that your Cuttlefish lunch target sets BOARD_BOOTCONFIG to map the
block devices to the corresponding bootconfig properties:
BOARD_BOOTCONFIG += \
androidboot.sdv.oem_slot_a_device=/dev/block/by-name/custom \
androidboot.sdv.oem_slot_b_device=/dev/block/by-name/custom_1
Start a new VM
After verifying that the block devices are mapped, create a new VM with the three custom partition images:
On Android 17 QPR2 and higher:
cvd create --custom_partition_path="$OUT/oem_ab_a.img;$OUT/oem_ab_b.img;$OUT/oem_ab_metadata.img"On Android 17:
cvd create --custom_partition_path="$OUT/oem_ab.img;$OUT/oem_ab.img;$OUT/oem_ab_metadata.img"
Use the OEM AB Updater library in a new service
To use the library in another service:
Import the
sdv_oem_updater::OemUpdatercrate as demonstrated insystem/software_defined_vehicle/samples/oem_partition_update_client/(oem_partition_update_client.rs).Create a new
.tepolicy similar to the SELinux policies defined indevice/google/sdv/sdv_core_base/oem_ab/sepolicy/oem_ab_update/private/(oem_partition_client.te) on Android 17 QPR2 and higher, ordevice/google/sdv/sdv_core_cf/sepolicy/product/private/(oem_partition_client.te) on Android 17.