嵌入式爱好者

RK3568安卓开启bootloader锁

2023-10-9 10:07| 发布者: mafumafu| 查看: 229| 评论: 0|原作者: cslime|来自: 看雪论坛

类目: RK3568系列产品  >  Android     文档编号: 1158

Rk3568安卓开启bootloader锁

源码路径:

frameworks/base/services/core/java/com/android/server/oemlock/OemLockService.java

排查过程:看到函数isDeviceOemUnlocked中根据ro.boot.flash.locked来判断OEM是否解锁的,rk方案是没有放出对这个值修改的UI的。

private static final String FLASH_LOCK_PROP = "ro.boot.flash.locked";

private static final String FLASH_LOCK_UNLOCKED = "0"

 

public boolean isDeviceOemUnlocked() {

    enforceOemUnlockReadPermission();

    String locked = SystemProperties.get(FLASH_LOCK_PROP);

    switch (locked) {

        case FLASH_LOCK_UNLOCKED:

            return true;

        default:

            return false;

    }

}

但是这个值会根据/system/core/init/init.cpp中的ro.boot.verifiedbootstate值被初始化。ro.boot.verifiedbootstate 代表着BootLoader的解锁状态。

static void export_oem_lock_status() {

    if (!android::base::GetBoolProperty("ro.oem_unlock_supported", false)) {

        return;

    }

    SetProperty(

            "ro.boot.flash.locked",

            android::base::GetProperty("ro.boot.verifiedbootstate", "") == "orange" ? "0" : "1");

}

 

K·ernel command line parameter

Description

androidboot.verifiedbootstate=green

Device has booted into GREEN boot state. Boot partition has been verified using the OEM key and it’s valid.

androidboot.verifiedbootstate=yellow

Device has booted into YELLOW boot state. Boot partition has been verified using the certificate embedded into the signature and it’s valid.

androidboot.verifiedbootstate=orange

Device has booted into ORANGE boot state.<br/>The device is unlocked and no verification has been performed.

根据这个描述我们可以看出只要androidboot.verifiedbootstate=green即可。但因为ro.boot.verifiedbootstate的值是根据kernel/proc/cmdline中的androidboot.verifiedbootstate值传递过来的因此,在源码中是找不到ro.boot.verifiedbootstate的值的初始化赋值的,因此修改如下:

修改路径:device/rockchip/common/BoardConfig.mk

解决方法:把/proc/cmdline 中的变量androidboot.verifiedbootstate=orange 改为 androidboot.verifiedbootstate=green即可。

diff --git a/rockchip/common/BoardConfig.mk b/rockchip/common/BoardConfig.mk

index d642ffd..76ee364 100755

--- a/rockchip/common/BoardConfig.mk

+++ b/rockchip/common/BoardConfig.mk

@@ -86,7 +86,7 @@ endif

 ifeq ($(BOARD_AVB_ENABLE), true)

 BOARD_KERNEL_CMDLINE := androidboot.wificountrycode=CN androidboot.hardware=rk30board androidboot.console=ttyFIQ0 firmware_class.path=/vendor/etc/firmware init=/init rootwait ro init=/init

 else # BOARD_AVB_ENABLE is false

-BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.baseband=N/A androidboot.wificountrycode=CN androidboot.veritymode=enforcing androidboot.hardware=rk30board androidboot.console=ttyFIQ0 androidboot.verifiedbootstate=orange firmware_class.path=/vendor/etc/firmware init=/init rootwait ro

+BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.baseband=N/A androidboot.wificountrycode=CN androidboot.veritymode=enforcing androidboot.hardware=rk30board androidboot.console=ttyFIQ0 androidboot.verifiedbootstate=yellow firmware_class.path=/vendor/etc/firmware init=/init rootwait ro

 endif # BOARD_AVB_ENABLE

 

 BOARD_KERNEL_CMDLINE += loop.max_part=7

diff --git a/rockchip/common/BoardConfig_AB.mk b/rockchip/common/BoardConfig_AB.mk

index 113d6b6..b923301 100755

--- a/rockchip/common/BoardConfig_AB.mk

+++ b/rockchip/common/BoardConfig_AB.mk

@@ -75,7 +75,7 @@ endif

 ifeq ($(strip $(BOARD_AVB_ENABLE)), true)

     BOARD_KERNEL_CMDLINE := androidboot.wificountrycode=CN androidboot.hardware=rk30board androidboot.console=ttyFIQ0 firmware_class.path=/vendor/etc/firmware init=/init rootwait ro init=/init

 else

-    BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.baseband=N/A androidboot.wificountrycode=CN androidboot.veritymode=enforcing androidboot.hardware=rk30board androidboot.console=ttyFIQ0 androidboot.verifiedbootstate=orange firmware_class.path=/vendor/etc/firmware init=/init rootwait ro init=/init

+    BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.baseband=N/A androidboot.wificountrycode=CN androidboot.veritymode=enforcing androidboot.hardware=rk30board androidboot.console=ttyFIQ0 androidboot.verifiedbootstate=yellow firmware_class.path=/vendor/etc/firmware init=/init rootwait ro init=/init

 endif

 ifneq ($(strip $(BOARD_SELINUX_ENFORCING)), true)

     BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive

diff --git a/rockchip/rk356x/ok3568_r/bootanimation.zip b/rockchip/rk356x/ok3568_r/bootanimation.zip

old mode 100755

new mode 100644

index 04fc7c5..b133a7e

Binary files a/rockchip/rk356x/ok3568_r/bootanimation.zip and b/rockchip/rk356x/ok3568_r/bootanimation.zip differ



已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-11-25 11:06

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部