summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@theqtcompany.com>2014-12-12 14:44:42 +0200
committerSamuli Piippo <samuli.piippo@theqtcompany.com>2015-01-08 10:41:05 +0200
commit44bb65f9d300b71a33ee9b47f21dcad81e1c1c54 (patch)
tree3bf79453d72a070cfd0b87f3ac7ea9af035592e1
parente5e9f7cae18db59b4d355a918bbf37fa200810db (diff)
downloadmeta-boot2qt-44bb65f9d300b71a33ee9b47f21dcad81e1c1c54.tar.gz
adbd: upgrade to android-5.0.1_r1
Move to latest version of adbd. Enable adb listen to both usb and network sockets. Task-number: QTEE-875 Change-Id: I6439356dc036ed372c17a71168809cf639a326a3 Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
-rw-r--r--recipes/adbd/adbd.bb12
-rw-r--r--recipes/adbd/files/Makefile.adbd10
-rw-r--r--recipes/adbd/files/adbd.patch264
3 files changed, 185 insertions, 101 deletions
diff --git a/recipes/adbd/adbd.bb b/recipes/adbd/adbd.bb
index 74d6a8a..89aa4ce 100644
--- a/recipes/adbd/adbd.bb
+++ b/recipes/adbd/adbd.bb
@@ -24,23 +24,23 @@ DESCRIPTION = "Android Debug Bridge Daemon"
24HOMEPAGE = "http://developer.android.com/tools/help/adb.html" 24HOMEPAGE = "http://developer.android.com/tools/help/adb.html"
25SECTION = "devel" 25SECTION = "devel"
26LICENSE = "Apache-2.0" 26LICENSE = "Apache-2.0"
27LIC_FILES_CHKSUM = "file://NOTICE;md5=2ddb23e63b1f9c3c46aaa4195f819a6d" 27LIC_FILES_CHKSUM = "file://adb/NOTICE;md5=2ddb23e63b1f9c3c46aaa4195f819a6d"
28 28
29PV = "android-4.2.2_r1.2" 29PV = "android-5.0.1_r1"
30PR = "r0" 30PR = "r0"
31SRCREV = "${PV}" 31SRCREV = "${PV}"
32 32
33RRECOMMENDS_${PN} += "kernel-module-g-ffs" 33RRECOMMENDS_${PN} += "kernel-module-g-ffs"
34DEPENDS = "openssl" 34DEPENDS = "openssl"
35 35
36SRC_URI = "git://android.googlesource.com/platform/system/core;protocol=https \ 36SRC_URI = "git://android.googlesource.com/platform/system/core;protocol=https;branch=lollipop-release;name=core \
37 file://adbd.patch;striplevel=2 \ 37 file://adbd.patch \
38 file://Makefile.adbd \ 38 file://Makefile.adbd \
39 file://adb-init \ 39 file://adb-init \
40 file://defaults \ 40 file://defaults \
41 " 41 "
42 42
43S = "${WORKDIR}/git/adb" 43S = "${WORKDIR}/git"
44 44
45FILES_${PN} += "${bindir}/adbd" 45FILES_${PN} += "${bindir}/adbd"
46 46
@@ -51,7 +51,7 @@ do_configure() {
51} 51}
52 52
53do_compile() { 53do_compile() {
54 make -f ${WORKDIR}/Makefile.adbd 54 make -f ${WORKDIR}/Makefile.adbd -C adb
55} 55}
56 56
57do_install() { 57do_install() {
diff --git a/recipes/adbd/files/Makefile.adbd b/recipes/adbd/files/Makefile.adbd
index a24b670..bcbfd7a 100644
--- a/recipes/adbd/files/Makefile.adbd
+++ b/recipes/adbd/files/Makefile.adbd
@@ -1,6 +1,5 @@
1LOCAL_SRC_FILES := \ 1LOCAL_SRC_FILES := \
2 adb.c \ 2 adb.c \
3 backup_service.c \
4 fdevent.c \ 3 fdevent.c \
5 transport.c \ 4 transport.c \
6 transport_local.c \ 5 transport_local.c \
@@ -12,9 +11,7 @@ LOCAL_SRC_FILES := \
12 jdwp_service.c \ 11 jdwp_service.c \
13 framebuffer_service.c \ 12 framebuffer_service.c \
14 remount_service.c \ 13 remount_service.c \
15 usb_linux_client.c \ 14 usb_linux_client.c
16 log_service.c \
17 utils.c
18 15
19LOCAL_OBJ_FILES=$(LOCAL_SRC_FILES:%.c=%.o) 16LOCAL_OBJ_FILES=$(LOCAL_SRC_FILES:%.c=%.o)
20 17
@@ -23,8 +20,7 @@ LIBCUTILS_SRC_FILES := \
23 ../libcutils/socket_local_client.c \ 20 ../libcutils/socket_local_client.c \
24 ../libcutils/socket_local_server.c \ 21 ../libcutils/socket_local_server.c \
25 ../libcutils/socket_loopback_client.c \ 22 ../libcutils/socket_loopback_client.c \
26 ../libcutils/socket_loopback_server.c \ 23 ../libcutils/socket_loopback_server.c
27 ../libcutils/list.c
28 24
29LIBCUTILS_OBJ_FILES=$(LIBCUTILS_SRC_FILES:%.c=%.o) 25LIBCUTILS_OBJ_FILES=$(LIBCUTILS_SRC_FILES:%.c=%.o)
30 26
@@ -35,4 +31,4 @@ adbd: $(LOCAL_OBJ_FILES) $(LIBCUTILS_OBJ_FILES)
35 $(CC) -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -c $^ -o $@ -I../include/ -DHAVE_TERMIO_H -DHAVE_FORKEXEC 31 $(CC) -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -c $^ -o $@ -I../include/ -DHAVE_TERMIO_H -DHAVE_FORKEXEC
36 32
37%.o: %.c 33%.o: %.c
38 $(CC) -O2 -g -DALLOW_ADBD_ROOT -DADB_QEMU=0 -DADB_HOST=0 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -c $^ -o $@ -I../include/ -DHAVE_TERMIO_H -DHAVE_FORKEXEC 34 $(CC) -O2 -g -DADB_QEMU=0 -DADB_HOST=0 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -c $^ -o $@ -isystem . -I../include/ -DHAVE_TERMIO_H -DHAVE_FORKEXEC
diff --git a/recipes/adbd/files/adbd.patch b/recipes/adbd/files/adbd.patch
index 110b021..479a049 100644
--- a/recipes/adbd/files/adbd.patch
+++ b/recipes/adbd/files/adbd.patch
@@ -1,8 +1,21 @@
1diff --git a/adb/adb.c b/adb/adb.c 1diff --git a/adb/adb.c b/adb/adb.c
2index 07bfbe5..c8f37ff 100644 2index 10a1e0d..99fca49 100644
3--- a/adb/adb.c 3--- a/adb/adb.c
4+++ b/adb/adb.c 4+++ b/adb/adb.c
5@@ -141,7 +141,7 @@ void adb_trace_init(void) 5@@ -35,12 +35,10 @@
6
7 #if !ADB_HOST
8 #include <cutils/properties.h>
9-#include <private/android_filesystem_config.h>
10 #include <sys/capability.h>
11 #include <sys/mount.h>
12 #include <sys/prctl.h>
13 #include <getopt.h>
14-#include <selinux/selinux.h>
15 #else
16 #include "usb_vendors.h"
17 #endif
18@@ -147,7 +145,7 @@ void adb_trace_init(void)
6 } 19 }
7 } 20 }
8 21
@@ -11,7 +24,7 @@ index 07bfbe5..c8f37ff 100644
11 /* 24 /*
12 * Implements ADB tracing inside the emulator. 25 * Implements ADB tracing inside the emulator.
13 */ 26 */
14@@ -282,6 +282,22 @@ static void send_close(unsigned local, unsigned remote, atransport *t) 27@@ -288,6 +286,22 @@ static void send_close(unsigned local, unsigned remote, atransport *t)
15 send_packet(p, t); 28 send_packet(p, t);
16 } 29 }
17 30
@@ -34,104 +47,176 @@ index 07bfbe5..c8f37ff 100644
34 static size_t fill_connect_data(char *buf, size_t bufsize) 47 static size_t fill_connect_data(char *buf, size_t bufsize)
35 { 48 {
36 #if ADB_HOST 49 #if ADB_HOST
37@@ -1056,31 +1072,7 @@ static int should_drop_privileges() { 50@@ -1344,50 +1358,11 @@ int adb_main(int is_daemon, int server_port)
38 #ifndef ALLOW_ADBD_ROOT 51 " unchanged.\n");
39 return 1; 52 }
40 #else /* ALLOW_ADBD_ROOT */ 53
41- int secure = 0; 54- /* add extra groups:
42- char value[PROPERTY_VALUE_MAX]; 55- ** AID_ADB to access the USB driver
43- 56- ** AID_LOG to read system logs (adb logcat)
44- /* run adbd in secure mode if ro.secure is set and 57- ** AID_INPUT to diagnose input issues (getevent)
45- ** we are not in the emulator 58- ** AID_INET to diagnose network issues (netcfg, ping)
59- ** AID_GRAPHICS to access the frame buffer
60- ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)
61- ** AID_SDCARD_R to allow reading from the SD card
62- ** AID_SDCARD_RW to allow writing to the SD card
63- ** AID_NET_BW_STATS to read out qtaguid statistics
46- */ 64- */
47- property_get("ro.kernel.qemu", value, ""); 65- gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,
48- if (strcmp(value, "1") != 0) { 66- AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_R, AID_SDCARD_RW,
49- property_get("ro.secure", value, "1"); 67- AID_NET_BW_STATS };
50- if (strcmp(value, "1") == 0) { 68- if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) {
51- // don't run as root if ro.secure is set... 69- exit(1);
52- secure = 1; 70- }
53- 71-
54- // ... except we allow running as root in userdebug builds if the 72- /* don't listen on a port (default 5037) if running in secure mode */
55- // service.adb.root property has been set by the "adb root" command 73- /* don't run as root if we are running in secure mode */
56- property_get("ro.debuggable", value, ""); 74- if (should_drop_privileges()) {
57- if (strcmp(value, "1") == 0) { 75- drop_capabilities_bounding_set_if_needed();
58- property_get("service.adb.root", value, ""); 76
59- if (strcmp(value, "1") == 0) { 77- /* then switch user and group to "shell" */
60- secure = 0; 78- if (setgid(AID_SHELL) != 0) {
61- } 79- exit(1);
80- }
81- if (setuid(AID_SHELL) != 0) {
82- exit(1);
83- }
84-
85- D("Local port disabled\n");
86- } else {
87- char local_name[30];
88- if ((root_seclabel != NULL) && (is_selinux_enabled() > 0)) {
89- // b/12587913: fix setcon to allow const pointers
90- if (setcon((char *)root_seclabel) < 0) {
91- exit(1);
62- } 92- }
63- } 93- }
64- } 94- build_local_name(local_name, sizeof(local_name), server_port);
65- return secure; 95- if(install_listener(local_name, "*smartsocket*", NULL, 0)) {
66+ return 0; 96- exit(1);
67 #endif /* ALLOW_ADBD_ROOT */ 97- }
68 } 98+ char local_name[30];
69 #endif /* !ADB_HOST */ 99+ build_local_name(local_name, sizeof(local_name), server_port);
70@@ -1543,7 +1535,9 @@ int main(int argc, char **argv) 100+ if(install_listener(local_name, "*smartsocket*", NULL, 0)) {
101+ exit(1);
102 }
103
104 int usb = 0;
105@@ -1408,10 +1383,9 @@ int adb_main(int is_daemon, int server_port)
106 printf("using port=%d\n", port);
107 // listen on TCP port specified by service.adb.tcp.port property
108 local_init(port);
109- } else if (!usb) {
110- // listen on default port
111- local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT);
112 }
113+ // listen on default port
114+ local_init(DEFAULT_ADB_LOCAL_TRANSPORT_PORT);
115
116 D("adb_main(): pre init_jdwp()\n");
117 init_jdwp();
118@@ -1695,7 +1669,6 @@ int main(int argc, char **argv)
71 #else 119 #else
72 /* If adbd runs inside the emulator this will enable adb tracing via 120 /* If adbd runs inside the emulator this will enable adb tracing via
73 * adb-debug qemud service in the emulator. */ 121 * adb-debug qemud service in the emulator. */
74+#if ADB_QEMU 122- adb_qemu_trace_init();
75 adb_qemu_trace_init(); 123 while(1) {
76+#endif 124 int c;
77 if((argc > 1) && (!strcmp(argv[1],"recovery"))) { 125 int option_index = 0;
78 adb_device_banner = "recovery"; 126diff --git a/adb/adb_trace.h b/adb/adb_trace.h
79 recovery_mode = 1; 127index 8a5d9f8..01c4c06 100644
80diff --git a/adb/adb.h b/adb/adb.h 128--- a/adb/adb_trace.h
81index 9da8af8..ae3dd31 100644 129+++ b/adb/adb_trace.h
82--- a/adb/adb.h 130@@ -22,7 +22,7 @@
83+++ b/adb/adb.h 131 #endif
84@@ -363,7 +363,7 @@ typedef enum {
85
86 #if ADB_TRACE
87 132
88-#if !ADB_HOST 133 /* define ADB_TRACE to 1 to enable tracing support, or 0 to disable it */
89+#if !ADB_HOST && ADB_QEMU 134-#define ADB_TRACE 1
90 /* 135+#define ADB_TRACE 0
91 * When running inside the emulator, guest's adbd can connect to 'adb-debug' 136
92 * qemud service that can display adb trace messages (on condition that emulator 137 /* IMPORTANT: if you change the following list, don't
138 * forget to update the corresponding 'tags' table in
139diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c
140index 7933858..3cbd0cd 100644
141--- a/adb/file_sync_service.c
142+++ b/adb/file_sync_service.c
143@@ -26,7 +26,6 @@
144
145 #include <errno.h>
146 #include <private/android_filesystem_config.h>
147-#include <selinux/android.h>
148 #include "sysdeps.h"
149
150 #define TRACE_TAG TRACE_SYNC
151@@ -73,7 +72,6 @@ static int mkdirs(char *name)
152 *x = '/';
153 return ret;
154 }
155- selinux_android_restorecon(name, 0);
156 }
157 *x++ = '/';
158 }
159@@ -251,7 +249,6 @@ static int handle_send_file(int s, char *path, uid_t uid,
160 if(fd >= 0) {
161 struct utimbuf u;
162 adb_close(fd);
163- selinux_android_restorecon(path, 0);
164 u.actime = timestamp;
165 u.modtime = timestamp;
166 utime(path, &u);
93diff --git a/adb/remount_service.c b/adb/remount_service.c 167diff --git a/adb/remount_service.c b/adb/remount_service.c
94index 4cb41e7..6cfc2c6 100644 168index 72d15a1..df64799 100644
95--- a/adb/remount_service.c 169--- a/adb/remount_service.c
96+++ b/adb/remount_service.c 170+++ b/adb/remount_service.c
97@@ -77,12 +77,12 @@ static int remount_system() 171@@ -28,7 +28,7 @@
98 return 0; 172 #include "adb.h"
99 }
100 173
101- dev = find_mount("/system");
102+ dev = find_mount("/");
103 174
104 if (!dev) 175-static int system_ro = 1;
105 return -1; 176+static int system_ro = 0;
177 static int vendor_ro = 1;
106 178
107- system_ro = mount(dev, "/system", "none", MS_REMOUNT, NULL); 179 /* Returns the device used to mount a directory in /proc/mounts */
108+ system_ro = mount(dev, "/", "none", MS_REMOUNT, NULL); 180@@ -84,7 +84,7 @@ static int remount(const char* dir, int* dir_ro)
181 int fd;
182 int OFF = 0;
109 183
110 free(dev); 184- if (dir_ro == 0) {
185+ if (*dir_ro == 0) {
186 return 0;
187 }
188
189@@ -132,7 +132,6 @@ void remount_service(int fd, void *cookie)
190 else {
191 write_string(fd, "remount failed\n");
192 }
193-
194 adb_close(fd);
195 }
111 196
112diff --git a/adb/services.c b/adb/services.c 197diff --git a/adb/services.c b/adb/services.c
113index 495a083..eb895ae 100644 198index e61371a..8d4e2b5 100644
114--- a/adb/services.c 199--- a/adb/services.c
115+++ b/adb/services.c 200+++ b/adb/services.c
116@@ -33,7 +33,7 @@ 201@@ -34,7 +34,7 @@
117 # include <sys/ioctl.h> 202 # include <sys/ioctl.h>
118 # endif 203 # endif
119 #else 204 #else
120-# include <cutils/android_reboot.h> 205-# include <cutils/android_reboot.h>
121+# include <linux/reboot.h> 206+# include <sys/reboot.h>
207 # include <cutils/properties.h>
122 #endif 208 #endif
123 209
124 typedef struct stinfo stinfo; 210@@ -127,7 +127,7 @@ void reboot_service(int fd, void *arg)
125@@ -182,7 +182,7 @@ void reboot_service(int fd, void *arg) 211 goto cleanup;
126 waitpid(pid, &ret, 0);
127 } 212 }
128 213
129- ret = android_reboot(ANDROID_RB_RESTART2, 0, (char *) arg); 214- ret = property_set(ANDROID_RB_PROPERTY, property_val);
130+ ret = reboot(LINUX_REBOOT_CMD_RESTART2, 0, (char *) arg); 215+ ret = reboot(RB_AUTOBOOT);
131 if (ret < 0) { 216 if (ret < 0) {
132 snprintf(buf, sizeof(buf), "reboot failed: %s\n", strerror(errno)); 217 snprintf(buf, sizeof(buf), "reboot failed: %d\n", ret);
133 writex(fd, buf, strlen(buf)); 218 writex(fd, buf, strlen(buf));
134@@ -334,7 +334,7 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1 219@@ -302,7 +302,7 @@ static int create_subproc_raw(const char *cmd, const char *arg0, const char *arg
135 #if ADB_HOST 220 #if ADB_HOST
136 #define SHELL_COMMAND "/bin/sh" 221 #define SHELL_COMMAND "/bin/sh"
137 #else 222 #else
@@ -141,10 +226,10 @@ index 495a083..eb895ae 100644
141 226
142 #if !ADB_HOST 227 #if !ADB_HOST
143diff --git a/adb/transport_local.c b/adb/transport_local.c 228diff --git a/adb/transport_local.c b/adb/transport_local.c
144index 96a24ba..51c85fc 100644 229index 948cc15..d6d0a3a 100644
145--- a/adb/transport_local.c 230--- a/adb/transport_local.c
146+++ b/adb/transport_local.c 231+++ b/adb/transport_local.c
147@@ -186,7 +186,7 @@ static void *server_socket_thread(void * arg) 232@@ -189,7 +189,7 @@ static void *server_socket_thread(void * arg)
148 } 233 }
149 234
150 /* This is relevant only for ADB daemon running inside the emulator. */ 235 /* This is relevant only for ADB daemon running inside the emulator. */
@@ -153,7 +238,7 @@ index 96a24ba..51c85fc 100644
153 /* 238 /*
154 * Redefine open and write for qemu_pipe.h that contains inlined references 239 * Redefine open and write for qemu_pipe.h that contains inlined references
155 * to those routines. We will redifine them back after qemu_pipe.h inclusion. 240 * to those routines. We will redifine them back after qemu_pipe.h inclusion.
156@@ -304,7 +304,7 @@ void local_init(int port) 241@@ -307,7 +307,7 @@ void local_init(int port)
157 if(HOST) { 242 if(HOST) {
158 func = client_socket_thread; 243 func = client_socket_thread;
159 } else { 244 } else {
@@ -162,16 +247,19 @@ index 96a24ba..51c85fc 100644
162 func = server_socket_thread; 247 func = server_socket_thread;
163 #else 248 #else
164 /* For the adbd daemon in the system image we need to distinguish 249 /* For the adbd daemon in the system image we need to distinguish
165diff --git a/adb/transport_usb.c b/adb/transport_usb.c 250diff --git a/include/cutils/properties.h b/include/cutils/properties.h
166index ee6b637..c5e1408 100644 251index 798db8b..c86f312 100644
167--- a/adb/transport_usb.c 252--- a/include/cutils/properties.h
168+++ b/adb/transport_usb.c 253+++ b/include/cutils/properties.h
169@@ -18,7 +18,7 @@ 254@@ -19,8 +19,9 @@
170 #include <stdlib.h> 255
171 #include <string.h> 256 #include <sys/cdefs.h>
172 257 #include <stddef.h>
173-#include <sysdeps.h> 258-#include <sys/system_properties.h>
174+#include "sysdeps.h" 259-#include <stdint.h>
175 260+
176 #define TRACE_TAG TRACE_TRANSPORT 261+#define PROP_NAME_MAX 32
177 #include "adb.h" 262+#define PROP_VALUE_MAX 92
263
264 #ifdef __cplusplus
265 extern "C" {