RK 默认root、User版本编译
一.默认root
1. adb shell 默认root
在build/core/main.mk下将ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
改成ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
2.挂载分区device\rockchip\rk3399\fstab.rk30board.bootmode.emmc
system 由 ro 改成 rw
二.补丁
diff --git a/build/core/main.mk b/build/core/main.mk index a6b2544..98d0549 100755 --- a/build/core/main.mk +++ b/build/core/main.mk @@ -393,7 +393,7 @@ enable_target_debugging := true tags_to_install := ifneq (,$(user_variant)) # Target is secure in user builds. - ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 + ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 ifeq ($(user_variant),user) diff --git a/device/rockchip/rk3399/fstab.rk30board.bootmode.emmc b/device/rockchip/rk3399/fstab.rk30board.bootmode.emmc index 8668a0f..b40ba17 100755 --- a/device/rockchip/rk3399/fstab.rk30board.bootmode.emmc +++ b/device/rockchip/rk3399/fstab.rk30board.bootmode.emmc @@ -3,7 +3,7 @@ # The filesystem that contains the filesystem checker binary (typically /system) cannot # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK -/dev/block/platform/fe330000.sdhci/by-name/system /system ext4 ro,noatime,nodiratime,noauto_da_alloc wait,resize +/dev/block/platform/fe330000.sdhci/by-name/system /system ext4 rw,noatime,nodiratime,noauto_da_alloc wait,resize # use this line below instead to enable verity #/dev/block/platform/fe330000.sdhci/by-name/system /system ext4 ro,noatime,nodiratime,noauto_da_alloc wait,check,verify /dev/block/platform/fe330000.sdhci/by-name/cache /cache ext4 noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard wait,check
default.prop
# # ADDITIONAL_DEFAULT_PROPERTIES # ro.secure=0 ro.allow.mock.location=0 ro.debuggable=1 ro.zygote=zygote32 ro.enable_boot_charger_mode=0 dalvik.vm.dex2oat-Xms=64m dalvik.vm.dex2oat-Xmx=512m dalvik.vm.image-dex2oat-Xms=64m dalvik.vm.image-dex2oat-Xmx=64m ro.dalvik.vm.native.bridge=0 persist.sys.usb.config=adb
三.daemonsu 开启root 服务
out\target\product\rk3288\root\init.rc
service daemonsu /system/xbin/daemonsu --auto-daemon class main
四.unroot 编译user版本 注意busybox工具
diff --git a/vendor/rockchip/common/bin/Android.mk b/vendor/rockchip/common/bin/Android.mk old mode 100644 new mode 100755 index e58759f..3450150 --- a/vendor/rockchip/common/bin/Android.mk +++ b/vendor/rockchip/common/bin/Android.mk @@ -6,7 +6,7 @@ LOCAL_PATH := $(call my-dir) #ifeq ($(strip $(TARGET_ARCH)), arm) ############################################################################### -ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) +ifneq (,$(filter userdebug user eng,$(TARGET_BUILD_VARIANT))) # busybox include $(CLEAR_VARS) LOCAL_MODULE := busybox diff --git a/vendor/rockchip/common/bin/bin.mk b/vendor/rockchip/common/bin/bin.mk old mode 100644 new mode 100755 index 13df1ad..db24e88 --- a/vendor/rockchip/common/bin/bin.mk +++ b/vendor/rockchip/common/bin/bin.mk @@ -12,7 +12,7 @@ PRODUCT_PACKAGES += \ endif -ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) +ifneq (,$(filter userdebug user eng,$(TARGET_BUILD_VARIANT))) PRODUCT_PACKAGES += \ busybox endif
默认的目标构建变体(TARGET_BUILD_VARIANT)为 userdebug。常用变体有三种,分别是用户(user)、用户调试(userdebug)和工程模式(eng)