Configuring a New Product

Configuring a New Product

Detailed Instructions

The steps below describe how to configure makefiles for new mobile devices and products running Android.

  1. Create a company directory in //vendor/.
      mkdir vendor/
         
         
  2. Create a products directory beneath the company directory you created in step 1.
      mkdir vendor/
         
         
          
          /products/
         
         
  3. Create a product-specific makefile, called vendor/ /products/ .mk , that includes at least the following code:
      $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
      #
      # Overrides
      PRODUCT_NAME := 
         
         
          
          
      PRODUCT_DEVICE := 
          
          
         
         
  4. Additional product-specific variables can be added to this Product Definition file.
  5. In the products directory, create an AndroidProducts.mk file that point to (and is responsible for finding) the individual product make files.
      #
      # 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. Create a board-specific directory beneath your company directory that matches the PRODUCT_DEVICE variable referenced in the product-specific make file above. This will include a make file that gets accessed by any product using this board.
      mkdir vendor/
         
         
          
          /
          
          
         
         
  7. Create a BoardConfig.mk file in the directory created in the previous step (vendor/ / ).
      # These definitions override the defaults in config/config.make for 
         
         
          
          
      #
      # TARGET_NO_BOOTLOADER := false
      #
      TARGET_USE_GENERIC_AUDIO := true
         
         
  8. If you wish to modify system properties, create a system.prop file in your directory(vendor/ / ).
      # 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. Add a pointer to .mk within products/AndroidProducts.mk.
      PRODUCT_MAKEFILES := /
        $(LOCAL_DIR)/first_product_name.mk /
        $(LOCAL_DIR)/second_product_name.mk
  10. An Android.mk file must be included in vendor/ / with at least the following code:
      # make file for new hardware 
         
         
          
           from 
          
          
           
           
      #
      LOCAL_PATH := $(call my-dir)
      #
      # this is here to use the pre-built kernel
      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)
      #
      # no boot loader, so we don't need any of that stuff..  
      #
      LOCAL_PATH := vendor/
           
           
            
            /
            
            
             
             
      #
      include $(CLEAR_VARS)
      #
      # include more board specific stuff here? Such as Audio parameters.      
      #
            
            
           
           
          
          
         
         
  11. To create a second product for the same board, create a second product-specific make file called vendor/company_name/products/ .mk that includes:
      $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
      #
      # Overrides
      PRODUCT_NAME := 
         
         
          
          
      PRODUCT_DEVICE := 
          
          
         
         

By now, you should have two new products, called and associated with . To verify that a product is properly configured ( , for example), execute the following:

  . build/envsetup.sh
  make PRODUCT-
   
   
    
    -user
   
   

You should find new build binaries located in /out/target/product/ .

New Product File Tree

The file tree below illustrates what your own system should look like after completing the steps above.

      • Android.mk
      • product_config.mk
      • system.prop
    • products
      • AndroidProducts.mk
      • .mk
      • .mk

Product Definition Files

Product-specific variables are defined in product definition files. A product definition file can inherit from other product definition files, thus reducing the need to copy and simplifying maintenance.

Variables maintained in a product definition files include:

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 

The snippet below illustrates a typical product definition file.

$(call inherit-product, build/target/product/generic.mk)

#Overrides
PRODUCT_NAME := MyDevice
PRODUCT_MANUFACTURER := acme
PRODUCT_BRAND := acme_us
PRODUCT_LOCALES := en_GB es_ES fr_FR
PRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay
↑ Go to top
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值