Android USER 版本与ENG 版本的差异--MTK官方解释

http://blog.csdn.net/hunanwy/article/details/9200673

[Description]
Android USER 版本与ENG 版本的差异
 
[Keyword]
USER ENG user eng 用户版本 工程版本 差异
 
[Solution]
Google 官方描述: USER/USERDEBUG/ENG 版本的差异, 参考alps/build/core/build-system.html 的详细说明
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 补充说明差异:(
(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
===========================
===========================
http://www.2cto.com/kf/201312/264152.html
Android 如何永久性开启adb 的root权限
adb 的root 权限是在system/core/adb/adb.c 中控制。主要根据ro.secure 以及 ro.debuggable 等system property 来控制。默认即档ro.secure 为0 时,即开启root 权限,为1时再根据ro.debuggable 等选项来确认是否可以用开启root 权限。为此如果要永久性开启adb 的root 权限,有两种修改的方式:
1. 修改system property ro.secure, 让ro.secure=0。
2. 修改adb.c 中开启root 权限的判断逻辑。 下面详细说明这两种修改方式:
第一种方法. 修改system property ro.secure, 让ro.secure=0。
(1)修改alps/build/core/main.mk
ifneq (,$(user_variant))
# Target is secure in user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 将ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 改成 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 (2)在android JB 版本(4.1) 以后,google 从编译上直接去除了adbd 的user 版本root 权限, 为此您要修改system/core/adb/ Android.mk 中的编译选项ALLOW_ADBD_ROOT, 如果没有打开这个选项,那么adb.c 中将不会根据ro.secure 去选择root 还是shell 权限,直接返回shell 权限。因此您必须需要Android.mk 中的第126行:
ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
===> ifneq (,$(filter userdebug user eng,$(TARGET_BUILD_VARIANT)))
第二种方法. 修改adb.c 中开启root 权限的判断逻辑。这里针对4.1 以后版本 和4.1以前版本有所区别。
(1).如果是JB 4.1 以后版本,直接修改函数should_drop_privileges() 函数, 清空这个函数,直接返回 0 即可。返回0 即开启root 权限。 (2).如果是JB 4.1 以前版本,直接修改函数adb_main 函数,在
/* don't listen on a port (default 5037) if running in secure mode */
/* don't run as root if we are running in secure mode */
if (secure) {
struct __user_cap_header_struct header;
struct __user_cap_data_struct cap; if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0) {
exit(1);
}

在这段代码前加一行: secure = 0; //mtk71029 add for root forever. /* don't listen on a port (default 5037) if running in secure mode */
/* don't run as root if we are running in secure mode */
if (secure) {
struct __user_cap_header_struct header;
struct __user_cap_data_struct cap; if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) != 0) {
exit(1);
}

[测试与确认]
当修改完成后,只需要重新build bootimage ,然后download 即可,然后到setting 中开启debug 选项,adb 连接后,会显示 #, 即root 成功。 如果贵司没有拿到adb 的source, 而贵司又需要自己修改adb 的话, 那么就麻烦贵司提交eService。由我司进一步协助贵司处理。
[相关FAQ]
JB 版本后user build + eng bootimage 无法开机
如何打开user debug选项
JB 4.2 user 版本的开发选项不见了,如何打开adb debug
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值