本文介绍RK3566/RK3568开发板Android11系统,编译ROOT权限固件的方法。触觉智能Purple Pi OH鸿蒙开发板演示,搭载了瑞芯微RK3566四核处理器,Laval鸿蒙社区推荐开发板,已适配全新OpenHarmony5.0 Release系统,SDK源码全开放!
关闭Selinux
修改以下路径文件:
adevice/rockchip/common/BoardConfig.mk修改代码如下:BOARD_BOOT_HEADER_VERSION ?= 2注意:"+"号为修改内容。注释用户组权限检测修改以下路径文件:
BOARD_MKBOOTIMG_ARGS :=
BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_DEVICE_DIR)/dtbo.img
BOARD_ROCKCHIP_VIRTUAL_AB_ENABLE ?= false
-BOARD_SELINUX_ENFORCING ?= true
+BOARD_SELINUX_ENFORCING ?= false
system/extras/su/su.cpp
修改代码如下:
void extract_uidgids(const char* uidgids, uid_t* uid, gid_t*
gid, gid_t* gids, i
}
int main(int argc, char** argv) {
- uid_t current_uid = getuid();
- if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "notallowed");
+ //uid_t current_uid = getuid();
+ //if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "notallowed");
注意:"+"号为修改内容。
system/core/libcutils/fs_config.cpp
修改代码如下:
static const struct fs_path_config android_files[] = {修改以下路径文件:
// the following two files are INTENTIONALLY set-uid, but they
// are NOT included on user builds.{ 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/procmem" },
- { 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
+ { 06755, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
修改代码如下:
static void DropCapabilitiesBoundingSet(fail_fn_t fail_fn) {修改以下路径文件:
+/*
for (int i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0; i++) {;
if (prctl(PR_CAPBSET_DROP, i, 0, 0, 0) == -1) {
if (errno == EINVAL) {
ALOGE("prctl(PR_CAPBSET_DROP) failed with EINVAL. Please verify
"your kernel is compiled with file capabilities support"); } else {
fail_fn(CREATE_ERROR("prctl(PR_CAPBSET_DROP, %d) failed: %s", i, strerror(errno)));
}
}
}
+ */
}
kernel/security/commoncap.c
修改代码如下:
int cap_task_setnice(struct task_struct *p, int nice)注意:"+"号为修改内容。
static int cap_prctl_drop(unsigned long cap){
struct cred *new;
+/*
if (!ns_capable(current_user_ns(), CAP_SETPCAP))
return -EPERM;
if (!cap_valid(cap))
return -EINVAL;-+*/
new = prepare_creds();
# make -j4下载Root Checker(ROOT检查工具),通过ADB命令或者U盘安装后,打开按照提示点击按钮检测ROOT,如图:
请点击输入图片描述(最多18字)
作者: Industio_触觉智能, 来源:面包板社区
链接: https://mbb.eet-china.com/blog/uid-me-4098392.html
版权声明:本文为博主原创,未经本人允许,禁止转载!
文章评论(0条评论)
登录后参与讨论