summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch')
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch161
1 files changed, 0 insertions, 161 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch
deleted file mode 100644
index 8819431..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch
+++ /dev/null
@@ -1,161 +0,0 @@
1From 1c836e4402ae170b3e0bf31da9012b7a3b1c40a1 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Wed, 8 Mar 2023 15:21:49 +0100
4Subject: [PATCH] Adapt adbd to work with yocto
5
6Co-authored-by: JJ Robertson <jrobertson@snap.com>
7Co-authored-by: Wejdene Smida <wsmida@snap.com>
8Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
9---
10 adb/daemon/file_sync_service.cpp | 4 ++--
11 adb/daemon/main.cpp | 4 ++--
12 adb/daemon/reboot_service.cpp | 5 ++++-
13 adb/daemon/set_verity_enable_state_service.cpp | 6 +++++-
14 adb/daemon/shell_service.cpp | 4 ++++
15 adb/types.h | 1 +
16 6 files changed, 18 insertions(+), 6 deletions(-)
17
18diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp
19index e82a51f2..ba112cbe 100644
20--- a/adb/daemon/file_sync_service.cpp
21+++ b/adb/daemon/file_sync_service.cpp
22@@ -111,7 +111,7 @@ static bool secure_mkdirs(const std::string& path) {
23 partial_path += path_component;
24
25 if (should_use_fs_config(partial_path)) {
26- fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
27+ // fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
28 }
29 if (adb_mkdir(partial_path.c_str(), mode) == -1) {
30 if (errno != EEXIST) {
31@@ -434,7 +434,7 @@ static bool do_send(int s, const std::string& spec, std::vector<char>& buffer) {
32 uint64_t capabilities = 0;
33 if (should_use_fs_config(path)) {
34 unsigned int broken_api_hack = mode;
35- fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities);
36+ // fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities);
37 mode = broken_api_hack;
38 }
39
40diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp
41index e5a49171..c75263c4 100644
42--- a/adb/daemon/main.cpp
43+++ b/adb/daemon/main.cpp
44@@ -191,6 +191,8 @@ int adbd_main(int server_port) {
45 umask(0);
46
47 signal(SIGPIPE, SIG_IGN);
48+ signal(SIGINT, SIG_DFL);
49+ signal(SIGQUIT, SIG_DFL);
50
51 #if defined(__BIONIC__)
52 auto fdsan_level = android_fdsan_get_error_level();
53@@ -232,13 +234,11 @@ int adbd_main(int server_port) {
54
55 bool is_usb = false;
56
57-#if defined(__ANDROID__)
58 if (access(USB_FFS_ADB_EP0, F_OK) == 0) {
59 // Listen on USB.
60 usb_init();
61 is_usb = true;
62 }
63-#endif
64
65 // If one of these properties is set, also listen on that port.
66 // If one of the properties isn't set and we couldn't listen on usb, listen
67diff --git a/adb/daemon/reboot_service.cpp b/adb/daemon/reboot_service.cpp
68index a5a11b86..6bd069d4 100644
69--- a/adb/daemon/reboot_service.cpp
70+++ b/adb/daemon/reboot_service.cpp
71@@ -28,7 +28,9 @@
72 #include <android-base/logging.h>
73 #include <android-base/properties.h>
74 #include <android-base/stringprintf.h>
75-#include <bootloader_message/bootloader_message.h>
76+// #include <bootloader_message/bootloader_message.h>
77+#include <linux/reboot.h>
78+#include <sys/signal.h>
79 #include <cutils/android_reboot.h>
80
81 #include "adb_io.h"
82@@ -76,6 +78,7 @@ void reboot_service(unique_fd fd, const std::string& arg) {
83 return;
84 }
85 }
86+ syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_arg.c_str());
87 // Don't return early. Give the reboot command time to take effect
88 // to avoid messing up scripts which do "adb reboot && adb wait-for-device"
89 while (true) {
90diff --git a/adb/daemon/set_verity_enable_state_service.cpp b/adb/daemon/set_verity_enable_state_service.cpp
91index 889229fe..51e9be93 100644
92--- a/adb/daemon/set_verity_enable_state_service.cpp
93+++ b/adb/daemon/set_verity_enable_state_service.cpp
94@@ -22,7 +22,7 @@
95 #include <errno.h>
96 #include <fcntl.h>
97 #include <inttypes.h>
98-#include <libavb_user/libavb_user.h>
99+// #include <libavb_user/libavb_user.h>
100 #include <stdarg.h>
101 #include <stdio.h>
102 #include <sys/mount.h>
103@@ -65,6 +65,7 @@ static bool make_block_device_writable(const std::string& dev) {
104 /* Turn verity on/off */
105 static bool set_verity_enabled_state(int fd, const char* block_device, const char* mount_point,
106 bool enable) {
107+#if defined(__ANDROID__)
108 if (!make_block_device_writable(block_device)) {
109 WriteFdFmt(fd, "Could not make block device %s writable (%s).\n",
110 block_device, strerror(errno));
111@@ -115,6 +116,7 @@ static bool set_verity_enabled_state(int fd, const char* block_device, const cha
112 mount_point, strerror(errno));
113 }
114 WriteFdFmt(fd, "Verity %s on %s\n", enable ? "enabled" : "disabled", mount_point);
115+#endif
116 return true;
117 }
118
119@@ -126,6 +128,7 @@ static std::string get_ab_suffix() {
120 return android::base::GetProperty("ro.boot.slot_suffix", "");
121 }
122
123+#if defined(__ANDROID__)
124 static bool is_avb_device_locked() {
125 return android::base::GetProperty("ro.boot.vbmeta.device_state", "") == "locked";
126 }
127@@ -245,3 +248,4 @@ void set_verity_enabled_state_service(unique_fd fd, bool enable) {
128 WriteFdExactly(fd.get(), "Now reboot your device for settings to take effect\n");
129 }
130 }
131+#endif
132diff --git a/adb/daemon/shell_service.cpp b/adb/daemon/shell_service.cpp
133index 3c8f3939..84f4f54d 100644
134--- a/adb/daemon/shell_service.cpp
135+++ b/adb/daemon/shell_service.cpp
136@@ -264,6 +264,10 @@ bool Subprocess::ForkAndExec(std::string* error) {
137 env["TMPDIR"] = "/data/local/tmp";
138 env["USER"] = pw->pw_name;
139 }
140+ if (env.find("PS1") == env.end()) {
141+ env["PS1"] = "\\h:\\w\\$ ";
142+ }
143+
144
145 if (!terminal_type_.empty()) {
146 env["TERM"] = terminal_type_;
147diff --git a/adb/types.h b/adb/types.h
148index 6af4a150..9efe223b 100644
149--- a/adb/types.h
150+++ b/adb/types.h
151@@ -20,6 +20,7 @@
152 #include <cstring>
153 #include <deque>
154 #include <memory>
155+#include <string>
156 #include <type_traits>
157 #include <utility>
158 #include <vector>
159--
1602.36.1.vfs.0.0
161