android10.0将adb disable-verity移植到安卓卡里面执行

解锁系统分区命令

adb disable-verity
adb reboot

现在适配到android卡里面执行


 system/core/adb/Android.bp        | 38 ++++++++++++++++++++++++
 system/core/adb/daemon/adb_vc.cpp | 48 +++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
 create mode 100755 system/core/adb/daemon/adb_vc.cpp

diff --git a/system/core/adb/Android.bp b/system/core/adb/Android.bp
index 93af0dcfa4..8d12401c54 100755
--- a/system/core/adb/Android.bp
+++ b/system/core/adb/Android.bp
@@ -548,6 +548,44 @@ cc_binary {
     ],
 }
 
+
+cc_binary {
+    name: "adb_vc",
+
+    defaults: ["adbd_defaults"],
+    recovery_available: false,
+
+    srcs: [
+        "daemon/adb_vc.cpp",
+    ],
+
+    cflags: [
+        "-D_GNU_SOURCE",
+        "-Wno-deprecated-declarations",
+    ],
+
+    strip: {
+        keep_symbols: true,
+    },
+
+    static_libs: [
+        "libadbd_core",
+        "libavb_user",
+        "libadbd_services",
+        "libcmd",
+    ],
+
+    shared_libs: [
+        "libfec",
+        "libfs_mgr",
+        "libbase",
+        "libbinder",
+        "liblog",
+        "libutils",
+        "libselinux",
+    ],
+}
+
 cc_test {
     name: "adbd_test",
     defaults: ["adbd_defaults"],
diff --git a/system/core/adb/daemon/adb_vc.cpp b/system/core/adb/daemon/adb_vc.cpp
new file mode 100755
index 0000000000..8183fe24f5
--- /dev/null
+++ b/system/core/adb/daemon/adb_vc.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <thread>
+
+#include "daemon/set_verity_enable_state_service.h"
+#include "services.h"
+
+void showHelp() {
+    printf("/**************************************************************/\n");
+    printf("/***   please input commands lists                          ***/\n");
+    printf("/***   adb_vc enable-verity                                 ***/\n");
+    printf("/***   adb_vc disable-verity                                ***/\n");
+    printf("/**************************************************************/\n");
+}
+int main(int argc, char* const argv[]) {
+    if (argc == 2) {
+        if (strcmp(argv[1], "disable-verity") == 0) {
+            create_service_thread("verity-on", std::bind(set_verity_enabled_state_service,
+                                                         std::placeholders::_1, false));
+        } else if (strcmp(argv[1], "enable-verity") == 0) {
+            create_service_thread("verity-off", std::bind(set_verity_enabled_state_service,
+                                                          std::placeholders::_1, true));
+        }
+
+    } else {
+        showHelp();
+        return 0;
+    }
+
+    while (true) {
+        sleep(3);
+        return 0;
+    }
+}
-- 
2.17.1

在卡里面执行

adb push adb_vc /system/bin/
adb shell
adb_vc disable-verity
reboot

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值