Android ----制作自己的Vendor

来源:互联网 发布:上班自动签到软件 编辑:程序博客网 时间:2024/06/01 08:25
http://www.embedu.org/Column/index.htm
 http://hi.baidu.com/xxw8393/blog/item/dfb302ed9720364278f055fe.html
http://www.kandroid.org/online-pdk/guide/index.html
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 := true
 
8、如果你想修改系统属性,在目录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/ttyS0
 
9、在products/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文件,这个文件中至少包含下面的代码: # 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
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 win10你的账户已被停用怎么办 电脑一键还原后一直黑屏怎么办? 被打了狂犬疫苗的狗咬伤怎么办 美版苹果7系统坏了怎么办 韩服的球球大作战网络不稳定怎么办 球球大作战号删了找不回来怎么办 队友传足球球的时候接不到怎么办 魅族手机中病毒锁机了怎么办? vbs打开是和文本文档一样怎么办 把电脑注册表删了电脑动不了怎么办 注册表删一项后电脑启动不了怎么办 解压过的过的软件安装包损坏怎么办 手机中病毒自动发短信扣费怎么办 苹果手机中的高德地图打不开怎么办 大晚上挂了别人的车怎么办 手机不兼容高版本微信怎么办 绝地求生右下角小地图变大了怎么办 杯孕当月做了C丁怎么办 玩全军出击手机发烫就出现卡怎么办 不小心买了彩虹六号肝帝版本怎么办 微信游戏刺激战场电脑卡怎么办 电脑更新了以前的东西都没了怎么办 安装黑苹果鼠标键盘不能用怎么办 苹果开机卡在白底黑苹果怎么办 信长之野望14没有剧情触发怎么办 玩cf手游手机屏幕摩擦力大怎么办 网吧有战地1没有橘子平台怎么办 俩人打仗了对方想讹我怎么办 环世界模组装多了打不开怎么办 手机百度云视频播放画面太小怎么办 ps文件说数据似乎已经损坏怎么办 百度云中的压缩包下载的很慢怎么办 游戏压缩出现未知错误或损坏怎么办 百度云里的压缩包解压后损坏怎么办 联创打印时显示压缩文件失败怎么办 电脑的软件打开出现未知格式怎么办 图片只突出人物边上全黑怎么办 合金机兵存档密码忘了怎么办 手机网页验证码无法加载插件怎么办 绝地求生次激战场机型不支持怎么办 木茷生存中文版安装包损坏了怎么办