diff options
-rw-r--r-- | recipes/adbd/adbd.bb | 35 | ||||
-rw-r--r-- | recipes/adbd/files/Makefile.adbd | 38 | ||||
-rwxr-xr-x | recipes/adbd/files/adb-init | 22 | ||||
-rw-r--r-- | recipes/adbd/files/adbd.patch | 177 | ||||
-rw-r--r-- | recipes/images/b2qt-embedded-image.bb | 2 | ||||
-rw-r--r-- | recipes/linux/linux-boundary_3.0.35.bbappend | 3 | ||||
-rw-r--r-- | recipes/linux/linux-mainline_3.2.bbappend | 8 |
7 files changed, 283 insertions, 2 deletions
diff --git a/recipes/adbd/adbd.bb b/recipes/adbd/adbd.bb new file mode 100644 index 0000000..1cc8882 --- /dev/null +++ b/recipes/adbd/adbd.bb | |||
@@ -0,0 +1,35 @@ | |||
1 | DESCRIPTION = "Android Debug Bridge Daemon" | ||
2 | HOMEPAGE = "http://developer.android.com/tools/help/adb.html" | ||
3 | SECTION = "libs" | ||
4 | LICENSE = "GPLv2" | ||
5 | LIC_FILES_CHKSUM = "file://ThirdPartyProject.prop;md5=4e5987c5919a36739dc8f76a4e35d9eb" | ||
6 | |||
7 | PR = "r0" | ||
8 | SRCREV = "android-4.2.2_r1.2" | ||
9 | |||
10 | SRC_URI = "git://android.googlesource.com/platform/system/core;protocol=https;tag=${SRCREV} \ | ||
11 | file://adbd.patch \ | ||
12 | file://Makefile.adbd \ | ||
13 | file://adb-init \ | ||
14 | " | ||
15 | |||
16 | S = "${WORKDIR}/git" | ||
17 | |||
18 | FILES_${PN} += "${bindir}/adbd" | ||
19 | |||
20 | do_compile() { | ||
21 | make -C adb -f ${WORKDIR}/Makefile.adbd | ||
22 | } | ||
23 | |||
24 | do_install() { | ||
25 | install -m 0755 -d ${D}${bindir}/ | ||
26 | install -m 0755 ${WORKDIR}/git/adb/adbd ${D}${bindir}/ | ||
27 | |||
28 | install -m 0755 -d ${D}${sysconfdir}/init.d | ||
29 | install -m 0755 ${WORKDIR}/adb-init ${D}${sysconfdir}/init.d/ | ||
30 | } | ||
31 | |||
32 | INITSCRIPT_NAME = "adb-init" | ||
33 | INITSCRIPT_PARAMS = "defaults 96" | ||
34 | |||
35 | inherit update-rc.d | ||
diff --git a/recipes/adbd/files/Makefile.adbd b/recipes/adbd/files/Makefile.adbd new file mode 100644 index 0000000..a24b670 --- /dev/null +++ b/recipes/adbd/files/Makefile.adbd | |||
@@ -0,0 +1,38 @@ | |||
1 | LOCAL_SRC_FILES := \ | ||
2 | adb.c \ | ||
3 | backup_service.c \ | ||
4 | fdevent.c \ | ||
5 | transport.c \ | ||
6 | transport_local.c \ | ||
7 | transport_usb.c \ | ||
8 | adb_auth_client.c \ | ||
9 | sockets.c \ | ||
10 | services.c \ | ||
11 | file_sync_service.c \ | ||
12 | jdwp_service.c \ | ||
13 | framebuffer_service.c \ | ||
14 | remount_service.c \ | ||
15 | usb_linux_client.c \ | ||
16 | log_service.c \ | ||
17 | utils.c | ||
18 | |||
19 | LOCAL_OBJ_FILES=$(LOCAL_SRC_FILES:%.c=%.o) | ||
20 | |||
21 | LIBCUTILS_SRC_FILES := \ | ||
22 | ../libcutils/socket_inaddr_any_server.c \ | ||
23 | ../libcutils/socket_local_client.c \ | ||
24 | ../libcutils/socket_local_server.c \ | ||
25 | ../libcutils/socket_loopback_client.c \ | ||
26 | ../libcutils/socket_loopback_server.c \ | ||
27 | ../libcutils/list.c | ||
28 | |||
29 | LIBCUTILS_OBJ_FILES=$(LIBCUTILS_SRC_FILES:%.c=%.o) | ||
30 | |||
31 | adbd: $(LOCAL_OBJ_FILES) $(LIBCUTILS_OBJ_FILES) | ||
32 | $(CC) $^ -o $@ -lcrypto -Wl,--as-needed -ldl -lpthread -lresolv | ||
33 | |||
34 | ../libcutils/%.o: ../libcutils/%.c | ||
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 | ||
36 | |||
37 | %.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 | ||
diff --git a/recipes/adbd/files/adb-init b/recipes/adbd/files/adb-init new file mode 100755 index 0000000..6f2910e --- /dev/null +++ b/recipes/adbd/files/adb-init | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | case "$1" in | ||
3 | start) | ||
4 | insmod $(busybox find /lib/modules/$(uname -r) -name "g_ffs.ko") idVendor=0x18d1 idProduct=0x4e26 iSerialNumber=$(hostname) | ||
5 | mkdir -p /dev/usb-ffs | ||
6 | chmod 770 /dev/usb-ffs | ||
7 | mkdir -p /dev/usb-ffs/adb | ||
8 | chmod 770 /dev/usb-ffs/adb | ||
9 | mount -t functionfs adb /dev/usb-ffs/adb -o uid=0,gid=0 | ||
10 | |||
11 | /usr/bin/adbd & | ||
12 | ;; | ||
13 | stop) | ||
14 | killall adbd | ||
15 | umount /dev/usb-ffs/adb | ||
16 | rmmod g_ffs | ||
17 | ;; | ||
18 | *) | ||
19 | echo "Usage: $0 {start|stop}" | ||
20 | exit 1 | ||
21 | esac | ||
22 | exit 0 | ||
diff --git a/recipes/adbd/files/adbd.patch b/recipes/adbd/files/adbd.patch new file mode 100644 index 0000000..110b021 --- /dev/null +++ b/recipes/adbd/files/adbd.patch | |||
@@ -0,0 +1,177 @@ | |||
1 | diff --git a/adb/adb.c b/adb/adb.c | ||
2 | index 07bfbe5..c8f37ff 100644 | ||
3 | --- a/adb/adb.c | ||
4 | +++ b/adb/adb.c | ||
5 | @@ -141,7 +141,7 @@ void adb_trace_init(void) | ||
6 | } | ||
7 | } | ||
8 | |||
9 | -#if !ADB_HOST | ||
10 | +#if !ADB_HOST && ADB_QEMU | ||
11 | /* | ||
12 | * Implements ADB tracing inside the emulator. | ||
13 | */ | ||
14 | @@ -282,6 +282,22 @@ static void send_close(unsigned local, unsigned remote, atransport *t) | ||
15 | send_packet(p, t); | ||
16 | } | ||
17 | |||
18 | +int property_set(const char *key, const char *value) | ||
19 | +{ | ||
20 | + return 0; | ||
21 | +} | ||
22 | + | ||
23 | +int property_get(const char *key, char *value, const char *fallback) | ||
24 | +{ | ||
25 | + if (fallback) { | ||
26 | + strncpy(value, fallback, PROPERTY_VALUE_MAX-1); | ||
27 | + return strlen(fallback); | ||
28 | + } else { | ||
29 | + value[0] = 0; | ||
30 | + return 0; | ||
31 | + } | ||
32 | +} | ||
33 | + | ||
34 | static size_t fill_connect_data(char *buf, size_t bufsize) | ||
35 | { | ||
36 | #if ADB_HOST | ||
37 | @@ -1056,31 +1072,7 @@ static int should_drop_privileges() { | ||
38 | #ifndef ALLOW_ADBD_ROOT | ||
39 | return 1; | ||
40 | #else /* ALLOW_ADBD_ROOT */ | ||
41 | - int secure = 0; | ||
42 | - char value[PROPERTY_VALUE_MAX]; | ||
43 | - | ||
44 | - /* run adbd in secure mode if ro.secure is set and | ||
45 | - ** we are not in the emulator | ||
46 | - */ | ||
47 | - property_get("ro.kernel.qemu", value, ""); | ||
48 | - if (strcmp(value, "1") != 0) { | ||
49 | - property_get("ro.secure", value, "1"); | ||
50 | - if (strcmp(value, "1") == 0) { | ||
51 | - // don't run as root if ro.secure is set... | ||
52 | - secure = 1; | ||
53 | - | ||
54 | - // ... except we allow running as root in userdebug builds if the | ||
55 | - // service.adb.root property has been set by the "adb root" command | ||
56 | - property_get("ro.debuggable", value, ""); | ||
57 | - if (strcmp(value, "1") == 0) { | ||
58 | - property_get("service.adb.root", value, ""); | ||
59 | - if (strcmp(value, "1") == 0) { | ||
60 | - secure = 0; | ||
61 | - } | ||
62 | - } | ||
63 | - } | ||
64 | - } | ||
65 | - return secure; | ||
66 | + return 0; | ||
67 | #endif /* ALLOW_ADBD_ROOT */ | ||
68 | } | ||
69 | #endif /* !ADB_HOST */ | ||
70 | @@ -1543,7 +1535,9 @@ int main(int argc, char **argv) | ||
71 | #else | ||
72 | /* If adbd runs inside the emulator this will enable adb tracing via | ||
73 | * adb-debug qemud service in the emulator. */ | ||
74 | +#if ADB_QEMU | ||
75 | adb_qemu_trace_init(); | ||
76 | +#endif | ||
77 | if((argc > 1) && (!strcmp(argv[1],"recovery"))) { | ||
78 | adb_device_banner = "recovery"; | ||
79 | recovery_mode = 1; | ||
80 | diff --git a/adb/adb.h b/adb/adb.h | ||
81 | index 9da8af8..ae3dd31 100644 | ||
82 | --- a/adb/adb.h | ||
83 | +++ b/adb/adb.h | ||
84 | @@ -363,7 +363,7 @@ typedef enum { | ||
85 | |||
86 | #if ADB_TRACE | ||
87 | |||
88 | -#if !ADB_HOST | ||
89 | +#if !ADB_HOST && ADB_QEMU | ||
90 | /* | ||
91 | * When running inside the emulator, guest's adbd can connect to 'adb-debug' | ||
92 | * qemud service that can display adb trace messages (on condition that emulator | ||
93 | diff --git a/adb/remount_service.c b/adb/remount_service.c | ||
94 | index 4cb41e7..6cfc2c6 100644 | ||
95 | --- a/adb/remount_service.c | ||
96 | +++ b/adb/remount_service.c | ||
97 | @@ -77,12 +77,12 @@ static int remount_system() | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | - dev = find_mount("/system"); | ||
102 | + dev = find_mount("/"); | ||
103 | |||
104 | if (!dev) | ||
105 | return -1; | ||
106 | |||
107 | - system_ro = mount(dev, "/system", "none", MS_REMOUNT, NULL); | ||
108 | + system_ro = mount(dev, "/", "none", MS_REMOUNT, NULL); | ||
109 | |||
110 | free(dev); | ||
111 | |||
112 | diff --git a/adb/services.c b/adb/services.c | ||
113 | index 495a083..eb895ae 100644 | ||
114 | --- a/adb/services.c | ||
115 | +++ b/adb/services.c | ||
116 | @@ -33,7 +33,7 @@ | ||
117 | # include <sys/ioctl.h> | ||
118 | # endif | ||
119 | #else | ||
120 | -# include <cutils/android_reboot.h> | ||
121 | +# include <linux/reboot.h> | ||
122 | #endif | ||
123 | |||
124 | typedef struct stinfo stinfo; | ||
125 | @@ -182,7 +182,7 @@ void reboot_service(int fd, void *arg) | ||
126 | waitpid(pid, &ret, 0); | ||
127 | } | ||
128 | |||
129 | - ret = android_reboot(ANDROID_RB_RESTART2, 0, (char *) arg); | ||
130 | + ret = reboot(LINUX_REBOOT_CMD_RESTART2, 0, (char *) arg); | ||
131 | if (ret < 0) { | ||
132 | snprintf(buf, sizeof(buf), "reboot failed: %s\n", strerror(errno)); | ||
133 | writex(fd, buf, strlen(buf)); | ||
134 | @@ -334,7 +334,7 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1 | ||
135 | #if ADB_HOST | ||
136 | #define SHELL_COMMAND "/bin/sh" | ||
137 | #else | ||
138 | -#define SHELL_COMMAND "/system/bin/sh" | ||
139 | +#define SHELL_COMMAND "/bin/sh" | ||
140 | #endif | ||
141 | |||
142 | #if !ADB_HOST | ||
143 | diff --git a/adb/transport_local.c b/adb/transport_local.c | ||
144 | index 96a24ba..51c85fc 100644 | ||
145 | --- a/adb/transport_local.c | ||
146 | +++ b/adb/transport_local.c | ||
147 | @@ -186,7 +186,7 @@ static void *server_socket_thread(void * arg) | ||
148 | } | ||
149 | |||
150 | /* This is relevant only for ADB daemon running inside the emulator. */ | ||
151 | -#if !ADB_HOST | ||
152 | +#if !ADB_HOST && ADB_QEMU | ||
153 | /* | ||
154 | * 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. | ||
156 | @@ -304,7 +304,7 @@ void local_init(int port) | ||
157 | if(HOST) { | ||
158 | func = client_socket_thread; | ||
159 | } else { | ||
160 | -#if ADB_HOST | ||
161 | +#if ADB_HOST || !ADB_QEMU | ||
162 | func = server_socket_thread; | ||
163 | #else | ||
164 | /* For the adbd daemon in the system image we need to distinguish | ||
165 | diff --git a/adb/transport_usb.c b/adb/transport_usb.c | ||
166 | index ee6b637..c5e1408 100644 | ||
167 | --- a/adb/transport_usb.c | ||
168 | +++ b/adb/transport_usb.c | ||
169 | @@ -18,7 +18,7 @@ | ||
170 | #include <stdlib.h> | ||
171 | #include <string.h> | ||
172 | |||
173 | -#include <sysdeps.h> | ||
174 | +#include "sysdeps.h" | ||
175 | |||
176 | #define TRACE_TAG TRACE_TRANSPORT | ||
177 | #include "adb.h" | ||
diff --git a/recipes/images/b2qt-embedded-image.bb b/recipes/images/b2qt-embedded-image.bb index 494b433..dbcd8f8 100644 --- a/recipes/images/b2qt-embedded-image.bb +++ b/recipes/images/b2qt-embedded-image.bb | |||
@@ -60,6 +60,8 @@ IMAGE_INSTALL += "\ | |||
60 | freetype \ | 60 | freetype \ |
61 | fontconfig \ | 61 | fontconfig \ |
62 | liberation-fonts \ | 62 | liberation-fonts \ |
63 | adbd \ | ||
64 | kernel-module-g-ffs \ | ||
63 | ${GSTREAMER_EXTRA_INSTALL} \ | 65 | ${GSTREAMER_EXTRA_INSTALL} \ |
64 | ${TOOLS_EXTRA_INSTALL} \ | 66 | ${TOOLS_EXTRA_INSTALL} \ |
65 | ${MACHINE_EXTRA_INSTALL} \ | 67 | ${MACHINE_EXTRA_INSTALL} \ |
diff --git a/recipes/linux/linux-boundary_3.0.35.bbappend b/recipes/linux/linux-boundary_3.0.35.bbappend index fff9f24..6d30629 100644 --- a/recipes/linux/linux-boundary_3.0.35.bbappend +++ b/recipes/linux/linux-boundary_3.0.35.bbappend | |||
@@ -3,4 +3,7 @@ do_configure_prepend() { | |||
3 | # Use multitouch protocol for touchscreen that support it | 3 | # Use multitouch protocol for touchscreen that support it |
4 | echo "CONFIG_TOUCHSCREEN_EGALAX_SINGLE_TOUCH=n" >> ${WORKDIR}/defconfig | 4 | echo "CONFIG_TOUCHSCREEN_EGALAX_SINGLE_TOUCH=n" >> ${WORKDIR}/defconfig |
5 | echo "CONFIG_TOUCHSCREEN_FT5X06_SINGLE_TOUCH=n" >> ${WORKDIR}/defconfig | 5 | echo "CONFIG_TOUCHSCREEN_FT5X06_SINGLE_TOUCH=n" >> ${WORKDIR}/defconfig |
6 | |||
7 | # FunctionFS for adb | ||
8 | echo "CONFIG_USB_FUNCTIONFS=m" >> ${WORKDIR}/defconfig | ||
6 | } | 9 | } |
diff --git a/recipes/linux/linux-mainline_3.2.bbappend b/recipes/linux/linux-mainline_3.2.bbappend index 0cfda85..1e979da 100644 --- a/recipes/linux/linux-mainline_3.2.bbappend +++ b/recipes/linux/linux-mainline_3.2.bbappend | |||
@@ -1,7 +1,11 @@ | |||
1 | |||
2 | do_configure_prepend() { | 1 | do_configure_prepend() { |
3 | # Builtin network driver, so networking is initialized correctly during boot | 2 | # Builtin network driver, so networking is initialized correctly during boot |
4 | echo "CONFIG_USB_NET_SMSC95XX=y" >> ${WORKDIR}/defconfig | 3 | echo "CONFIG_USB_NET_SMSC95XX=y" >> ${WORKDIR}/defconfig |
4 | |||
5 | # FunctionFS for adb | ||
6 | echo "CONFIG_USB_FUNCTIONFS_ETH=n" >> ${WORKDIR}/defconfig | ||
7 | echo "CONFIG_USB_FUNCTIONFS_RNDIS=n" >> ${WORKDIR}/defconfig | ||
8 | echo "CONFIG_USB_FUNCTIONFS_GENERIC=y" >> ${WORKDIR}/defconfig | ||
5 | 9 | ||
6 | # Remove beagleboard logo | 10 | # Remove beagleboard logo |
7 | if [ -e ${WORKDIR}/${LOGO_SIZE}/logo_linux_clut224.ppm ]; then | 11 | if [ -e ${WORKDIR}/${LOGO_SIZE}/logo_linux_clut224.ppm ]; then |