(OK) Adding a New Device - for company build and product teams only
来源:互联网 发布:海鸥手表怎么样 知乎 编辑:程序博客网 时间:2024/05/29 08:25
http://source.android.com/source/add-device.html
Use the information in this page to create the Makefiles for your device andproduct. Please note, unlike the other pages in this section,the contents hereare applicable only when creating an entirely new device type and are intendedfor company build and product teams only.
Understand Build Layers
The build hierarchy includes the abstraction layers that correspond to thephysical makeup of a device. These layers are described in the table below.Each layer relates to the one above it in a one-to-many relationship. Forexample, an architecture can have more than one board and each board can havemore than one product. You may define an element in a given layer as aspecialization of an element in the same layer, thus eliminating copying andsimplifying maintenance.
The product layer defines the feature specification of a shipping product such as the modules to build, locales supported, and the configuration for various locales. In other words, this is the name of the overall product. Product-specific variables are defined in product definition Makefiles. A product can inherit from other product definitions, which simplifies maintenance. A common method is to create a base product that contains features that apply for all products, then creating product variants based on that base product. For example, you can have two products that differ only by their radios (CDMA vs GSM) inherit from the same base product that does not define a radio.
Board/Devicesardine, trout, goldfishThe device/board layer represents the physical layer of plastic on the device (i.e. the industrial design of the device). For example, North American devices probably include QWERTY keyboards whereas devices sold in France probably include AZERTY keyboards. This layer also represents the bare schematics of a product. These include the peripherals on the board and their configuration. The names used are merely codes for different board/device configurations.Archarm, x86, mips, arm64, x86_64, mips64The architecture layer describes the processor configuration and ABI (Application Binary Interface) running on the board.Use Build Variants
When building for a particular product, it's often useful to have minorvariations on what is ultimately the final release build. In a moduledefinition, the module can specify tags withLOCAL_MODULE_TAGS
,which can be one or more values of optional
(default),debug
,eng
.
If a module doesn't specify a tag (by LOCAL_MODULE_TAGS
), itstag defaults tooptional
. An optional module is installed only ifit is required by product configuration withPRODUCT_PACKAGES
.
These are the currently-defined build variants:
eng
This is the default flavor.- Installs modules tagged with:
eng
and/ordebug
. - Installs modules according to the product definition files, in addition to tagged modules.
ro.secure=0
ro.debuggable=1
ro.kernel.android.checkjni=1
adb
is enabled by default.
user
This is the flavor intended to be the final release bits.- Installs modules tagged with
user
. - Installs modules according to the product definition files, in addition to tagged modules.
ro.secure=1
ro.debuggable=0
adb
is disabled by default.
userdebug
The same as user
, except:- Also installs modules tagged with
debug
. ro.debuggable=1
adb
is enabled by default.
Build a Product
There are many ways to organize the source files for your device. We'll brieflygo over how the Nexus 6 implementation was organized as an example, but you canorganize your source files and build the way you see fit.
Nexus 6 was implemented with a main device configuration namedshamu
. From this device configuration, a product is created with aproduct definition Makefile that declares product-specific information aboutthe device such as the name and model. You can view thedevice/moto/shamu
directory to see how all of this is setup.
Write the Makefiles
The following steps describe how to set up product Makefiles in a way similarto that of the Nexus 6 product line:
- Create a
device/<company_name>/<device_name>
directory for your product. For example,device/moto/shamu
. This directory will contain source code for your device along with the Makefiles to build them. - Create a
device.mk
Makefile that declares the files and modules needed for the device. For an example, seedevice/moto/shamu/device.mk
. - Create a product definition Makefile to create a specific product based on the device. The following Makefile is taken from
device/moto/shamu/aosp_shamu.mk
as an example. Notice the product is inheriting from thedevice/moto/shamu/device.mk
andvendor/moto/shamu/device-vendor.mk
files via the Makefile while also declaring the product-specific information such as name, brand, and model.# Inherit from the common Open Source product configuration$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)PRODUCT_NAME := aosp_shamuPRODUCT_DEVICE := shamuPRODUCT_BRAND := AndroidPRODUCT_MODEL := AOSP on ShamuPRODUCT_MANUFACTURER := motorolaPRODUCT_RESTRICT_VENDOR_FILES := true$(call inherit-product, device/moto/shamu/device.mk)$(call inherit-product-if-exists, vendor/moto/shamu/device-vendor.mk)PRODUCT_NAME := aosp_shamuPRODUCT_PACKAGES += \ Launcher3
See Product Definition Variables for additional product-specific variables you can add to your Makefiles.
- Create an
AndroidProducts.mk
file that points to the product's Makefiles. In this example, only the product definition Makefile is needed. The example below is fromdevice/moto/shamu/AndroidProducts.mk
:## This file should set PRODUCT_MAKEFILES to a list of product makefiles# to expose to the build system. LOCAL_DIR will already be set to# the directory containing this file.## This file may not rely on the value of any variable other than# LOCAL_DIR; do not use any conditionals, and do not look up the# value of any variable that isn't set in this file or in a file that# it includes.#PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/aosp_shamu.mk
- Create a
BoardConfig.mk
Makefile that contains board-specific configurations. For an example, seedevice/moto/shamu/BoardConfig.mk
. - Create a
vendorsetup.sh
file to add your product (a "lunch combo") to the build along with abuild variant separated by a dash. For example:add_lunch_combo <product_name>-userdebug
- At this point, you can create more product variants based on the same device.
Set Product Definition Variables
Product-specific variables are defined in the product's Makefile. Variables maintained in a product definition files include:
aapt
configurations to use when creating packages PRODUCT_BRANDThe brand (e.g., carrier) the software is customized for, if any PRODUCT_CHARACTERISTICSaapt
characteristics to allow adding variant-specific resources to a package.tablet,nosdcardPRODUCT_COPY_FILESList of words like source_path:destination_path
. The file at the source path should be copied to the destination path when building this product. The rules for the copy steps are defined in config/Makefile PRODUCT_DEVICEName of the industrial design. This is also the board name, and the build system uses it to locate theBoardConfig.mk.
tuna
PRODUCT_LOCALESA space-separated list of two-letter language code, two-letter country code pairs that describe several settings for the user, such as the UI language and time, date and currency formatting. The first locale listed in PRODUCT_LOCALES is used as the product's default locale.en_GB de_DE es_ES fr_CA
PRODUCT_MANUFACTURERName of the manufactureracme
PRODUCT_MODELEnd-user-visible name for the end product PRODUCT_NAMEEnd-user-visible name for the overall product. Appears in the Settings > About screen. PRODUCT_OTA_PUBLIC_KEYSList of Over the Air (OTA) public keys for the product PRODUCT_PACKAGESLists the APKs and modules to install.Calendar Contacts
PRODUCT_PACKAGE_OVERLAYSIndicate whether to use default resources or add any product specific overlaysvendor/acme/overlay
PRODUCT_PROPERTY_OVERRIDESList of system property assignments in the format "key=value" - (OK) Adding a New Device - for company build and product teams only
- Adding Support for a new MAVLink Gimbal
- Building Android for a new Mobile Device
- Adding a New Field to the Movie Model and Table
- Adding a simple io device
- telematics product and company in China
- Configuring a New Product
- Configuring a New Product
- Configuring a New Product
- Configuring a New Product
- New Blog after joining a new company!
- a build only device cannot be used to run this targe
- A build only device cannot be used to run this target.
- A build only device cannot be used to run this target.----献给新手
- ios a build only device cannot be used to run this target
- A build only device cannot be used to run this target.
- ok,do a new thing
- Generating a new SSH key and adding it to the ssh-agent
- 342_Unable to add window错误
- 简单的输入输出、一维数组、二维数组、普通遍历、使用foreach语句遍历数组操作
- SpringInAction学习笔记:Spring bean的作用域
- 阿里巴巴alisql下载
- 关于函数strtok和strtok_r的使用要点和实现原理(一)
- (OK) Adding a New Device - for company build and product teams only
- 343_加入dependencies
- Python源码剖析笔记3-Python执行原理初探
- 344_两种type的listview
- iOS中NSURLConnection、NSURLSession 常用请求(GET、POST)方法总结
- 集合中出现ConcurrentModificationException异常
- Java序列化与反序列化
- 每天一个常用的linux命令(14)--find
- JAVA从菜鸟【入门】到新手【实习】一一建站流程