User Tools

Site Tools


moto-common:device_motorola_targets

Motorola Common Targets Depot

Adding a new device or new ROM

When adding support for a new device in the targets depot, all you need to do is create the folder devices/CODENAME and run

./scripts/update_rom_device_symlinks.sh

When adding support for a new ROM in the targets depot, see below in the “How It Works” section to see how ROM makefiles are made. After you've made your ROM makefile, run

./scripts/update_rom_device_symlinks.sh

How it works

In all moto-common device trees, AndroidProducts.mk sets the PRODUCT_MAKEFILES variable to

$(wildcard device/motorola/targets/devices/CODENAME/*.mk)

This parses all makefiles in device/motorola/targets/devices/CODENAME/ as a product makefile. These product makefiles are generated from ROM makefiles in rom/ by update_rom_device_symlinks.sh.

Let's look at a ROM makefile, lineage.mk to be specific.

# Copyright 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Common
include device/motorola/targets/include/common.mk

# Inherit some common Lineage stuff.
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)

# Kernel
$(call inherit-product, device/motorola/targets/include/kernel/source.mk)

# Libhidl
PLATFORM_PROVIDES_LIBHIDL := true

# Required Scripts
$(warning This ROM requires replace_camera_sepolicy.sh to be ran...)

PRODUCT_NAME := lineage_$(DEVICE)

As you can see, the ROM makefiles are pretty bare, these makefiles should only contain what is necessary for a given ROM.

For LineageOS, common_full_phone.mk is inherited and since LineageOS provides libhidl in their manifest by default, that is also specified here. The required scripts section informs the builder about scripts that are necessary to be ran in order to build a given ROM, typically these scripts are stored in device/motorola/targets/scripts. Lastly, PRODUCT_NAME is defined here as the device codename with the prefix a given ROM requires.

moto-common/device_motorola_targets.txt · Last modified: 2023/06/05 20:24 by electimon