Table of Contents

Motorola Common Tree

This is the core of the moto-common project. All common configuration is stored here. Let's go over each folder and file one by one in order to understand what's really happening here. Please note that the various configuration options listed below should not be modified directly in device/motorola/common but in your platform or device tree.

device/motorola/common/Android.bp

This file defines a Soong namespace in order to reduce conflicts with unrelated trees in the source tree. It also imports hardware/google/interfaces and hardware/google/pixel for libperfmgr and the USB HAL.

device/motorola/common/Android.mk

This file's purpose is also to reduce conflicts by including the subsequent Android.mk files only if PRODUCT_PLATFORM_MOT is true.

device/motorola/common/CommonConfig.mk

This is the common Board Configuration file for moto-common targets, sensible defaults are set here for platform trees to inherit. Below is a list of changes that are usually required for bringing up a new platform.

device/motorola/common/common-init.mk

This file contains statements related to init configuration scripts. Currently as of c109845e2ec185dff740ed88cc990128d85192bf this consists of vendor_modprobe.sh which is a script that loads vendor kernel modules based on the generated modules.load file. You will not find vendor_modprobe.sh in device/motorola/common as it is instead built from device/qcom/common/vendor/init.

Additionally within common-init.mk, you will also find the selectors that specify the init scripts for the different HALs of the supported fingerprint modules. This is subject to change however as the current implementation of fingerprint support is scattered and requires both the device's vendor to include the HAL itself as well as enabling the init script via the corresponding selector. It's likely that this functionality will be consolidated into vendor/motorola/fingerprint in the future.

device/motorola/common-packages.mk

This file contains the common packages required by most targets. Here A/B packages are built by default as most targets support A/B partitions and those who don't will not be impacted by their presence. Some NFC packages are also handled here, we will go over NFC support later on.

Here if TARGET_USES_DYNAMIC_PARTITIONS is set to true, the fastbootd package is built.

The common-packages.mk file also makes some assumptions about your platform/device trees.

These packages are set to be built automatically, given that they exist.

device/motorola/common/common-perm.mk

There is nothing to particularly note about this file other than that it copies a common set of permissions to all targets. If NFC support is enabled it also copies the relevant permission files as well.

device/motorola/common/common-prop.mk

This file contains the set of common properties that are applied to all targets. Among these are Audio and Bluetooth properties, as well as other configurations that pertain to dex2oat and several other system components.

device/motorola/common/common-treble.mk

common-treble.mk contains mostly all treble related packages, interfaces and configuration. Here it is ensured that all required HALs are built like android.hardware.audio.service, the camera HALs as well as many other HALs.

The following properties are configurable,

device/motorola/common/common.mk

In common.mk, you can find various configurations that are not specific to any particular target or module. These include things such as configuring the A/B OTA post-installation settings and setting up other properties based on pre-existing ones. This file also takes care of copying all files from

to $(TARGET_COPY_OUT_VENDOR) for you. In order for this to work please set those variables appropriately. For reference see here and here.

If your device supports dynamic partitions, set PRODUCT_USE_DYNAMIC_PARTITIONS to true.

device/motorola/common/proprietary-files.txt

This file contains common blobs that are used on all targets, such as the QTI Bluetooth HAL, common sensor libraries and other QTI components.

device/motorola/common/fingerprint/

As stated before in the common-init.mk section, selectors are responsible for copying modified fingerprint init scripts that have had their service definitions modified to have the vendor prefix. Those scripts are stored in this folder.

device/motorola/common/hardware/firmware,tftp

These folders contain modules which create mount point folders and symlinks required by tftp_server in /vendor. Some of these mount point folders include /vendor/firmware_mnt, /vendor/dsp and /vendor/fsg. They are used by various subsystems on all targets.

device/motorola/common/hardware/qcom

As moto-common matures, thought has been put into supporting other Motorola Devices that do not use Qualcomm SoCs. However support for those devices are in preliminary stages. Most of QCOM specific definitions and configuration is stored in this folder. This includes QCOM display,media,audio,etc HAL configuration.

device/qcom/common is also configured here in product.mk.

device/motorola/common/lights

This folder contains the Lights AIDL used in order to enable the use of the factory LED contained by most if not all Motorola Devices.

device/motorola/common/power-libperfmgr

This folder contains the Google Power AIDL based on libperfmgr. You can view the commit history for changes done vs the vanilla HAL used by Google.

device/motorola/common/rootdir