OEM AB partition updates

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.bp defines two separate non-sparse 64 MiB slot images (oem_ab_a.img and oem_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
    m
    
  • On Android 17: device/google/sdv/sdv_core_base/oem_ab/Android.bp defines the 64 MiB oem_ab.img and 1 MiB oem_ab_metadata.img partition images (registered in BOARD_CUSTOMIMAGES_PARTITION_LIST by oem_ab.mk and oem_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:

  1. Import the sdv_oem_updater::OemUpdater crate as demonstrated in system/software_defined_vehicle/samples/oem_partition_update_client/ (oem_partition_update_client.rs).

  2. Create a new .te policy similar to the SELinux policies defined in device/google/sdv/sdv_core_base/oem_ab/sepolicy/oem_ab_update/private/ (oem_partition_client.te) on Android 17 QPR2 and higher, or device/google/sdv/sdv_core_cf/sepolicy/product/private/ (oem_partition_client.te) on Android 17.