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 likesource_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,很须要这种资料,在此感谢网友的博客。

更多相关文章

  1. APK文件粗略介绍
  2. android的样式(style)与主题(theme)
  3. android 7.0 使用apktool反编译apk
  4. Android热补丁动态修复技术(四):完善框架①
  5. Android自定义AlertDialog实现
  6. Android(安卓)NDK开发中引入OpenCV库
  7. android 应用程序自适应屏幕大小
  8. 自定义Android(cacerts.bks)添加根证书
  9. Android开发学习笔记:我的第一个Android程序--HelloWorld

随机推荐

  1. linux下lftp命令中mirror的用法详解
  2. script学习,如何用linux监控你的同事?
  3. Linux系统中使用fdisk命令为U盘分区,并将
  4. Linux内核分析-9/进程的调度时机
  5. LNMP(Linux+Nginx+Mysql+PHP)环境下安装yaf
  6. linux常用的命令
  7. Linux CentOS 配置Tomcat环境
  8. Linux 上samba服务的配置
  9. Linux基础知识总结
  10. linux环境下写C++操作mysql(二)