Android ----制作自己的Vendor
Android源代碼使用一個(gè)可定制的編譯系統(tǒng)來(lái)生成 特定的,針對(duì)自己硬件平臺(tái)的Android系統(tǒng),比方不使用缺省的out/target/prodect/generic文件夾, 本文檔簡(jiǎn)介了這個(gè)編譯系統(tǒng),并做一個(gè)針對(duì)自己硬件平臺(tái)的Android, 這部分工作主要是由Android源碼中的Vendor目錄來(lái)實(shí)現(xiàn),假設(shè)該目錄不成立, 自己能夠在Android源碼的根目錄下建立該目錄,這個(gè)目錄里面存放特定的文件,比方自己板子上的3G驅(qū)動(dòng),WIFI驅(qū)動(dòng), 自己的應(yīng)用程序,都能夠放在這里。提取文件系統(tǒng)的時(shí)候,能夠把這個(gè)目錄里面的東東放到文件系統(tǒng)里面,這樣用戶能夠清晰的 看到你的板子特有的功能。
?
一、細(xì)節(jié)描寫(xiě)敘述 以下幾步描寫(xiě)敘述了怎樣配置makefile來(lái)為執(zhí)行Android的設(shè)備編譯系統(tǒng)。 1、在/vendor/文件夾下創(chuàng)建company文件夾 mkdir vendor/<company_name> 2、在company文件夾下創(chuàng)建一個(gè)?products文件夾 mkdir vendor/<company_name>/products/ 3、創(chuàng)建一個(gè)設(shè)備相關(guān)的makefile:vendor/<company_name>/products/<first_product_name>.mk這個(gè)make文件里至少要包括以下代碼: $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)## OverridesPRODUCT_NAME := <first_product_name>PRODUCT_DEVICE := <board_name> 4、在產(chǎn)品定義文件里加入設(shè)備相關(guān)的變量。 5、在products文件夾下,創(chuàng)建一個(gè)AndroidProducts.mk文件,這個(gè)文件指向設(shè)備的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文件夾下創(chuàng)建一個(gè)包括特定board特征的文件夾,這個(gè)文件夾須要與PRODUCT_DEVICE這個(gè)變量中的<board_name>相匹配。這個(gè)文件夾下會(huì)包括一個(gè)make文件,這個(gè)make文件能夠用以下的方式訪問(wèn)到,比方: mkdir vendor/<company_name>/<board_name> 7、在上步的文件夾(vendor/<company_name>/<board_name>)下,創(chuàng)建一個(gè)BoardConfig.mk文件 # These definitions override the defaults in config/config.make for <board_name>## TARGET_NO_BOOTLOADER := false#TARGET_USE_GENERIC_AUDIO := true 8、假設(shè)你想改動(dòng)系統(tǒng)屬性,在文件夾vendor/<company_name>/<board_name>下創(chuàng)建一個(gè)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、在products/AndroidProducts.mk文件里加入一個(gè)指向<second_product_name>.mk的引用。PRODUCT_MAKEFILES := /$(LOCAL_DIR)/first_product_name.mk /$(LOCAL_DIR)/second_product_name.mk 10、文件夾vendor/<company_name>/<board_name>下必須包括一個(gè)Android.mk文件,這個(gè)文件里至少包括以下的代碼:# make file for new hardware from #LOCAL_PATH := $(call my-dir)## this is here to use the pre-built kernelifeq ($(TARGET_PREBUILT_KERNEL),)TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernelendif#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創(chuàng)建第二個(gè)product時(shí),創(chuàng)建一個(gè)名字為vendor/company_name/products/<second_product_name>.mk的make文件,這個(gè)文件里包括: $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)## OverridesPRODUCT_NAME := <second_product_name>PRODUCT_DEVICE := <board_name> 眼下為止,你已經(jīng)有了兩個(gè)新product,<first_product_name>和<second_product_name>,都屬于<company_name>。 驗(yàn)證一下一個(gè)product是否配置正確,執(zhí)行. build/envsetup.shmake PRODUCT-<first_product_name>-user 在/out/target/product/<board_name>文件夾下,你能夠看到生成的二進(jìn)制文件。二、產(chǎn)品文件樹(shù) 沒(méi)有翻譯三、product定義文件 不同的產(chǎn)品,在它的product定義文件里會(huì)對(duì)一些變量賦予不同的值,product定義文件能夠從其他product定義文件里繼承。 Product定義文件里包括的變量例如以下:?
| 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. 地區(qū)標(biāo)識(shí) | en_GB de_DE es_ES fr_CA |
| PRODUCT_PACKAGES | Lists the APKs to install. 在這個(gè)product中要安裝的APK列表。 | Calendar Contacts |
| PRODUCT_DEVICE | Name of the industrial design 生產(chǎn)商的名字 | dream |
| PRODUCT_MANUFACTURER | Name of the manufacturer 制造商的名字 | acme |
| PRODUCT_BRAND | The brand (e.g., carrier) the software is customized for, if any 軟件定制后的分支標(biāo)識(shí)。 | ? |
| 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 當(dāng)編譯時(shí),源路徑上的文件會(huì)被拷貝到目標(biāo)路徑上去,詳細(xì)的復(fù)制規(guī)則在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. 包括了項(xiàng)目貢獻(xiàn)者名字列表的HTML文件。 | ? |
| PRODUCT_TAGS | list of space-separated words for a given product | ? |
?
?
?
本博客參考CSDN網(wǎng)友 http://blog.csdn.net/a345017062/archive/2010/12/24/6096807.aspx ,近期自己須要制作Vendor,很須要這種資料,在此感謝網(wǎng)友的博客。轉(zhuǎn)載于:https://www.cnblogs.com/mfrbuaa/p/4370969.html
總結(jié)
以上是生活随笔為你收集整理的Android ----制作自己的Vendor的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Taylor Swift - Red
- 下一篇: Monkey原理初步和改良优化--And