Initial commit

This commit is contained in:
domenico
2025-06-24 16:03:39 +02:00
commit f3256cdaf2
6949 changed files with 1441681 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
include $(TOPDIR)/rules.mk
#Based on adb package from AUR https://aur.archlinux.org/packages/adb/ , reused Makefile
PKG_NAME:=adb
PKG_VERSION:=android.5.0.2_r1
PKG_RELEASE:=3
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://android.googlesource.com/platform/system/core
PKG_SOURCE_VERSION:=6fe92d1a3fb17545d82d020a3c995f32e6b71f9d
PKG_MIRROR_HASH:=a9b4b86602dfc0d4fc9e1d0f78dc83e648a931fb04f5a4be9b1f0054a8cebf7e
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_MAINTAINER:=Henryk Heisig <hyniu@o2.pl>
include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_BIG_ENDIAN),y)
TARGET_CFLAGS+= -DHAVE_BIG_ENDIAN=1
endif
TARGET_CFLAGS+= -D_GNU_SOURCE
define Package/adb
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Android Debug Bridge CLI tool
URL:=http://tools.android.com/
DEPENDS:=+zlib +libopenssl +libpthread
endef
define Package/adb/description
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.
endef
# Nothing just to be sure
#define Build/Configure
#endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR)/adb/ \
$(TARGET_CONFIGURE_OPTS) \
TARGET=Linux \
CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
endef
define Package/adb/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/adb/adb $(1)/usr/bin/
endef
$(eval $(call BuildPackage,adb))

View File

@@ -0,0 +1,45 @@
--- /dev/null
+++ b/adb/Makefile
@@ -0,0 +1,42 @@
+SRCS+= adb.c
+SRCS+= adb_auth_host.c
+SRCS+= adb_client.c
+SRCS+= commandline.c
+SRCS+= console.c
+SRCS+= fdevent.c
+SRCS+= file_sync_client.c
+SRCS+= get_my_path_linux.c
+SRCS+= services.c
+SRCS+= sockets.c
+SRCS+= transport.c
+SRCS+= transport_local.c
+SRCS+= transport_usb.c
+SRCS+= usb_linux.c
+
+VPATH+= ../libcutils
+SRCS+= load_file.c
+SRCS+= socket_inaddr_any_server.c
+SRCS+= socket_local_client.c
+SRCS+= socket_local_server.c
+SRCS+= socket_loopback_client.c
+SRCS+= socket_loopback_server.c
+SRCS+= socket_network_client.c
+
+VPATH+= ../libzipfile
+SRCS+= centraldir.c
+SRCS+= zipfile.c
+
+CPPFLAGS+= -DADB_HOST=1
+CPPFLAGS+= -DHAVE_FORKEXEC=1
+CPPFLAGS+= -I.
+CPPFLAGS+= -I../include
+CPPFLAGS+= -D_FILE_OFFSET_BITS=64
+
+LIBS+= -lcrypto -lpthread -lz
+
+OBJS= $(SRCS:.c=.o)
+
+all: adb
+
+adb: $(OBJS)
+ $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)

View File

@@ -0,0 +1,10 @@
--- a/adb/usb_linux.c
+++ b/adb/usb_linux.c
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/time.h>
#include <dirent.h>
#include <fcntl.h>

View File

@@ -0,0 +1,28 @@
--- a/adb/adb_auth_host.c
+++ b/adb/adb_auth_host.c
@@ -83,7 +83,13 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
}
BN_set_bit(r32, 32);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ const BIGNUM *rsa_n, *rsa_e;
+ RSA_get0_key(rsa, &rsa_n, &rsa_e, NULL);
+ BN_copy(n, rsa_n);
+#else
BN_copy(n, rsa->n);
+#endif
BN_set_bit(r, RSANUMWORDS * 32);
BN_mod_sqr(rr, r, n, ctx);
BN_div(NULL, rem, n, r32, ctx);
@@ -97,7 +103,11 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
BN_div(n, rem, n, r32, ctx);
pkey->n[i] = BN_get_word(rem);
}
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ pkey->exponent = BN_get_word(rsa_e);
+#else
pkey->exponent = BN_get_word(rsa->e);
+#endif
out:
BN_free(n0inv);

View File

@@ -0,0 +1,39 @@
From 58b01e01875e2f6ae593ded197430bc23713dd0a Mon Sep 17 00:00:00 2001
From: Ingo Rohloff <lundril@gmx.de>
Date: Fri, 16 May 2014 21:51:41 +0200
Subject: [PATCH] ADB on linux: Handle USB SuperSpeed extra Descriptors
Under Linux, ADB manually parses USB Descriptors to check for
possible ADB USB Interfaces. USB Devices connected with SuperSpeed
will exhibit extra USB SuperSpeed Endpoint Companion Descriptors.
This patch handles these USB SuperSpeed specific USB Descriptors.
Change-Id: Icd1e5fdde0b324c7df4f933583499f2c52a922f3
Signed-off-by: Ingo Rohloff <lundril@gmx.de>
---
adb/usb_linux.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/adb/usb_linux.c
+++ b/adb/usb_linux.c
@@ -238,8 +238,20 @@ static void find_usb_device(const char *
// looks like ADB...
ep1 = (struct usb_endpoint_descriptor *)bufptr;
bufptr += USB_DT_ENDPOINT_SIZE;
+ // For USB 3.0 SuperSpeed devices, skip potential
+ // USB 3.0 SuperSpeed Endpoint Companion descriptor
+ if (bufptr+2 <= devdesc + desclength &&
+ bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
+ bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
+ bufptr += USB_DT_SS_EP_COMP_SIZE;
+ }
ep2 = (struct usb_endpoint_descriptor *)bufptr;
bufptr += USB_DT_ENDPOINT_SIZE;
+ if (bufptr+2 <= devdesc + desclength &&
+ bufptr[0] == USB_DT_SS_EP_COMP_SIZE &&
+ bufptr[1] == USB_DT_SS_ENDPOINT_COMP) {
+ bufptr += USB_DT_SS_EP_COMP_SIZE;
+ }
if (bufptr > devdesc + desclength ||
ep1->bLength != USB_DT_ENDPOINT_SIZE ||