推扬网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
推扬网 门户 你问我答 查看内容

齐建军:Android编译版本eng,user和userdebug的区别

2020-8-12 15:33| 发布者: admin| 查看: 113| 评论: 0

摘要: 惠可的回答: 要了解Android编译选项eng、user和userdebug的区别,需先了解下LOCAL_MODULE_TAGS这一Android.mk文件里的配置项,一般配置形式为LOCAL_MODULE_TAGS := user eng optional test这个样子。 那么LOCAL_MOD ...

惠可的回答:

要了解Android编译选项eng、user和userdebug的区别,需先了解下LOCAL_MODULE_TAGS这一Android.mk文件里的配置项,一般配置形式为LOCAL_MODULE_TAGS := user eng optional test这个样子。 那么LOCAL_MODULE_TAGS设置为不同值有何作用呢?下面是对应不同值编译的结果: 1、user:只有在user版本时该模块才被编译进去; 2、eng:只有在eng版本时该模块才被编译进去; 3、test:只有在tests版本时该模块才被编译进去; 4、optional:在所有版本中都编译该模块进去。 其中的值可设置为1个或多个,分别对应编译选项的同一个或多个。那么eng、user、userdebug的区别是什么呢?接下来一一揭开: 1、当make eng时,也即相当于make。此时BuildType为eng,那么其编译进去的内容包括: · Intended for platform-level debugging · Installs modules tagged with: eng, debug, user, and/or development · Installs non-APK modules that have no tags specified · Installs APKs according to the product definition files, in addition to tagged APKs · Sets ro.secure=1 · Sets ro.debuggable=0 · Sets ro.kernel.android.checkjni=1 · adbd is enabled by default 2、当make user时,此时BuildType为user,那么其编译进去的内容包括: · Intended to be the final release · Installs modules tagged as user · Installs non-APK modules that have no tags specified · Installs APKs according to the product definition files (tags are ignored for APK modules) · Sets ro.secure=1 · Sets ro.debuggable=0 · adbd is disabled by default 3、当make userdebug时,此时BuildType为userdebug,那么其编译进去的内容包括: the same as user, except: · Intended for limited debugging · Installs modules tagged with debug · Sets ro.debuggable=1 · adbd is enabled by default

海浪!的回答:

android编译版本eng、user和userdebug的区别: 一、android官网的解释 eng this is the default flavor. a plain make is the same as make eng. * installs modules tagged with: eng, debug, user, and/or development. * installs non-apk modules that have no tags specified. * installs apks according to the product definition files, in addition to tagged apks. * ro.secure=0 * ro.debuggable=1 * ro.kernel.android.checkjni=1 * adb is enabled by default. * setupwizard is optional user make user this is the flavor intended to be the final release bits. * installs modules tagged with user. * installs non-apk modules that have no tags specified. * installs apks according to the product definition files; tags are ignored for apk modules. * ro.secure=1 * ro.debuggable=0 * adb is disabled by default. * enable dex pre-optimization for all target projects in default to speed up device first boot-up userdebug make userdebug the same as user, except: * also installs modules tagged with debug. * ro.debuggable=1 * adb is enabled by default. 二、对编译版本mtk的补充说明 mtk 补充说明差异:( (1) debug/log 方面,原则上user 版本只能抓到有限的资讯,eng 可以抓到更多的资讯,debug 能力更强,推崇使用eng 版本开发测试 * 因user/eng 版本设置ro.secure不同,导致user 版本adb 只拥有shell 权限,而eng 版本具有root 权限 * mtk system log 在ics 以后,在user 版本默认关闭全部log, 在eng 版本中默认打开,以便抓到完整的资讯 * 在eng 版本上,log 量 >= user 版本的log 量,一些地方会直接check eng/user 版本来确认是否打印log * user 版本默认关闭uart, eng 版本默认开启uart * 在eng 版本上,开启anr 的predump, 会抓取ftrace,可以得到更多anr的资讯 * 在eng 版本上,可用rtt 抓取backtrace,可开启kdb 进行kernel debug, 可用ftrace 抓取cpu 执行场景 * mtk aee 在eng 版本抓取更多的异常资讯,比如native exception 会抓取core dump 信息 (2) 性能方面,原则上进行性能测试请使用user 版本测试 * user 版本为提高第一次开机速度,使用了dvm 的预优化,将dex 文件分解成可直接load 运行的odex 文件,eng 版本不会开启这项优化 * 更少的log 打印,uart 的关闭,原则上user 版本的性能要优于eng 版本 (3) 如何确认user/eng 版本 * java 层,check android.os.build 类中的type 值 * native 层,property_get("ro.build.type", char* value, "eng"); 然后check value 值 * debug 时, adb shell getprop ro.build.type 返回值如果是user 即user 版本,eng 即eng 版本 * log 确认, mobile log/aplog_xxxxx/versions 中查看ro.build.type 属性 (4) 如何编译user/eng 版本 * 默认编译是eng 版本,如果需要编译user 版本,请加入参数 -o=target_build_variant=user 如: ./mk -o=target_build_variant=user mt6577_phone new default.prop和/system/build.prop 三、编译版本与adb、root的控制关系 1. root权限:adb.c中与属性ro.kernel.qemu(是否是模拟器)、ro.secure、ro.debuggable、service.adb.root几个相关联。 service.adb.root : services.c -> restart_root_service()中设置 build/core/main.mk的如下地方决定了了ro.secure和ro.debuggable的值 user_variant := $(filter user userdebug,$(target_build_variant)) enable_target_debugging := true tags_to_install := ifneq (,$(user_variant)) # target is secure in user builds. additional_default_properties += ro.secure=1 ... else # !user_variant # turn on checkjni for non-user builds. additional_build_properties += ro.kernel.android.checkjni=1 # set device insecure for non-user builds. additional_default_properties += ro.secure=0 # allow mock locations by default for non user builds additional_default_properties += ro.allow.mock.location=1 endif # !user_variant ifeq (true,$(strip $(enable_target_debugging))) # target is more debuggable and adbd is on by default additional_default_properties += ro.debuggable=1 # include the debugging/testing ota keys in this build. include_test_ota_keys := true else # !enable_target_debugging # target is less debuggable and adbd is off by default additional_default_properties += ro.debuggable=0 endif # !enable_target_debugging ## eng ## ... endif 2. 是否开启adbd服务:usbdevicemanager.java中与属性persist.sys.usb.config、sys.usb.config、persist.service.adb.enable几个相关联 persist.sys.usb.config:/build/tools/post_process_props.py中根据ro.debuggable来设置persist.sys.usb.config的初始值 sys.usb.config:usbdevicemanager.java -> setusbconfig 文件init.clippers.usb.rc中监听了sys.usb.config属性变化时的动作 on property:sys.usb.config=adb


鲜花

握手

雷人

路过

鸡蛋

最新评论

热门推荐
最新资讯

广告服务|投稿要求|禁言标准|版权说明|免责声明|手机版|小黑屋|推扬网 ( 粤ICP备18134897号 )|网站地图 | 邮箱:vayae@hotmail.com

GMT+8, 2025-5-1 23:50 , Processed in 0.091643 second(s), 28 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

返回顶部