ro.boot.verifiedbootstate 为 orange

问题现象

adb shell getprop ro.boot.verifiedbootstate 返回值为 orange

期望返回值为green

与测试沟通后,得到的反馈是测试用例中要求的检查项。

问题分析

1,对此属性不了解,因此在代码中搜寻关键字以确认所述功能块,检索关键字“ro.boot.verifiedbootstate”所得结果仅两条, 得到两条信息:
(1)在export_oem_lock_status中被调用,说明,和oem lock有关;
(2)从搜索的两条结果均为GetProperty的调用,哪里赋值green才能符合期望值呢;

2,精简检索关键字“verifiedbootstate”,检索结果多了一些,7条,从中可以看到和verified-boot有关,尤其是verified-boot.jd中的信息,其中介绍了返回值的具体意义

Kernel command line parameterDescription
androidboot.verifiedbootstate=greenDevice has booted into GREEN boot state.
Boot partition has been verified using the OEM key and it’s valid.
androidboot.verifiedbootstate=yellowDevice has booted into YELLOW boot state.
Boot partition has been verified using the certificate embedded into the signature and it’s valid.
androidboot.verifiedbootstate=orangeDevice has booted into ORANGE boot state.
The device is unlocked and no verification has been performed.

Note: The device cannot boot into kernel when in the RED boot state, and therefore the kernel command line never includes the parameter androidboot.verifiedbootstate=red.

至此,我们知道了可能和oem lock有关,接下来验证推测

3,找同型号测试机下载相同软件尝试复现
下载后软件后,我的测试机得到的结果如下

adb shell getprop ro.boot.verifiedbootstate
green

adb shell getprop ro.boot.flash.locked                                        
1

adb shell getprop ro.boot.veritymode                                          
enforcing

再执行adb reboot bootloader进入fastboot模式,
然后执行sudo fastboot oem device-info检查device信息
得到如下结果

(bootloader)    Device tampered: false
(bootloader)    Device unlocked: false
(bootloader)    Device critical unlocked: false
(bootloader)    Charger screen enabled: false
(bootloader)    Display panel: 
OKAY [  0.007s]
finished. total time: 0.007s

证明当前我的测试机是符合要求,verified boot打开,lock状态正确

4,验证unlock的情况
先power on 测试机,在开发者选项中打开菜单允许执行oem unlock
之后执行adb reboot bootloader进入fastboot模式
再执行sudo fastboot oem unlock 进行解锁

备注:如果执行提示错误,按提示换用sudo fastboot oem unlock-go

之后再次按上述方法检查各项值,结果如

adb shell getprop ro.boot.verifiedbootstate
orange

adb shell getprop ro.boot.flash.locked                                        
0

adb shell getprop ro.boot.veritymode                                          
enforcing

//执行sudo fastboot oem device-info命令的结果
(bootloader)    Device tampered: false
(bootloader)    Device unlocked: true
(bootloader)    Device critical unlocked: false
(bootloader)    Charger screen enabled: false
(bootloader)    Display panel: 
OKAY [  0.007s]
finished. total time: 0.007s

可以看到Device unlocked: true时和测试手中的测试机ro.boot.verifiedbootstate 为 orange是对应的。

证明测试手中的测试机应是为单独更新image做过oem unlock操作,同时,此unlock操作即使更新版本也无法恢复。

解决方法

将此手机重新lock

adb reboot bootloader
sudo fastboot oem lock

其他知识

移步下方链接,详细了解一下何谓Veified Boot吧 :)
https://lwn.net/Articles/638627/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值