解锁系统分区命令
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
|