本文介紹RK3566/RK3568開(kāi)發(fā)板Android11系統(tǒng),編譯ROOT權(quán)限固件的方法。觸覺(jué)智能Purple Pi OH鴻蒙開(kāi)發(fā)板演示,搭載了瑞芯微RK3566四核處理器,Laval鴻蒙社區(qū)推薦開(kāi)發(fā)板,已適配全新OpenHarmony5.0 Release系統(tǒng),SDK源碼全開(kāi)放!
關(guān)閉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
注意:"+"號(hào)為修改內(nèi)容。
注釋用戶組權(quán)限檢測(cè)
修改以下路徑文件:
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");
注意:"+"號(hào)為修改內(nèi)容。
?給su文件默認(rèn)授予root權(quán)限
修改以下路徑文件:
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();
注意:"+"號(hào)為修改內(nèi)容。
源碼編譯并測(cè)試
修改完上面三個(gè)步驟的文件后,即可在源碼根目錄下編譯安卓源碼:
# make -j4
下載Root Checker(ROOT檢查工具),通過(guò)ADB命令或者U盤(pán)安裝后,打開(kāi)按照提示點(diǎn)擊按鈕檢測(cè)ROOT,如圖:
若ROOT成功則如圖所示:
-
開(kāi)發(fā)板
+關(guān)注
關(guān)注
25文章
5032瀏覽量
97371 -
瑞芯微
+關(guān)注
關(guān)注
23文章
414瀏覽量
51298 -
root工具
+關(guān)注
關(guān)注
0文章
2瀏覽量
5039 -
RK3568
+關(guān)注
關(guān)注
4文章
514瀏覽量
5031 -
RK3566
+關(guān)注
關(guān)注
0文章
145瀏覽量
4824
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論