From 65ad928602479379187d6fbe1d924f0fd60bea0e Mon Sep 17 00:00:00 2001 From: Da Zhou Date: Fri, 17 Jan 2014 01:04:07 -0800 Subject: ADB sideload command not work In kernel(3.10) USB ADB gadget driver is removed. Using Functionfs for USB adb gadget. Android recovery uses a stripped down version of adb command for sideload only. It's missing the ffs function support, so add the ffs support to allow sideload command to work b/12608946 Change-Id: I4ad024723dfc5bdb544548391f99637c390b171e Signed-off-by: Pierre Couillaud --- minadbd/adb.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'minadbd/adb.h') diff --git a/minadbd/adb.h b/minadbd/adb.h index 98fa5972e..1f28279d3 100644 --- a/minadbd/adb.h +++ b/minadbd/adb.h @@ -410,6 +410,17 @@ extern int SHELL_EXIT_NOTIFY_FD; #define CHUNK_SIZE (64*1024) +#if !ADB_HOST +#define USB_ADB_PATH "/dev/android_adb" + +#define USB_FFS_ADB_PATH "/dev/usb-ffs/adb/" +#define USB_FFS_ADB_EP(x) USB_FFS_ADB_PATH#x + +#define USB_FFS_ADB_EP0 USB_FFS_ADB_EP(ep0) +#define USB_FFS_ADB_OUT USB_FFS_ADB_EP(ep1) +#define USB_FFS_ADB_IN USB_FFS_ADB_EP(ep2) +#endif + int sendfailmsg(int fd, const char *reason); int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s); -- cgit v1.2.3 From e787fee8f28d7cf6ab15635671ec46b1ce6bc87d Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 23 Jan 2014 16:39:22 -0800 Subject: minadbd: remove dead code Change-Id: Ia1f34a17ae582575f8cd3514ed7bc015b0a5006e --- minadbd/adb.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'minadbd/adb.h') diff --git a/minadbd/adb.h b/minadbd/adb.h index 98fa5972e..688a6f273 100644 --- a/minadbd/adb.h +++ b/minadbd/adb.h @@ -244,15 +244,11 @@ void kick_transport( atransport* t ); #if ADB_HOST int get_available_local_transport_index(); #endif -int init_socket_transport(atransport *t, int s, int port, int local); void init_usb_transport(atransport *t, usb_handle *usb, int state); /* for MacOS X cleanup */ void close_usb_devices(); -/* cause new transports to be init'd and added to the list */ -void register_socket_transport(int s, const char *serial, int port, int local); - /* these should only be used for the "adb disconnect" command */ void unregister_transport(atransport *t); void unregister_all_tcp_transports(); -- cgit v1.2.3 From 075ad800c539503d0515e5e0b4af160eccedead9 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 26 Jun 2014 15:35:51 -0700 Subject: sideload without holding the whole package in RAM Implement a new method of sideloading over ADB that does not require the entire package to be held in RAM (useful for low-RAM devices and devices using block OTA where we'd rather have more RAM available for binary patching). We communicate with the host using a new adb service called "sideload-host", which makes the host act as a server, sending us different parts of the package file on request. We create a FUSE filesystem that creates a virtual file "/sideload/package.zip" that is backed by the ADB connection -- users see a normal file, but when they read from the file we're actually fetching the data from the adb host. This file is then passed to the verification and installation systems like any other. To prevent a malicious adb host implementation from serving different data to the verification and installation phases of sideloading, the FUSE filesystem verifies that the contents of the file don't change between reads -- every time we fetch a block from the host we compare its hash to the previous hash for that block (if it was read before) and cause the read to fail if it changes. One necessary change is that the minadbd started by recovery in sideload mode no longer drops its root privileges (they're needed to mount the FUSE filesystem). We rely on SELinux enforcement to restrict the set of things that can be accessed. Change-Id: Ida7dbd3b04c1d4e27a2779d88c1da0c7c81fb114 --- minadbd/adb.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'minadbd/adb.h') diff --git a/minadbd/adb.h b/minadbd/adb.h index d389165ae..770f34d19 100644 --- a/minadbd/adb.h +++ b/minadbd/adb.h @@ -400,6 +400,7 @@ int connection_state(atransport *t); #define CS_RECOVERY 4 #define CS_NOPERM 5 /* Insufficient permissions to communicate with the device */ #define CS_SIDELOAD 6 +#define CS_UNAUTHORIZED 7 extern int HOST; extern int SHELL_EXIT_NOTIFY_FD; @@ -420,6 +421,11 @@ extern int SHELL_EXIT_NOTIFY_FD; int sendfailmsg(int fd, const char *reason); int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s); -#define ADB_SIDELOAD_FILENAME "/tmp/update.zip" +// define the filenames created by the sideload-host FUSE filesystem +#define ADB_SIDELOAD_HOST_MOUNTPOINT "/sideload" +#define ADB_SIDELOAD_HOST_FILENAME "package.zip" +#define ADB_SIDELOAD_HOST_PATHNAME (ADB_SIDELOAD_HOST_MOUNTPOINT "/" ADB_SIDELOAD_HOST_FILENAME) +#define ADB_SIDELOAD_HOST_EXIT_FLAG "exit" +#define ADB_SIDELOAD_HOST_EXIT_PATHNAME (ADB_SIDELOAD_HOST_MOUNTPOINT "/" ADB_SIDELOAD_HOST_EXIT_FLAG) #endif -- cgit v1.2.3 From 18a78e0a162c35756628610307f41179816d3333 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 10 Jul 2014 07:31:46 -0700 Subject: refactor fuse sideloading code Split the adb-specific portions (fetching a block from the adb host and closing the connections) out from the rest of the FUSE filesystem code, so that we can reuse the fuse stuff for installing off sdcards as well. Change-Id: I0ba385fd35999c5f5cad27842bc82024a264dd14 --- minadbd/adb.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'minadbd/adb.h') diff --git a/minadbd/adb.h b/minadbd/adb.h index 770f34d19..714868f5c 100644 --- a/minadbd/adb.h +++ b/minadbd/adb.h @@ -421,11 +421,4 @@ extern int SHELL_EXIT_NOTIFY_FD; int sendfailmsg(int fd, const char *reason); int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s); -// define the filenames created by the sideload-host FUSE filesystem -#define ADB_SIDELOAD_HOST_MOUNTPOINT "/sideload" -#define ADB_SIDELOAD_HOST_FILENAME "package.zip" -#define ADB_SIDELOAD_HOST_PATHNAME (ADB_SIDELOAD_HOST_MOUNTPOINT "/" ADB_SIDELOAD_HOST_FILENAME) -#define ADB_SIDELOAD_HOST_EXIT_FLAG "exit" -#define ADB_SIDELOAD_HOST_EXIT_PATHNAME (ADB_SIDELOAD_HOST_MOUNTPOINT "/" ADB_SIDELOAD_HOST_EXIT_FLAG) - #endif -- cgit v1.2.3