配置新的product(译)——android编译系统

 

转自:http://www.diybl.com/course/3_program/java/android/20110909/560268.html

http://www.kandroid.org/online-pdk/guide/release_keys.html

配置新的product

细节介绍
以下步骤描述了怎么样去为新的手机设备和其他运行android的设备配置makefile

1. 创建一个公司的目录device/vendor

mkdir    vendor/<company_name>

2. 创建一个products目录

mkdir     vendor/<company_name>/products/

3. 创建一个专门配置product的makefile,叫vendor/ <company_name>/products/<first_product_name>.mk。这个文件至少包括:

  $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk) 
  # # Overrides 
  PRODUCT_NAME := <first_product_name> 
  PRODUCT_DEVICE := <board_name>

4. 增加专门配置product的变量到上面的makefile中去(具体变量 见文章末)

5. 在product目录下创建AndroidProducts.mk,这个mk文件指明自己的product make文件:

  # # 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)/first_product_name.mk \



6. 在公司目录下创建一个专门配置Board的目录 他将包括一个makefile文件,任何使用这个板的product都可访问这个makefile

mkdir    vendor/<company_name>/<board_name>


7. 在上面创建的目录下,创建BoardConfig.mk文件

  # These definitions override the defaults in config/config.make for <board_name>
  # # TARGET_NO_BOOTLOADER := false # TARGET_HARDWARE_3D := false 
  # TARGET_USE_GENERIC_AUDIO := true

8. 如果你希望修改系统的属性,就在<board_name>目录下创建system.prop文件

# system.prop for 
# This overrides settings in the products/generic/system.prop file 
# # rild.libpath=/system/lib/libreference-ril.so 
# rild.libargs=-d /dev/ttyS0

9. 在AndroidProducts.mk中增加<second_product_name>.mk的指针

  PRODUCT_MAKEFILES := \ $(LOCAL_DIR)/first_product_name.mk\                                                                $(LOCAL_DIR)/second_product_name.mk


10. 在vendor/<company_name>/<board_name>目录下,必须包含一个Android.mk文件,这个mk文件至少包含以下内容:

  # make file for new hardware from # 
  LOCAL_PATH := $(call my-dir)

  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)
  LOCAL_PATH := vendor/<company_name>/<board_name>
  include $(CLEAR_VARS)

11. 为同一个board创建第二个product,创建第二个product-specific makefile 文件,叫做<second_product_name>.mk。这个文件包含:


$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk) # # Overrides PRODUCT_NAME := <second_product_name> PRODUCT_DEVICE := <board_name>


到现在为止,你应该有两个新的product了,叫做<first_product_name>和<second_product_name>,为了确认这个product正确配置,执行一下语句:
 
. build/envsetup.sh
make PRODUCT-<first_product_name>-user


你应该在/out/target/product/<board_name>下找到新的二进制文件







新product文件树

  • <company_name>
    • <board_name>
      • Android.mk
      • product_config.mk
      • system.prop
    • products
      • AndroidProducts.mk
      • <first_product_name>.mk
      • <second_product_name>.mk


product定义文件
ParameterDescriptionExample
PRODUCT_NAMEEnd-user-visible name for the overall product. Appears in the "About the phone" info. 
PRODUCT_MODELEnd-user-visible name for the end product 
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 is used if the locale has never been set before.en_GB de_DE es_ES fr_CA
PRODUCT_PACKAGESLists the APKs to install.Calendar Contacts
PRODUCT_DEVICEName of the industrial designdream
PRODUCT_MANUFACTURERName of the manufactureracme
PRODUCT_BRANDThe brand (e.g., carrier) the software is customized for, if any 
PRODUCT_PROPERTY_OVERRIDESList of property assignments in the format "key=value" 
PRODUCT_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_OTA_PUBLIC_KEYSList of OTA public keys for the product 
PRODUCT_POLICYIndicate which policy this product should use 
PRODUCT_PACKAGE_OVERLAYSIndicate whether to use default resources or add any product specific overlaysvendor/acme/overlay
PRODUCT_CONTRIBUTORS_FILEHTML file containing the contributors to the project. 
PRODUCT_TAGSlist of space-separated words for a given product 


下面的代码片段介绍了一个典型的product定义文件
$(call inherit-product, build/target/product/generic.mk) 
PRODUCT_NAME := MyDevice 
PRODUCT_MANUFACTURER := acme 
PRODUCT_BRAND := acme_us 
PRODUCT_LOCALES := en_GB es_ES fr_FR 
PRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值