I am an Android system engineer and currently need to modify the system on the Android 11 of the rk3568 platform. I have received feedback from customers that several devices cannot enter the system and are stuck in the boot animation interface. The analysis results show that this is because the file /data/misc/vold/user_keys/ce/0/current/keymaster_key_blob has been deleted. I want to ensure that this file is not deleted by modifying the permissions. I tried to modify the following code and then compile and flash the device, but it didn’t work. What should I do? Thank you
code:
/device/rockchip/rk356x$ git df AndroidProducts.mk
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index f8a1e06..67bd2a9 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -36,4 +36,8 @@ COMMON_LUNCH_CHOICES :=
rk3566_einkw6-userdebug
rk3566_einkw6-user
+#evan add
+# device/rockchip/rk356x/rk3568_r/AndroidProducts.mk
+
+PRODUCT_PACKAGES += evan_init
device/rockchip/rk356x$ git df BoardConfig.mk
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 96ad890..0a87db7 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -110,8 +110,8 @@ BOARD_SHOW_HDMI_SETTING ?= true
# for dynamaic afbc target
BOARD_HS_DYNAMIC_AFBC_TARGET := false
-
-PRODUCT_HAVE_OPTEE := true
+# evan set false for can't enter system for keymaster_key_blob
+PRODUCT_HAVE_OPTEE := false
#trust is merging into uboot
BOARD_ROCKCHIP_TRUST_MERGE_TO_UBOOT := true
device/rockchip/rk356x$ git df init.rk356x.rc
diff --git a/init.rk356x.rc b/init.rk356x.rc
index 7d3f564..fee54c5 100644
--- a/init.rk356x.rc
+++ b/init.rk356x.rc
@@ -8,6 +8,15 @@ on property:sys.boot_completed=1
chmod 0664 /sys/class/devfreq/ff400000.gpu/max_freq
write /sys/devices/system/cpu/cpufreq/policy0/interactive/target_loads 65
+ # evan add
+ start evan_init
+
+#evan add
+service evan_init /system/bin/evan_init
+ class main
+ user root
+ group root
+ oneshot
on boot
chown system system /sys/class/thermal/thermal_zone0/policy
@@ -22,6 +31,8 @@ on boot
# reduce schedul time to improve io performance
write /sys/kernel/debug/sched_features NO_ENERGY_AWARE
+ # evan add
+ class_start default
on init
# Increased power consumption and CPU in exchange for memory
devicerockchiprk356xrk3566_revan_initmain.cpp
// device/rockchip/rk356x/rk3568_r/can_init/main.cpp
#include <iostream>
#include <sys/stat.h>
#include <cstdlib>
int main() {
std::cout << "xwg nt test-----" << std::endl;
// 修改 keymaster_key_blob 文件权限为 0444
const char* filePath = "/data/misc/vold/user_keys/ce/0/current/keymaster_key_blob";
mode_t mode = 0444;
if (chmod(filePath, mode) != 0) {
std::cerr << "Failed to chmod " << filePath << std::endl;
return 1;
}
return 0;
}
Z:sky-8200devicerockchiprk356xrk3566_revan_initAndroid.mk
# device/rockchip/rk356x/rk3568_r/can_init/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := evan_init
LOCAL_SRC_FILES := main.cpp
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := EXECUTABLE
LOCAL_MODULE_PATH := $(TARGET_OUT_EXECUTABLES)
include $(BUILD_EXECUTABLE)
`
build the code with order blow:
`#!/bin/bash
# 获取开始时间
startTime=$(date +%s)
# 执行编译
echo "请稍候,系统即将编译中……n"
source build/envsetup.sh
lunch rk3568_r-userdebug
#make clean
make installclean
rm -rf out/target/product/rk3568_r/obj/APPS/
rm -rf out/target/product/rk3568_r/system*
#mmm packages/apps/RKUpdateService/
#mmm external/e2fsprogs/misc/
#make dtboimage 2>&1 | tee build_evan.log
./build.sh -UKAu 2>&1 | tee build_evan.log`
yhm yhm is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.