中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

web設計師凌哥seo技術博客

web設計師,凌哥seo技術博客,類似頭條的網站怎么做,武漢有哪些知名企業(yè)前言 相比較 Android8.1、9.0 而言,Android10.0 版本 的 root變得相當麻煩,10.0 中引入了動態(tài)分區(qū)機制,同樣的要想完全 adb root,需要 fastboot 解鎖,然后關閉 verity 才能 adb remount 成功。我嘗試和之前一樣修改 f…

前言

相比較 Android8.1、9.0 而言,Android10.0 版本 的 root變得相當麻煩,10.0 中引入了動態(tài)分區(qū)機制,同樣的要想完全 adb root,需要 fastboot 解鎖,然后關閉 verity 才能 adb remount 成功。我嘗試和之前一樣修改 fstab.in.mt6765 中的 ro 和 rw 初始值,容易導致無法正常開機,在這耗費了很長時間,就暫時先跳過吧,apk root 是 ok的。

環(huán)境

名稱版本
Android版本10.0
平臺MTK6766

先放一張圖

修改方案

上面的圖就不用我多說了吧,分別用了 ROOT檢測工具、RE文件管理器測試,只要 root 成功都有明顯的提示,總共修改 12 個文件,新增 3 個文件,一共 15 個

	modified:   build/make/core/main.mkmodified:   device/mediatek/sepolicy/basic/non_plat/file_contextsmodified:   device/mediateksample/k62v1_64_bsp/device.mkmodified:   vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/k62v1_64_bsp/k62v1_64_bsp.mkmodified:   system/core/adb/Android.bpmodified:   system/core/adb/daemon/main.cppmodified:   system/core/init/selinux.cppmodified:   system/core/libcutils/fs_config.cppmodified:   system/core/rootdir/init.rcmodified:   system/sepolicy/Android.mkmodified:   system/sepolicy/prebuilts/api/29.0/public/domain.temodified:   system/sepolicy/public/domain.teadd device/mediatek/sepolicy/basic/non_plat/suproce.teadd system/extras/su/suadd system/extras/su/suproce.sh
1.讓進程名稱在 AS Logcat 中可見,通過修改 ro.adb.secure 和 ro.secure

ps:這步不是必須的,目的只是在 logcat 中可見進程 pid 和包名,而且打開 USB 調試時默認授權,不再彈授權框

build/make/core/main.mk

 tags_to_install :=ifneq (,$(user_variant))# Target is secure in user builds.
-  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
+  # ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1ifeq ($(user_variant),user)
-    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+    # ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
+    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=0endififeq ($(user_variant),userdebug)
@@ -251,7 +253,7 @@ ifneq (,$(user_variant))tags_to_install += debugelse# Disable debugging in plain user builds.
-    enable_target_debugging :=
+    # enable_target_debugging :=endif# Disallow mock locations by default for user builds
2.修改 SELinux權限為 Permissive

SELinux 常用狀態(tài)有兩個 Permissive 和 Enforcing,通過 adb shell getenforce 可查看當前所處模式
10.0 改到了 selinux.cpp 中

system/core/init/selinux.cpp

 bool IsEnforcing() {
+    return false;if (ALLOW_PERMISSIVE_SELINUX) {return StatusFromCmdline() == SELINUX_ENFORCING;}
3.關閉 DM-verity

vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/k62v1_64_bsp/k62v1_64_bsp.mk

 TARGET=k62v1_64_bspMTK_PLATFORM=MT6765MTK_SEC_CHIP_SUPPORT=yes
-MTK_SEC_USBDL=ATTR_SUSBDL_ONLY_ENABLE_ON_SCHIP
-MTK_SEC_BOOT=ATTR_SBOOT_ENABLE
+MTK_SEC_USBDL=ATTR_SUSBDL_DISABLE
+MTK_SEC_BOOT=ATTR_SBOOT_DISABLEMTK_SEC_MODEM_AUTH=noMTK_SEC_SECRO_AC_SUPPORT=yes# Platform
4.增加 su 相關,確保 apk root 權限

apk 獲取 root 權限,需要內置 su 文件,參考之前 8.1 的做法,在 init.rc 中 boot_completed 時執(zhí)行腳本

開機執(zhí)行腳本的命令可直接加在 system/core/rootdir/init.rc

開機腳本執(zhí)行是否成功,可通過 adb shell dmesg > dmesg.txt 抓取 init 的日志,搜索是否報錯,或者缺少權限。

boot_completed 啟動完成時,start suproce

system/core/rootdir/init.rc

     class_reset main+service suproce  /system/bin/suproce.sh
+    class main
+    user root
+    group root
+    oneshot
+    seclabel u:object_r:suproce_exec:s0
+
+on property:sys.boot_completed=1
+    start suprocebootchart stop

system/extras/su/suproce.sh

#!/system/bin/shmount -o rw,remount /system
chmod 06755 su
su --daemonecho "su daemon done."

device/mediatek/sepolicy/basic/non_plat/file_contexts

 #hidl process merging/(system\/vendor|vendor)/bin/hw/merged_hal_service          u:object_r:merged_hal_service_exec:s0
+
+#suproce
+/system/bin/suproce.sh          u:object_r:suproce_exec:s0

此處寫法有變動,suproce.te 中要加 system_file_type,不然編譯時報錯

out/target/product/k62v1_64_bsp/obj/ETC/sepolicy_tests_intermediates/sepolicy_tests )"
The following types on /system/ must be associated with the "system_file_type" attribute: suproce_exec
checkpolicy:  error(s) encountered while parsing configuration

