配置新的product(譯)——android編譯系統

來源:互聯網
上載者:User

 

轉自: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定義檔案

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  



下面的程式碼片段介紹了一個典型的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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.