[RK3399] [Android 7.1] Add system root permissions

1. Add startup service

rk3399/device/rockchip/common$ git diff init.rockchip.rc
diff --git a/init.rockchip.rc b/init.rockchip.rc
index a0ade29..b202580 100755
--- a/init.rockchip.rc
+++ b/init.rockchip.rc

+#lance root
+service daemonsu /system/xbin/daemonsu --auto-daemon
+   class main
+   seclabel u:r:su:s0
+
+on property:sys.boot_completed=1
+       start daemonsu

rk3399/device/rockchip/common$ git diff sepolicy/file_contexts
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 728d4bc..0f45c30 100755
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts

+#myshell
+/system/xbin/daemonsu u:object_r:shell_exec:s0

2. Create a new root directory and copy the corresponding files in arm64 in the compressed package to
libsupol.so su supolicy

3.Add copy work in device.mk

rk3399/device/rockchip/rk3399$ git diff device.mk
diff --git a/device.mk b/device.mk
--- a/device.mk
+++ b/device.mk
+#copy  root
+PRODUCT_COPY_FILES += \
+       $(LOCAL_PATH)/root/libsupol.so:system/lib64/libsupol.so \
+    $(LOCAL_PATH)/root/su:system/xbin/su \
+    $(LOCAL_PATH)/root/su:system/xbin/daemonsu \
+    $(LOCAL_PATH)/root/supolicy:system/xbin/supolicy 

4. Compile, burn, install and test the apk.

Note:
If it does not work, first check whether the service is turned on, dmesg | grep daemonsu
to open su apk, you will be prompted to update the binary file, click Cancel.
Note: Do not update the supersu binary, otherwise it will cause the system to fail to boot.

 

File and APK download address:

Link: https://pan.baidu.com/s/1mGzrOXUTi1gK58spuQyWHw 
Extraction code: uwnq

Guess you like

Origin blog.csdn.net/qq1226176787/article/details/108377754