EDA365电子论坛网

标题: 瑞芯微RK3566/RK3568开发板安卓11固件ROOT教程,Purple Pi OH演示 [打印本页]

作者: 深圳触觉科技    时间: 2024-12-5 10:27
标题: 瑞芯微RK3566/RK3568开发板安卓11固件ROOT教程,Purple Pi OH演示
本文介绍RK3566/RK3568开发板Android11系统,编译ROOT权限固件的方法。触觉智能Purple Pi OH鸿蒙开发板演示,搭载了瑞芯微RK3566四核处理器,Laval鸿蒙社区推荐开发板,已适配全新OpenHarmony5.0 Release系统,SDK源码全开放!
4 e; N1 V' D7 c; s
关闭Selinux
  f7 [8 j. S- X9 V, M
修改以下路径文件:
adevice/rockchip/common/BoardConfig.mk
* T/ }  F' t9 t& X
修改代码如下:
  w; y: [* U0 H
BOARD_BOOT_HEADER_VERSION ?= 2
3 F* ]! e  ]& Q+ FBOARD_MKBOOTIMG_ARGS :=9 X$ o: o) W& Y% ~. Q
BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_DEVICE_DIR)/dtbo.img! M8 l7 }! e; N9 a2 J5 [, E
BOARD_ROCKCHIP_VIRTUAL_AB_ENABLE ?= false$ f8 m( I! r/ d" [* [, e; p+ I
-BOARD_SELINUX_ENFORCING ?= true
% X8 z( z/ w- z; s* |& X/ O4 V+BOARD_SELINUX_ENFORCING ?= false
& _& A/ g  `( B! g( f8 Y3 F/ k( O
注意:"+"号为修改内容。
, W6 ]+ t7 l' j. I0 Y0 y; _7 h
注释用户组权限检测修改以下路径文件:system/extras/su/su.cpp
修改代码如下:
void extract_uidgids(const char* uidgids, uid_t* uid, gid_t*0 h. U( a, t2 x5 y- ]
gid, gid_t* gids, i
- C* t# O  d% `' ~3 q; G}
; G& }; y, N1 zint main(int argc, char** argv) {
- [1 X  W0 H5 V* [3 C+ O& A% s$ X2 J" j5 m- uid_t current_uid = getuid();$ H4 f4 D3 w6 p+ s4 o9 V( y
- if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "notallowed");
/ a& I) I% J) }+ //uid_t current_uid = getuid();
2 T' W; Y/ g4 ]9 p$ _+ //if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "notallowed");3 Y0 u+ S( U5 [1 N
注意:"+"号为修改内容。
, x/ h, I1 K# k. [8 I
​给su文件默认授予root权限修改以下路径文件:system/core/libcutils/fs_config.cpp
修改代码如下:

' b& y9 r$ y$ A8 @5 s6 n2 Lstatic const struct fs_path_config android_files[] = {9 G5 y) e% S4 e. K2 p
// the following two files are INTENTIONALLY set-uid, but they
2 t: R- a8 `" [+ E* ~// are NOT included on user builds.{ 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/procmem" },  Y6 T+ q' `* L
- { 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },' x. J- ^+ Q! y
+ { 06755, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },1 y) {# D. t; g& M) B, q  U
修改以下路径文件:$ G6 `- {* P7 f( i
frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
修改代码如下:
static void DropCapabilitiesBoundingSet(fail_fn_t fail_fn) {5 `; s8 f$ S! f8 o& c
+/*  3 a0 L* d8 @+ X& w4 H8 w9 h4 l% d
for (int i = 0; prctl(PR_CAPBSET_READ, i, 0, 0, 0) >= 0; i++) {;
5 N' d; y; C- o* {4 F
+ E2 u2 z8 V2 k" vif (prctl(PR_CAPBSET_DROP, i, 0, 0, 0) == -1) {      ) c) U  I5 C, \
if (errno == EINVAL) {        1 ?7 x6 W( y- s# X, ^, j: w/ _
ALOGE("prctl(PR_CAPBSET_DROP) failed with EINVAL. Please verify 8 w" d2 _) Z! L% i+ q
+ G5 T9 h% m! r. R; ?7 C
"your kernel is compiled with file capabilities support");      } else {
4 _) u( ]4 E( M# r0 Q  s) p' K        fail_fn(CREATE_ERROR("prctl(PR_CAPBSET_DROP, %d) failed: %s", i, strerror(errno)));      ! [5 c$ c1 N8 u  s1 y0 |5 ^
        }    ) B5 t/ o2 G7 G# x
        }  
, |! A: h# I5 J        }
! `: }% i. l2 T        + */! u+ @2 p/ x. s* s0 O* R) S
        }
8 {$ ^8 h" K; p; S; N1 M0 f
修改以下路径文件:kernel/security/commoncap.c
修改代码如下:

! A1 L: i  ^. l+ y) ]$ ~int cap_task_setnice(struct task_struct *p, int nice)! R4 n8 {  l+ p- ^
static int cap_prctl_drop(unsigned long cap){9 L' I2 X0 l1 W- w$ f' V* G
    struct cred *new;4 U. t- y& Y1 @/ K+ X: z; I
    +/*   
0 l4 _& q& K6 V    if (!ns_capable(current_user_ns(), CAP_SETPCAP))   
& Z% ]" S6 K* Z9 g- n    return -EPERM;    ) d" w) K0 B7 P( W) w6 p4 d* t/ q
    if (!cap_valid(cap))   
+ q* R1 ~5 }. y    return -EINVAL;-+*/6 F+ T! I, V) f+ k' H1 |/ P, i% \
    new = prepare_creds();
, [+ V4 k4 g1 d
注意:"+"号为修改内容。4 a. [+ `; U7 ^" W$ h6 p% l( O: ~4 V
源码编译并测试修改完上面三个步骤的文件后,即可在源码根目录下编译安卓源码:
% R; }. L. ?( F! L
# make -j49 A  a# K4 `% N
下载Root Checker(ROOT检查工具),通过ADB命令或者U盘安装后,打开按照提示点击按钮检测ROOT,如图:
若ROOT成功则如图所示:7 [5 k: y* B9 R3 R5 }
; t2 v! j$ U, M9 I; V5 b; H9 ~; q

1 U) T# x( C& A2 E$ ~产品简介8 m4 A0 _  z  c
作为开源鸿蒙OpenHarmony硬件方案的领跑者,触觉智能坚守开源共创精神,Purple Pi OH鸿蒙开发板源码全开放,持续为大家带来各种技术分享,产品具有以下优势:

$ n7 z$ H* z8 U" Z  q# y
# X+ H* l& \2 L+ b+ N# p) H# S$ G5 a8 Y# S9 C' H# X* S

作者: taoyulon    时间: 2024-12-5 19:42
鸿蒙开发板现在火的很




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2