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.
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.
This file's purpose is also to reduce conflicts by including the subsequent Android.mk files only if PRODUCT_PLATFORM_MOT is true.
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.
TARGET_NO_RECOVERY
is set to false
and should be set to true
if required in either the platform or device tree.SOONG_CONFIG_MOTO_COMMON_USB_USB_CONTROLLER_NAME
should be set to the name of the usb controller of your platform, for lower end Qualcomm SoCs this is usually 4e00000
and is the default, another common value is a600000
.SOONG_CONFIG_MOTO_COMMON_POWER_FB_IDLE_PATH
should be set to the path of the idle_state sysfs node for your platform. The default value for this is /sys/devices/platform/soc/5e00000.qcom,mdss_mdp/idle_state
.BOARD_USE_ENFORCING_SELINUX
to false
in your platform tree if you wish to develop the SEPolicies further into development.TARGET_USES_FINGERPRINT_V2_1
to false in order to exclude the VINTF fragment for android.hardware.biometrics.fingerprint@2.1::IBiometricsFingerprint/default
.BOARD_USES_DTBO
to false
.BOARD_KERNEL_IMAGE_NAME
is set to Image.gz-dtb
by default, you may want to change this in your platform tree.BOARD_BOOT_HEADER_VERSION
is set to 2
. This will allow you quickly get to a working system without fiddling with vendor_boot.
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.
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.
$(DEVICE)FrameworksOverlay
$(DEVICE)SettingsOverlay
$(DEVICE)SystemUIOverlay
PlatformFrameworksOverlay
PlatformFrameworksOverlay
PlatformFrameworksOverlay
These packages are set to be built automatically, given that they exist.
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.
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.
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,
TARGET_USES_64BIT_CAMERA
should be set to false
if your device uses a 32bit camera HAL, since the majority of devices supported by moto-common use a 64bit camera HAL, it is set to true
by default.TARGET_USES_PN5XX_PN8X_NFC
, TARGET_USES_SN1XX_NFC
and TARGET_USES_ST_NFC
are properties you can set if your device contains a PN5XX/PN8X, SN1XX, or ST NFC chip.PRODUCT_USES_PIXEL_POWER_HAL
to true
.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
$(COMMON_PATH)/rootdir/vendor
$(DEVICE_PATH)/vendor
$(PLATFORM_COMMON_PATH)/rootdir/vendor
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
.
This file contains common blobs that are used on all targets, such as the QTI Bluetooth HAL, common sensor libraries and other QTI components.
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.
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.
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.
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.
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.