在user版本下打开adb root以及ylog,抓取有效log分析问题,此需要烧录 boot和system image: 1.user版本打开 adb 以及root权限: 1). @bjand01:/home/sprdroid8.1_trunk_18a_rls2/build/core$ git diff . diff --git a/core/main.mk b/core/main.mk index 44ad271..c81672b 100644 --- a/core/main.mk +++ b/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)
2). @bjand01:/home/sprdroid8.1_trunk_18a_rls2$ cd system/core/ @bjand01:/home/sprdroid8.1_trunk_18a_rls2/system/core/adb$ git diff . diff --git a/adb/Android.mk b/adb/Android.mk index ece0645..b41abfb 100644 --- a/adb/Android.mk +++ b/adb/Android.mk @@ -350,12 +350,12 @@ LOCAL_CFLAGS := -D_GNU_SOURCE -Wno-deprecated-declarations -LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0) +LOCAL_CFLAGS += -DALLOW_ADBD_NO_AUTH=$(if $(filter user userdebug eng,$(TARGET_BUILD_VARIANT)),1,0)
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) +#ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) LOCAL_CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 LOCAL_CFLAGS += -DALLOW_ADBD_ROOT=1 -endif +#endif
LOCAL_MODULE := adbd
diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp index d5f3e1b..cbcd14d 100644 --- a/adb/daemon/main.cpp +++ b/adb/daemon/main.cpp @@ -59,6 +59,7 @@ static void drop_capabilities_bounding_set_if_needed(struct minijail *j) { }
static bool should_drop_privileges() { +#if 0 #if defined(ALLOW_ADBD_ROOT) // The properties that affect `adb root` and `adb unroot` are ro.secure and // ro.debuggable. In this context the names don't make the expected behavior @@ -92,6 +93,8 @@ static bool should_drop_privileges() { #else return true; // "adb root" not allowed, always drop privileges. #endif // ALLOW_ADBD_ROOT +#endif + return false; }
static void drop_privileges(int server_port) {
diff --git a/init/init.cpp b/init/init.cpp index 6ecd88c..afc80eb 100755 --- a/init/init.cpp +++ b/init/init.cpp @@ -892,7 +892,7 @@ static void selinux_initialize(bool in_kernel_domain) { bool kernel_enforcing = (security_getenforce() == 1); bool is_enforcing = selinux_is_enforcing(); if (kernel_enforcing != is_enforcing) { - if (security_setenforce(is_enforcing)) { + if (security_setenforce(false)) { PLOG(ERROR) << "security_setenforce(%s) failed" << (is_enforcing ? "true" : "false"); security_failure(); } 2.默认打开ylog: 1). build$ git diff build/core/main.mk diff --git a build/core/main.mk b/core/main.mk index bf57ab4..b536a0c 100644 --- a/core/main.mk +++ b/core/main.mk @@ -426,7 +426,7 @@ ifeq (true,$(strip $(enable_target_debugging))) INCLUDE_TEST_OTA_KEYS := true else # !enable_target_debugging # Target is less debuggable and adbd is off by default - ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 + ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 endif # !enable_target_debugging 2). diff --git a /device/sprd/sharkle/common/rootdir/root/init.common.rc b /device/sprd/sharkle/common/rootdir/root/init.common.rc index 984c33f..80b83d6 100755 --- a/common/rootdir/root/init.common.rc +++ b/common/rootdir/root/init.common.rc
init.common.rc on post-fs-data ....... mkdir /data/vendor/thermald 0770 system system 169 chown system system /data/vendor/thermald 170 mkdir /data/misc/hprofs 0777 171 172 # Support audio 173 mkdir /data/vendor/local/media 0770 audioserver system 174 #start aprd ++ setprop persist.ylog.enabled 1 ++ start ylog
176 service p2p_supplicant /vendor/bin/hw/wpa_supplicant |