android system setup and building (2)
Configuring a New Product
http://source.android.com/porting/build_new_device.htmlDetailed Instructions
下面步骤描述怎样为一个新的移动设备及产品使用makefiles配置Android运行系统。
1.在//vendor/目录下创建一个公司目录.
mkdirvendor/<company_name>2.在上面创建的公司目录下(beneath)创建产品(products)目录
3.创建特定产品的makefile。命名为vendor/<company_name>/products/<first_product_name>.mk。这个文件至少要包含如下代码:
#
#Overrides
PRODUCT_NAME:=<first_product_name>
PRODUCT_DEVICE:=<board_name>
4.另外一些特定产品的变量定义可以添加到这个产品定义(Product Definition:下面有详细说明)文件(3中说的)。
5.在products目录,创建一个AndroidProducts.mk文件,这个文件用来指定(and is responsible for finding)一个特定的产品make 文件(也就是3中的文件)
#ThisfileshouldsetPRODUCT_MAKEFILEStoalistofproductmakefiles
#toexposetothebuildsystem.LOCAL_DIRwillalreadybesetto
#thedirectorycontainingthisfile.
#
#Thisfilemaynotrelyonthevalueofanyvariableotherthan
#LOCAL_DIR;donotuseanyconditionals,anddonotlookupthe
#valueofanyvariablethatisn'tsetinthisfileorinafilethat
#itincludes.
#
PRODUCT_MAKEFILES:=\
$(LOCAL_DIR)/first_product_name.mk\
6.在公司名目录下创建一个特定板级目录,此目录名必须与3中特定产品的makefile 中PRODUCTV_DEVICE变量值<board_name>相同。这个目录下将包括一个makefile文件会被用到此板的产品使用。
7.在上面(vendor/<company_name>/<board_name>)的目录下创建BoardConfig.mk文件:
#
#TARGET_NO_BOOTLOADER:=false
#
TARGET_USE_GENERIC_AUDIO:=true
8.如果你想更改系统属性(properties),就在<board_name>
目录(6中建立的目录)下创建system.prop文件。
#Thisoverridessettingsintheproducts/generic/system.propfile
#
#rild.libpath=/system/lib/libreference-ril.so
#rild.libargs=-d/dev/ttyS0
9.在products/AndroidProducts.mk
文件中添加一个<second_product_name>.mk指针
$(LOCAL_DIR)/first_product_name.mk\
$(LOCAL_DIR)/second_product_name.mk
10.在vendor/<company_name>/<board_name>
目录下必须创建一个Android.mk文件,此文件至少应该包含如下内容:
#
LOCAL_PATH:=$(callmy-dir)
#
#thisisheretousethepre-builtkernel
ifeq($(TARGET_PREBUILT_KERNEL),)
TARGET_PREBUILT_KERNEL:=$(LOCAL_PATH)/kernel
endif
#
file:=$(INSTALLED_KERNEL_TARGET)
ALL_PREBUILT+=$(file)
$(file):$(TARGET_PREBUILT_KERNEL)|$(ACP)
$(transform-prebuilt-to-target)
#
#nobootloader,sowedon'tneedanyofthatstuff..
#
LOCAL_PATH:=vendor/<company_name>/<board_name>
#
include$(CLEAR_VARS)
#
#includemoreboardspecificstuffhere?SuchasAudioparameters.
#
11.在同样的板上创建第二个产品,这第二个特定产品的make file文件命名为vendor/company_name/products/<second_product_name>.mk
包括如下内容:
#
#Overrides
PRODUCT_NAME:=<second_product_name>
PRODUCT_DEVICE:=<board_name>
这样你就有两个产品,也就是与<company_name>相关的被命名为<first_product_name>和<second_product_name>。可执行如下命令来验证产品已经被很好的配置(以<first_product_name>为例):
makePRODUCT-<first_product_name>-user
然后就会在/out/target/product/<board_name>目录下生成新编译出的二进制文件
New Product File Tree
<company_name>
<board_name>
Android.mk
product_config.mk
system.prop
products
AndroidProducts.mk
<first_product_name>.mk
<second_product_name>.mk
Product Definition Files
产品特定的变量被定义在产品说明文件(definition files)中。产品说明文件可以继承自其它的产品说明文件。这样将便于管理(thus reducing the need to copy and simplifying maintenance)。
产品说明文件中可以包含如下变量:
Parameter | Description | Example |
---|---|---|
PRODUCT_NAME | End-user-visible name for the overall product. Appears in the "About the phone" info. | |
PRODUCT_MODEL | End-user-visible name for the end product | |
PRODUCT_LOCALES | A 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 is used if the locale has never been set before. | en_GB de_DE es_ES fr_CA |
PRODUCT_PACKAGES | Lists the APKs to install. | Calendar Contacts |
PRODUCT_DEVICE | Name of the industrial design | dream |
PRODUCT_MANUFACTURER | Name of the manufacturer | acme |
PRODUCT_BRAND | The brand (e.g., carrier) the software is customized for, if any | |
PRODUCT_PROPERTY_OVERRIDES | List of property assignments in the format "key=value" | |
PRODUCT_COPY_FILES | List 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_OTA_PUBLIC_KEYS | List of OTA public keys for the product | |
PRODUCT_POLICY | Indicate which policy this product should use | |
PRODUCT_PACKAGE_OVERLAYS | Indicate whether to use default resources or add any product specific overlays | vendor/acme/overlay |
PRODUCT_CONTRIBUTORS_FILE | HTML file containing the contributors to the project. | |
PRODUCT_TAGS | list of space-separated words for a given product |
典型产品说明文件如下:
#Overrides
PRODUCT_NAME: = MyDevice
PRODUCT_MANUFACTUER: = acme
PRODUCT_BRAND: = acme_us
PRODUCT_LOCALES: = en_GBes_ESfr_FR
PRODUCT_PACKAGE_OVERLAYS: = vendor / acme / overlay
。。。。
更多相关文章
- android 在新建短信时,加入名称为","(英文逗号)的联系人时,应用崩
- android 快速移动sdCard的文件夹
- Android之SharedPreferences详解
- Android(安卓)Studio module里面放switch语句报错 R文件找不到
- Android(安卓)Databinding(一)
- Android(安卓)开发笔记之界面开发
- Android设备的识别
- Android(安卓)使用level-list改变对应的状态图片
- NPM 和webpack 的基础使用