device/mediatek/sepolicy/basic/non_plat/suproce.te

type suproce, coredomain;#type suproce_exec, exec_type, vendor_file_type, file_type;
type  suproce_exec, exec_type, file_type, system_file_type;# permissive suproce;
# allow shell suproce_exec:file { read open getattr execute };init_daemon_domain(suproce);

改完后繼續(xù)編譯,再次出現(xiàn)新錯誤,user 版本不允許 permissive domains

[ 19% 1135/5824] build out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy
FAILED: out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 		30 -o out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf ) && (out/host/linux-x86/bin/sepolicy-analyze out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp permissive > out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains ) && (if [ \"user\" = \"user\" -a -s out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains ]; then 		echo \"==========\" 1>&2; 		echo \"ERROR: permissive domains not allowed in user builds\" 1>&2; 		echo \"List of invalid domains:\" 1>&2; 		cat out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains 1>&2; 		exit 1; 		fi ) && (mv out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp out/target/product/k62v1_64_bsp/obj/ETC/sepolicy.recovery_intermediates/sepolicy )"
device/mediatek/sepolicy/bsp/plat_private/untrusted_app_all.te:7:WARNING 'unrecognized character' at token '' on line 53889:
# Purpose: Make app can get phoneEx

注釋下面文件中的 exit 1

system/sepolicy/Android.mk

@@ -518,7 +518,7 @@ $(LOCAL_BUILT_MODULE): $(HOST_OUT_EXECUTABLES)/secilc $(HOST_OUT_EXECUTABLES)/seecho "ERROR: permissive domains not allowed in user builds" 1>&2; \echo "List of invalid domains:" 1>&2; \cat $@.permissivedomains 1>&2; \
-               exit 1; \
+               # exit 1; \fi$(hide) mv $@.tmp $@@@ -562,7 +562,7 @@ $(LOCAL_BUILT_MODULE): $(sepolicy.recovery.conf) $(HOST_OUT_EXECUTABLES)/checkpoecho "ERROR: permissive domains not allowed in user builds" 1>&2; \echo "List of invalid domains:" 1>&2; \cat $@.permissivedomains 1>&2; \
-               exit 1; \
+               # exit 1; \fi$(hide) mv $@.tmp $@

再重新編譯,又報錯,臥底馬,什么情況, 在 system/sepolicy/public/domain.te 中 335 行進行了權限檢查

libsepol.report_assertion_extended_permissions: neverallowxperm on line 335 of system/sepolicy/public/domain.te (or line 11735 of policy.conf) violated by allow aee_aed suproce_exec:file { ioctl };
libsepol.report_assertion_extended_permissions: neverallowxperm on line 335 of system/sepolicy/public/domain.te (or line 11735 of policy.conf) violated by allow crash_dump suproce_exec:file { ioctl };
libsepol.check_assertions: 2 neverallow failures occurred
Error while expanding policylibsepol.report_assertion_extended_permissions: neverallowxperm on line 335 of system/sepolicy/public/domain.te (or line 11642 of policy.conf) violated by allow aee_aed suproce_exec:file { ioctl };
libsepol.report_assertion_extended_permissions: neverallowxperm on line 335 of system/sepolicy/public/domain.te (or line 11642 of policy.conf) violated by allow crash_dump suproce_exec:file { ioctl };
libsepol.check_assertions: 2 neverallow failures occurred
Error while expanding policy

system/sepolicy/public/domain.te
system/sepolicy/prebuilts/api/29.0/public/domain.te

# All ioctls on file-like objects (except chr_file and blk_file) and
# sockets must be restricted to a whitelist.
# neverallowxperm * *:{ dir notdevfile_class_set socket_class_set blk_file } ioctl { 0 };

直接將 neverallowxperm * *:{ dir notdevfile_class_set socket_class_set blk_file } ioctl { 0 }; 這行注釋就行,不過需要兩個文件都注釋,

開始按照忽略原則將 aee_aed、crash_dump 通過 - 的方式修改,又報其它錯誤(寶寶心里苦啊)

*neverallowxperm { * -aee_aed -crash_dump } :{ dir notdevfile_class_set socket_class_set blk_file } ioctl { 0 }; 這樣行不通

拷貝 su 文件和開機腳本 suproce.sh 到 system/bin 目錄下
device/mediateksample/k62v1_64_bsp/device.mk

@@ -19,6 +19,11 @@ PRODUCT_COPY_FILES += $(LOCAL_PATH)/sbk-kpd.kl:system/usr/keylayout/sbk-kpd.kl:m$(LOCAL_PATH)/sbk-kpd.kcm:system/usr/keychars/sbk-kpd.kcm:mtkendif+PRODUCT_COPY_FILES += \
+       system/extras/su/su:system/bin/su \
+       system/extras/su/suproce.sh:system/bin/suproce.sh

給 su 文件增加權限

system/core/libcutils/fs_config.cpp

@@ -166,7 +168,9 @@ 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/bin/su" },// the following files have enhanced capabilities and ARE included// in user builds.
5.解鎖 fastboot,并關閉 verity 按需操作

system/core/adb/Android.bp

@@ -76,7 +76,15 @@ cc_defaults {name: "adbd_defaults",defaults: ["adb_defaults"],-    cflags: ["-UADB_HOST", "-DADB_HOST=0"],
+    //cflags: ["-UADB_HOST", "-DADB_HOST=0"],
+    cflags: [
+        "-UADB_HOST",
+        "-DADB_HOST=0",
+        "-UALLOW_ADBD_ROOT",
+        "-DALLOW_ADBD_ROOT=1",
+        "-DALLOW_ADBD_DISABLE_VERITY",
+        "-DALLOW_ADBD_NO_AUTH",
+    ],product_variables: {debuggable: {cflags: [

system/core/adb/daemon/main.cpp

@@ -63,12 +63,13 @@ static inline bool is_device_unlocked() {}static bool should_drop_capabilities_bounding_set() {
-    if (ALLOW_ADBD_ROOT || is_device_unlocked()) {
+    /*if (ALLOW_ADBD_ROOT || is_device_unlocked()) {if (__android_log_is_debuggable()) {return false;}}
-    return true;
+    return true;*/
+    return false;}static bool should_drop_privileges() {

解鎖時可能音量上鍵不生效,那需要進行對調

vendor/mediatek/proprietary/bootable/bootloader/lk/app/mt_boot/sec_unlock.c

        unlock_warranty();while (1) {
-               if (mtk_detect_key(MT65XX_MENU_SELECT_KEY)) { //VOL_UP
+               //if (mtk_detect_key(MT65XX_MENU_SELECT_KEY)) { //VOL_UP
+               if (mtk_detect_key(MT65XX_MENU_OK_KEY)) { //VOL_DOWNfastboot_info("Start unlock flow\n");//Invoke security check after confirming "yes" by userret = fastboot_get_unlock_perm(&unlock_allowed);
@@ -374,7 +375,8 @@ void fastboot_oem_unlock(const char *arg, void *data, unsigned sz)fastboot_okay("");}break;
-               } else if (mtk_detect_key(MT65XX_MENU_OK_KEY)) { //VOL_DOWN
+               //} else if (mtk_detect_key(MT65XX_MENU_OK_KEY)) { //VOL_DOWN
+               } else if (mtk_detect_key(MT65XX_MENU_SELECT_KEY)) { //VOL_UPvideo_printf("return to fastboot in 3s\n");mdelay(3000);fastboot_boot_menu();

去除 oem 解鎖后每次開機提示 Your device has been unlocked and can’t be trusted 警告字眼

vendor/mediatek/proprietary/bootable/bootloader/lk/platform/common/boot/vboot_state.c

@@ -133,9 +133,10 @@ int orange_state_warning(void)video_clean_screen();video_set_cursor(video_get_rows() / 2, 0);
-       video_printf(title_msg);
-       video_printf("Your device has been unlocked and can't be trusted\n");
-       video_printf("Your device will boot in 5 seconds\n");
+       //20191206  annotaion 
+       // video_printf(title_msg);
+       // video_printf("Your device has been unlocked and can't be trusted\n");
+       // video_printf("Your device will boot in 5 seconds\n");mtk_wdt_restart();mdelay(5000);mtk_wdt_restart();

獲取 adb root 權限, user 版本目前還不能 remount 成功, userdebug 版本可成功 remount,

后續(xù) user 版本 adb 成功后會持續(xù)更新,以下是操作比對

=user==========
C:>adb rootC:>adb remount
/system/bin/remount exited with status 2
remount failedC:>adb disable-verity
Device is locked. Please unlock the device firstC:>adb reboot bootloaderC:>fastboot flashing unlock
…
(bootloader) Start unlock flowOKAY [ 12.394s]
finished. total time: 12.398sC:>fastboot reboot
rebooting…finished. total time: 0.003sC:>adb rootC:>adb disable-verity
Successfully disabled verity
Now reboot your device for settings to take effectC:>adb rebootC:>adb rootC:>adb remount
/system/bin/remount exited with status 2
remount failed=userdebug==========C:>adb rootC:>adb remount
E Skipping /system
E Skipping /vendor
E Skipping /product
W No partitions to remount
/system/bin/remount exited with status 7
remount failedC:>adb disable-verity
Device is locked. Please unlock the device firstC:>adb reboot bootloaderC:>fastboot flashing unlock
…
(bootloader) Start unlock flowOKAY [ 12.394s]
finished. total time: 12.398sC:>fastboot reboot
rebooting…finished. total time: 0.003sC:>adb rootC:>adb disable-verity
Successfully disabled verity
Now reboot your device for settings to take effectC:>adb rebootC:>adb rootC:>adb remount
remount succeeded

user 版本已成功獲取 adb root

6.修改 adb root 權限,編譯 userdebug 版本進行比對

user 和 userdebug 區(qū)別在于 remount 時感覺走的地方不太一樣,userdebug remount 時打印的日志來自 system\core\fs_mgr\fs_mgr_remount.cpp

思路為只要讓 user 版本下 remount 時打印一樣的日志即可

修改文件清單

	modified:   system/core/adb/Android.bpmodified:   system/core/fs_mgr/Android.bpmodified:   system/sepolicy/Android.mkmodified:   system/sepolicy/definitions.mkmodified:   frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java

system/core/adb/Android.bp

+++ b/alps/system/core/adb/Android.bp
@@ -412,6 +412,8 @@ cc_library {"liblog",],+    required: [ "remount",],
+product_variables: {debuggable: {required: [

system/core/fs_mgr/Android.bp

+++ b/alps/system/core/fs_mgr/Android.bp
@@ -76,7 +76,8 @@ cc_library {"libfstab",],cppflags: [
-        "-DALLOW_ADBD_DISABLE_VERITY=0",
+        "-UALLOW_ADBD_DISABLE_VERITY",
+        "-DALLOW_ADBD_DISABLE_VERITY=1",],product_variables: {debuggable: {
@@ -133,7 +134,8 @@ cc_binary {"fs_mgr_remount.cpp",],cppflags: [
-        "-DALLOW_ADBD_DISABLE_VERITY=0",
+        "-UALLOW_ADBD_DISABLE_VERITY",
+        "-DALLOW_ADBD_DISABLE_VERITY=1",],product_variables: {debuggable: {

user 版本啟用 overlayfs 來裝載 remount 對應分區(qū)
system/sepolicy/Android.mk

+++ b/alps/system/sepolicy/Android.mk
@@ -309,7 +309,7 @@ LOCAL_REQUIRED_MODULES += \endif-ifneq ($(TARGET_BUILD_VARIANT), user)
+ifneq ($(TARGET_BUILD_VARIANT), eng)LOCAL_REQUIRED_MODULES += \selinux_denial_metadata \@@ -1104,7 +1104,8 @@ endififneq ($(filter address,$(SANITIZE_TARGET)),)local_fc_files += $(wildcard $(addsuffix /file_contexts_asan, $(PLAT_PRIVATE_POLICY)))endif
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+ifneq (,$(filter user userdebug eng,$(TARGET_BUILD_VARIANT)))local_fc_files += $(wildcard $(addsuffix /file_contexts_overlayfs, $(PLAT_PRIVATE_POLICY)))endififeq ($(TARGET_FLATTEN_APEX),true)
@@ -1166,7 +1167,9 @@ file_contexts.device.tmp :=file_contexts.local.tmp :=##################################
-ifneq ($(TARGET_BUILD_VARIANT), user)
+# ifneq ($(TARGET_BUILD_VARIANT), user)
+ifneq ($(TARGET_BUILD_VARIANT), eng)include $(CLEAR_VARS)LOCAL_MODULE := selinux_denial_metadata

system/sepolicy/definitions.mk

+++ b/alps/system/sepolicy/definitions.mk
@@ -1,10 +1,11 @@# Command to turn collection of policy files into a policy.conf file to be# processed by checkpolicydefine transform-policy-to-conf@mkdir -p $(dir $@)$(hide) m4 --fatal-warnings $(PRIVATE_ADDITIONAL_M4DEFS) \-D mls_num_sens=$(PRIVATE_MLS_SENS) -D mls_num_cats=$(PRIVATE_MLS_CATS) \
-       -D target_build_variant=$(PRIVATE_TARGET_BUILD_VARIANT) \
+       -D target_build_variant=eng \-D target_with_dexpreopt=$(WITH_DEXPREOPT) \-D target_arch=$(PRIVATE_TGT_ARCH) \

默認開啟 OEM 解鎖選項

frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java

+++ b/alps/frameworks/base/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -995,6 +995,10 @@ public class UsbDeviceManager implements ActivityTaskManagerInternal.ScreenObser}protected void finishBoot() {
+            android.service.oemlock.OemLockManager mOemLockManager 
+            = (android.service.oemlock.OemLockManager) mContext.getSystemService(Context.OEM_LOCK_SERVICE);
+            mOemLockManager.setOemUnlockAllowedByUser(true);
+if (mBootCompleted && mCurrentUsbFunctionsReceived && mSystemReady) {if (mPendingBootBroadcast) {updateUsbStateBroadcastIfNeeded(getAppliedFunctions(mCurrentFunctions));
C:>adb rootC:>adb remount
W DM_DEV_STATUS failed for scratch: No such device or address
E [liblp]No device named scratch
[liblp]Partition scratch will resize from 0 bytes to 1315950592 bytes
[liblp]Updated logical partition table at slot 0 on device /dev/block/by-name/super
[libfs_mgr]Created logical partition scratch on device /dev/block/dm-3
[libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/dm-3
[libfs_mgr]__mount(source=/dev/block/dm-3,target=/mnt/scratch,type=ext4)=0: Success
Using overlayfs for /system
Using overlayfs for /vendor
Using overlayfs for /product
[libfs_mgr]__mount(source=overlay,target=/system,type=overlay,upperdir=/mnt/scratch/overlay/system/upper)=0
[libfs_mgr]__mount(source=overlay,target=/vendor,type=overlay,upperdir=/mnt/scratch/overlay/vendor/upper)=0
[libfs_mgr]__mount(source=overlay,target=/product,type=overlay,upperdir=/mnt/scratch/overlay/product/upper)=0
remount succeeded
http://www.risenshineclean.com/news/43297.html

相關文章:

  • 網頁設計與制作的理解紹興seo公司
  • 國外工會網站建設培訓網站有哪些
  • 英文網站報價蘇州網站建設開發(fā)公司
  • 海南網站備案百度一下你就知道官網新聞
  • wordpress 淘口令主題seo模擬點擊工具
  • 古色古香網站模板seo工具下載
  • 免費的外鏈網站青島自動seo
  • web前端開發(fā)環(huán)境有哪些做抖音seo排名軟件是否合法
  • 網站打開是404什么是電商?電商怎么做
  • 做物流網站費用多少產品宣傳推廣策劃
  • 鄭州做網站推廣的公司天津百度seo代理
  • 常州市建設局網站qq營銷
  • 網站搭建報價百度一下官網首頁百度一下
  • 深圳網站建設hi0755seo怎么發(fā)外鏈的
  • 互聯(lián)網網站建設公司百度新站關鍵詞排名
  • 網站備案要關站嗎google網頁搜索
  • 汽車網站建設規(guī)劃書百度首頁優(yōu)化排名
  • 網易游戲官網seo網站推廣如何做
  • 電子商務代運營百度筆記排名優(yōu)化
  • 上蔡專業(yè)網站建設突發(fā)大事震驚全國
  • 南寧哪里做網站輸入關鍵詞進行搜索
  • 網站權重劃分seo 是什么
  • 用pc做網站服務器為什么不如云主機百度輸入法下載
  • 長沙免費網站排名seo觀察網
  • 做o2o平臺網站需要多少錢chrome 谷歌瀏覽器
  • 個性個人網站模板建網站建設
  • 化妝品可做的團購網站有哪些seo排名優(yōu)化教程
  • php網站開發(fā)什么外貿推廣代理
  • 潤東電子科技 網站建設全網營銷推廣方案外包
  • 濟南網站APP如何做好百度推廣