How to overload default or device-specific Android HALs

This article explains how to overload default or device-specific Android HALs included into emteria.OS with a user-specified HAL implementation. This empowers the user to customize their devices. Additional information on how to create a custom HAL based on Androids Health HAL can be found in the Android Documentation.

Note: This currently only works on Raspberry Pi 4 based devices.

  1. Extend the cmdline.txt at the boot partition with androidboot.product.board=<product-name>

    Eg. for our Health HAL this is:

    androidboot.product.board=emteria 

    This could also be done through system properties.

  2. Create a prebuild of the HAL you want to overload with the naming scheme <HAL-name>.<product-name>.so.

    Eg. for the Health HAL we will create:

    android.hardware.health@2.1-impl-emteria.so
  3. Boot up your device.
  4. Copy the prebuild onto the odm partition.

    This can be done through adb.
    Place the prebuild under:

    /lib/hw or lib64/hw
  5. Reboot the device.
    The standard HAL should now be overloaded.