RK3562編譯Android13 ROOT固件教程,觸覺智能開發(fā)板演示

01/08 09:30
1072
加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點資訊討論

本文介紹編譯Android13 ROOT權限固件的方法,觸覺智能RK3562開發(fā)板演示,搭載4核A53處理器,主頻高達2.0GHz;內(nèi)置獨立1Tops算力NPU,可應用于物聯(lián)網(wǎng)網(wǎng)關、平板電腦智能家居、教育電子、工業(yè)顯示與控制等行業(yè)。

關閉selinux

修改此文件("+"號為修改內(nèi)容)

device/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

注釋用戶組權限檢測

修改此文件("+"號為修改內(nèi)容)

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");

給su文件默認授予root權限

修改此文件("+"號為修改內(nèi)容)

system/core/libcutils/fs_config.cpp

static const struct fs_path_config android_dirs[] = {
     { 00751, AID_ROOT,         AID_SHELL,        0, "system/bin" },
     { 00755, AID_ROOT,         AID_ROOT,         0, "system/etc/ppp" },
     { 00755, AID_ROOT,         AID_SHELL,        0, "system/vendor" },
-    { 00750, AID_ROOT,         AID_SHELL,        0, "system/xbin" },
+    { 00755, AID_ROOT,         AID_SHELL,        0, "system/xbin" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "system/apex/*/bin" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "system_ext/bin" },
     { 00751, AID_ROOT,         AID_SHELL,        0, "system_ext/apex/*/bin" },
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" },

然后修改此文件("+"號為修改內(nèi)容)

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)));
      }
    }
  }
+ */
}

最后修改此文件("+"號為修改內(nèi)容)

kernel-5.10/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();

源碼編譯并驗證固件是否ROOT

修改完上面三個步驟的文件后,重新編譯內(nèi)核和安卓源碼,執(zhí)行以下命令:

# make -j4

下載RootChecker測試APK軟件包(自行下載),可通過ADB命令或者U盤安裝,安裝后按照提示點擊按鈕檢查root。

root成功如圖:

產(chǎn)品簡介

觸覺智能RK3562開發(fā)板(型號EVB3562),基于瑞芯微新一代Soc RK3562/RK3562J設計,可用于輕量級人工智能應用。EVB3562開發(fā)板配備了PCIe2.1/USB3.0 OTG/千兆網(wǎng)口等各類型接口,支持4G/5G通信、多攝像頭及多種視頻接口,可應用于物聯(lián)網(wǎng)網(wǎng)關、平板電腦、智能家居、教育電子、工業(yè)顯示、工業(yè)控制等行業(yè)領域。

  • 搭載瑞芯微新一代RK3562/RK3562J芯片;
  • 1TOPS算力NPU,支持INT8/INT16/FP16
  • 等數(shù)據(jù)類型運算;
  • 支持4K@30FPS與1080P@60FPS視頻解碼;
  • 13M ISP,支持HDR與多路攝像頭視頻采集;
  • 單路MIPI-DSI,最高2048 x 1080@60fps ;
  • 單通道LVDS,最高1366 x 768@60fps ;
  • 三路獨立的以太網(wǎng)口,其中兩路千兆網(wǎng)口,
  • 一路百兆網(wǎng)口;
  • 支持5G/4G/WiFi/藍牙無線通信;
  • 支持Android,Linux操作系統(tǒng);

相關推薦

登錄即可解鎖
  • 海量技術文章
  • 設計資源下載
  • 產(chǎn)業(yè)鏈客戶資源
  • 寫文章/發(fā)需求
立即登錄