標籤:des android style blog http color io os 使用
Android原始碼使用一個可定製的編譯系統來產生 特定的,針對自己硬體平台的Android系統,比方不使用預設的out/target/prodect/generic檔案夾,
本文檔簡介了這個編譯系統,並做一個針對自己硬體平台的Android,
這部分工作主要是由Android源碼中的Vendor目錄來實現,假設該目錄不成立,
自己能夠在Android源碼的根目錄下建立該目錄,這個目錄裡面存放特定的檔案,比方自己板子上的3G驅動,WIFI驅動,
自己的應用程式,都能夠放在這裡。提取檔案系統的時候,能夠把這個目錄裡面的東東放到檔案系統裡面,這樣使用者能夠清晰的
看到你的板子特有的功能。
一、細節描寫敘述以下幾步描寫敘述了怎樣配置makefile來為執行Android的裝置編譯系統。1、在/vendor/檔案夾下建立company檔案夾mkdir vendor/<company_name>2、在company檔案夾下建立一個 products檔案夾mkdir vendor/<company_name>/products/3、建立一個裝置相關的makefile:vendor/<company_name>/products/<first_product_name>.mk這個make檔案裡至少要包括以下代碼:$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk) # # Overrides PRODUCT_NAME := <first_product_name> PRODUCT_DEVICE := <board_name>4、在產品定義檔案裡加入裝置相關的變數。5、在products檔案夾下,建立一個AndroidProducts.mk檔案,這個檔案指向裝置的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、在company檔案夾下建立一個包括特定board特徵的檔案夾,這個檔案夾須要與PRODUCT_DEVICE這個變數中的<board_name>相匹配。這個檔案夾下會包括一個make檔案,這個make檔案能夠用以下的方式訪問到,比方:mkdir vendor/<company_name>/<board_name>7、在上步的檔案夾(vendor/<company_name>/<board_name>)下,建立一個BoardConfig.mk檔案# These definitions override the defaults in config/config.make for <board_name> # # TARGET_NO_BOOTLOADER := false # TARGET_USE_GENERIC_AUDIO := true8、假設你想改動系統屬性,在檔案夾vendor/<company_name>/<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/ttyS09、在products/AndroidProducts.mk檔案裡加入一個指向<second_product_name>.mk的引用。PRODUCT_MAKEFILES := / $(LOCAL_DIR)/first_product_name.mk / $(LOCAL_DIR)/second_product_name.mk10、檔案夾vendor/<company_name>/<board_name>下必須包括一個Android.mk檔案,這個檔案裡至少包括以下的代碼: # 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/<company_name>/<board_name> # include $(CLEAR_VARS) # # include more board specific stuff here? Such as Audio parameters. #11、想為同樣的board建立第二個product時,建立一個名字為vendor/company_name/products/<second_product_name>.mk的make檔案,這個檔案裡包括:$(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>,都屬於<company_name>。驗證一下一個product是否配置正確,執行 . build/envsetup.sh make PRODUCT-<first_product_name>-user在/out/target/product/<board_name>檔案夾下,你能夠看到產生的二進位檔案。二、產品檔案樹沒有翻譯三、product定義檔案不同的產品,在它的product定義檔案裡會對一些變數賦予不同的值,product定義檔案能夠從其他product定義檔案裡繼承。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. 在這個product中要安裝的APK列表。 |
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" 屬性列表,以"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 當編譯時間,源路徑上的檔案會被拷貝到目標路徑上去,詳細的複製規則在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. 包括了項目貢獻者名字列表的HTML檔案。 |
|
PRODUCT_TAGS |
list of space-separated words for a given product |
|
以下給出了一個經典的product定義檔案$(call inherit-product, build/target/product/generic.mk)#OverridesPRODUCT_NAME := MyDevicePRODUCT_MANUFACTURER := acmePRODUCT_BRAND := acme_usPRODUCT_LOCALES := en_GB es_ES fr_FRPRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay
本部落格參考CSDN網友 http://blog.csdn.net/a345017062/archive/2010/12/24/6096807.aspx ,近期自己須要製作Vendor,很須要這種資料,在此感謝網友的部落格。
Android ----製作自己的Vendor