android 8.1 user 版本开启 ADB 调试 和root

一、背景

最新高通user 版本需要抓取kernel log


二、修改方法

android 8.1 user 版本开启 adb 调试和root  

diff --git a/build/make/core/main.mk b/build/make/core/main.mk

old mode 100644

new mode 100755

index 3d42c8f..dd0e1e8

--- a/build/make/core/main.mk

+++ b/build/make/core/main.mk

@@ -239,11 +239,11 @@ 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)

-    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1

+    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=0

  endif

  ifeq ($(user_variant),userdebug)

@@ -251,7 +251,7 @@ ifneq (,$(user_variant))

    tags_to_install += debug

  else

    # Disable debugging in plain user builds.

-    enable_target_debugging :=

+    #enable_target_debugging :=

  endif

  # Disallow mock locations by default for user builds

diff --git a/device/qcom/msm8953_64/msm8953_64.mk b/device/qcom/msm8953_64/msm8953_64.mk

index b70d91b..d4eee35 100755

--- a/device/qcom/msm8953_64/msm8953_64.mk

+++ b/device/qcom/msm8953_64/msm8953_64.mk

@@ -32,6 +32,10 @@ endif

TARGET_ENABLE_QC_AV_ENHANCEMENTS := true

+

+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \

+persist.sys.usb.config=ptp,adb

+

# Default vendor configuration.

ifeq ($(ENABLE_VENDOR_IMAGE),)

ENABLE_VENDOR_IMAGE := true

diff --git a/kernel/msm-3.18/arch/arm64/configs/msmcortex-perf_defconfig b/kernel/msm-3.18/arch/arm64/configs/msmcortex-perf_defconfig

index 304ccdb..69fbbf3 100755

--- a/kernel/msm-3.18/arch/arm64/configs/msmcortex-perf_defconfig

+++ b/kernel/msm-3.18/arch/arm64/configs/msmcortex-perf_defconfig

@@ -32,6 +32,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y

CONFIG_KALLSYMS_ALL=y

CONFIG_EMBEDDED=y

# CONFIG_SLUB_DEBUG is not set

+CONFIG_LOG_BUF_SHIFT=21

CONFIG_PROFILING=y

CONFIG_CC_STACKPROTECTOR_STRONG=y

CONFIG_ARCH_MMAP_RND_COMPAT_BITS=16

diff --git a/kernel/msm-3.18/arch/arm64/configs/msmcortex_defconfig b/kernel/msm-3.18/arch/arm64/configs/msmcortex_defconfig

index 077179a..254befb 100755

--- a/kernel/msm-3.18/arch/arm64/configs/msmcortex_defconfig

+++ b/kernel/msm-3.18/arch/arm64/configs/msmcortex_defconfig

@@ -25,6 +25,7 @@ CONFIG_LEDS_GPIO=y

CONFIG_LEDS_TRIGGER_TIMER=y

# CONFIG_UTS_NS is not set

# CONFIG_PID_NS is not set

+CONFIG_LOG_BUF_SHIFT=21

CONFIG_BLK_DEV_INITRD=y

CONFIG_CC_OPTIMIZE_FOR_SIZE=y

CONFIG_KALLSYMS_ALL=y

diff --git a/system/core/adb/Android.mk b/system/core/adb/Android.mk

old mode 100644

new mode 100755

index 9b59d11..0772370

--- a/system/core/adb/Android.mk

+++ b/system/core/adb/Android.mk

@@ -381,7 +381,7 @@ LOCAL_CFLAGS := \

LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)

LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)

-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))

+ifneq (,$(filter user userdebug eng,$(TARGET_BUILD_VARIANT)))

LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1

endif

diff --git a/system/core/init/init.cpp b/system/core/init/init.cpp

index 5d284df..3df31a7 100755

--- a/system/core/init/init.cpp

+++ b/system/core/init/init.cpp

@@ -585,7 +585,8 @@ static selinux_enforcing_status selinux_status_from_cmdline() {

}

static bool selinux_is_enforcing(void)

-{

+{ 

+    return false;

    if (ALLOW_PERMISSIVE_SELINUX) {

        return selinux_status_from_cmdline() == SELINUX_ENFORCING;

    }


三、搞定。

你可能感兴趣的:(android 8.1 user 版本开启 ADB 调试 和root)