diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 10:05:37 -0700 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-22 21:26:31 -0400 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /meta-openembedded/meta-oe/recipes-devtools/android-tools | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | talos-openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.gz talos-openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.zip |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-devtools/android-tools')
21 files changed, 1706 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup new file mode 100644 index 000000000..f7d997372 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup @@ -0,0 +1,25 @@ +#!/bin/sh + +# TODO enable the lines below once we have support for getprop +# retrieve the product info from Android +# manufacturer=$(getprop ro.product.manufacturer Android) +# model=$(getprop ro.product.model Android) +# serial=$(getprop ro.serialno 0123456789ABCDEF) + +manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)" +model="$(cat /system/build.prop | grep -o 'ro.product.model=.*' | cut -d'=' -f 2)" +# get the device serial number from /proc/cmdline directly(since we have no getprop on +# GNU/Linux) +serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')" + +echo $serial > /sys/class/android_usb/android0/iSerial +echo $manufacturer > /sys/class/android_usb/android0/iManufacturer +echo $model > /sys/class/android_usb/android0/iProduct + +echo "0" > /sys/class/android_usb/android0/enable +echo "18d1" > /sys/class/android_usbid_usb/android0/idVendor +echo "D002" > /sys/class/android_usb/android0/idProduct +echo "adb" > /sys/class/android_usb/android0/functions +echo "1" > /sys/class/android_usb/android0/enable + +sleep 4 diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb new file mode 100644 index 000000000..af98f92f0 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb @@ -0,0 +1,13 @@ +DESCRIPTION = "Different utilities from Android - corressponding configuration files" +SECTION = "console/utils" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://android-gadget-setup" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/android-gadget-setup ${D}${bindir} +} diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/.gitignore b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/.gitignore new file mode 100644 index 000000000..b034c10a1 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/.gitignore @@ -0,0 +1,59 @@ +* +!.gitignore +!*.indirectionsymlink +!*.[ch] +!*.mk +!*.patch +!*.service +!NOTICE +!MODULE_LICENSE_* +!/system/ +!/system/core/ +!/system/core/adb/ +!/system/core/fastboot/ +!/system/core/fs_mgr/ +!/system/core/fs_mgr/include/ +!/system/core/include/ +!/system/core/include/android/ +!/system/core/include/cutils/ +!/system/core/include/log/ +!/system/core/include/mincrypt/ +!/system/core/include/private/ +!/system/core/include/utils/ +!/system/core/include/zipfile/ +!/system/core/liblog/ +!/system/core/liblog/tests/ +!/system/core/libcutils/ +!/system/core/libmincrypt/ +!/system/core/libzipfile/ +!/system/core/libsparse/ +!/system/core/libsparse/include/ +!/system/core/libsparse/include/sparse/ +!/system/core/libsparse/simg_dump.py +!/system/core/mkbootimg/ +!/system/extras/ +!/system/extras/ext4_utils/ +!/system/extras/ext4_utils/mkuserimg.sh +!/system/extras/ext4_utils/test_ext4fixup +!/system/extras/f2fs_utils/ +!/hardware/ +!/hardware/libhardware/ +!/hardware/libhardware/include/ +!/hardware/libhardware/include/hardware/ +!/external/ +!/external/libselinux/ +!/external/libselinux/include/ +!/external/libselinux/include/selinux/ +!/external/libselinux/src/ +!/external/f2fs-tools/ +!/external/f2fs-tools/include/ +!/external/f2fs-tools/lib/ +!/external/f2fs-tools/mkfs/ +!/build/ +!/build/core/ +!/build/core/version_defaults.mk +!/build/core/combo/ +!/build/core/combo/include/ +!/build/core/combo/include/arch/ +!/build/core/combo/include/arch/linux-*/ +!/build/core/combo/include/arch/linux-*/AndroidConfig.h diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/0001-add-base64-implementation.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/0001-add-base64-implementation.patch new file mode 100644 index 000000000..680d21f3a --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/0001-add-base64-implementation.patch @@ -0,0 +1,351 @@ +From bbeb72f11c64f190b23abbed5f44311bd021bdc9 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 15 Sep 2017 15:46:38 -0700 +Subject: [PATCH 1/2] add base64 implementation + +musl needs it + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + system/core/adb/adb_auth_client.c | 2 +- + system/core/adb/base64.c | 315 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 316 insertions(+), 1 deletion(-) + create mode 100644 system/core/adb/base64.c + +diff --git a/system/core/adb/adb_auth_client.c b/system/core/adb/adb_auth_client.c +index 55e9dca..104b413 100644 +--- a/system/core/adb/adb_auth_client.c ++++ b/system/core/adb/adb_auth_client.c +@@ -75,7 +75,7 @@ static void read_keys(const char *file, struct listnode *list) + if (sep) + *sep = '\0'; + +- ret = __b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4); ++ ret = b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4); + if (ret != sizeof(key->key)) { + D("%s: Invalid base64 data ret=%d\n", file, ret); + free(key); +diff --git a/system/core/adb/base64.c b/system/core/adb/base64.c +new file mode 100644 +index 0000000..95da284 +--- /dev/null ++++ b/system/core/adb/base64.c +@@ -0,0 +1,315 @@ ++/* ++ * Copyright (c) 1996-1999 by Internet Software Consortium. ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS ++ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES ++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE ++ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL ++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR ++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++/* ++ * Portions Copyright (c) 1995 by International Business Machines, Inc. ++ * ++ * International Business Machines, Inc. (hereinafter called IBM) grants ++ * permission under its copyrights to use, copy, modify, and distribute this ++ * Software with or without fee, provided that the above copyright notice and ++ * all paragraphs of this notice appear in all copies, and that the name of IBM ++ * not be used in connection with the marketing of any product incorporating ++ * the Software or modifications thereof, without specific, written prior ++ * permission. ++ * ++ * To the extent it has a right to do so, IBM grants an immunity from suit ++ * under its patents, if any, for the use, sale or manufacture of products to ++ * the extent that such products are used for performing Domain Name System ++ * dynamic updates in TCP/IP networks by means of the Software. No immunity is ++ * granted for any product per se or for any other function of any product. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, ++ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, ++ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN ++ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. ++ */ ++ ++#if !defined(LINT) && !defined(CODECENTER) ++static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $"; ++#endif /* not lint */ ++ ++#include <sys/types.h> ++#include <sys/param.h> ++#include <sys/socket.h> ++ ++#include <netinet/in.h> ++#include <arpa/inet.h> ++#include <arpa/nameser.h> ++ ++#include <ctype.h> ++#include <resolv.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <stdint.h> ++#include <string.h> ++ ++#define Assert(Cond) if (!(Cond)) abort() ++ ++static const char Base64[] = ++ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; ++static const char Pad64 = '='; ++ ++/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) ++ The following encoding technique is taken from RFC 1521 by Borenstein ++ and Freed. It is reproduced here in a slightly edited form for ++ convenience. ++ ++ A 65-character subset of US-ASCII is used, enabling 6 bits to be ++ represented per printable character. (The extra 65th character, "=", ++ is used to signify a special processing function.) ++ ++ The encoding process represents 24-bit groups of input bits as output ++ strings of 4 encoded characters. Proceeding from left to right, a ++ 24-bit input group is formed by concatenating 3 8-bit input groups. ++ These 24 bits are then treated as 4 concatenated 6-bit groups, each ++ of which is translated into a single digit in the base64 alphabet. ++ ++ Each 6-bit group is used as an index into an array of 64 printable ++ characters. The character referenced by the index is placed in the ++ output string. ++ ++ Table 1: The Base64 Alphabet ++ ++ Value Encoding Value Encoding Value Encoding Value Encoding ++ 0 A 17 R 34 i 51 z ++ 1 B 18 S 35 j 52 0 ++ 2 C 19 T 36 k 53 1 ++ 3 D 20 U 37 l 54 2 ++ 4 E 21 V 38 m 55 3 ++ 5 F 22 W 39 n 56 4 ++ 6 G 23 X 40 o 57 5 ++ 7 H 24 Y 41 p 58 6 ++ 8 I 25 Z 42 q 59 7 ++ 9 J 26 a 43 r 60 8 ++ 10 K 27 b 44 s 61 9 ++ 11 L 28 c 45 t 62 + ++ 12 M 29 d 46 u 63 / ++ 13 N 30 e 47 v ++ 14 O 31 f 48 w (pad) = ++ 15 P 32 g 49 x ++ 16 Q 33 h 50 y ++ ++ Special processing is performed if fewer than 24 bits are available ++ at the end of the data being encoded. A full encoding quantum is ++ always completed at the end of a quantity. When fewer than 24 input ++ bits are available in an input group, zero bits are added (on the ++ right) to form an integral number of 6-bit groups. Padding at the ++ end of the data is performed using the '=' character. ++ ++ Since all base64 input is an integral number of octets, only the ++ ------------------------------------------------- ++ following cases can arise: ++ ++ (1) the final quantum of encoding input is an integral ++ multiple of 24 bits; here, the final unit of encoded ++ output will be an integral multiple of 4 characters ++ with no "=" padding, ++ (2) the final quantum of encoding input is exactly 8 bits; ++ here, the final unit of encoded output will be two ++ characters followed by two "=" padding characters, or ++ (3) the final quantum of encoding input is exactly 16 bits; ++ here, the final unit of encoded output will be three ++ characters followed by one "=" padding character. ++ */ ++ ++int ++b64_ntop(const uint8_t* src, size_t srclength, char* target, size_t targsize) ++{ ++ size_t datalength = 0; ++ uint8_t input[3]; ++ uint8_t output[4]; ++ size_t i; ++ ++ while (2 < srclength) { ++ input[0] = *src++; ++ input[1] = *src++; ++ input[2] = *src++; ++ srclength -= 3; ++ ++ output[0] = input[0] >> 2; ++ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); ++ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); ++ output[3] = input[2] & 0x3f; ++ Assert(output[0] < 64); ++ Assert(output[1] < 64); ++ Assert(output[2] < 64); ++ Assert(output[3] < 64); ++ ++ if (datalength + 4 > targsize) ++ return (-1); ++ target[datalength++] = Base64[output[0]]; ++ target[datalength++] = Base64[output[1]]; ++ target[datalength++] = Base64[output[2]]; ++ target[datalength++] = Base64[output[3]]; ++ } ++ ++ /* Now we worry about padding. */ ++ if (0 != srclength) { ++ /* Get what's left. */ ++ input[0] = input[1] = input[2] = '\0'; ++ for (i = 0; i < srclength; i++) ++ input[i] = *src++; ++ ++ output[0] = input[0] >> 2; ++ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); ++ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); ++ Assert(output[0] < 64); ++ Assert(output[1] < 64); ++ Assert(output[2] < 64); ++ ++ if (datalength + 4 > targsize) ++ return (-1); ++ target[datalength++] = Base64[output[0]]; ++ target[datalength++] = Base64[output[1]]; ++ if (srclength == 1) ++ target[datalength++] = Pad64; ++ else ++ target[datalength++] = Base64[output[2]]; ++ target[datalength++] = Pad64; ++ } ++ if (datalength >= targsize) ++ return (-1); ++ target[datalength] = '\0'; /* Returned value doesn't count \0. */ ++ return (datalength); ++} ++ ++/* skips all whitespace anywhere. ++ converts characters, four at a time, starting at (or after) ++ src from base - 64 numbers into three 8 bit bytes in the target area. ++ it returns the number of data bytes stored at the target, or -1 on error. ++ */ ++ ++int b64_pton(const char* src, uint8_t* target, size_t targsize) ++{ ++ int tarindex, state, ch; ++ char *pos; ++ ++ state = 0; ++ tarindex = 0; ++ ++ while ((ch = *src++) != '\0') { ++ if (isspace(ch)) /* Skip whitespace anywhere. */ ++ continue; ++ ++ if (ch == Pad64) ++ break; ++ ++ pos = strchr(Base64, ch); ++ if (pos == 0) /* A non-base64 character. */ ++ return (-1); ++ ++ switch (state) { ++ case 0: ++ if (target) { ++ if ((size_t)tarindex >= targsize) ++ return (-1); ++ target[tarindex] = (pos - Base64) << 2; ++ } ++ state = 1; ++ break; ++ case 1: ++ if (target) { ++ if ((size_t)tarindex + 1 >= targsize) ++ return (-1); ++ target[tarindex] |= (pos - Base64) >> 4; ++ target[tarindex+1] = ((pos - Base64) & 0x0f) ++ << 4 ; ++ } ++ tarindex++; ++ state = 2; ++ break; ++ case 2: ++ if (target) { ++ if ((size_t)tarindex + 1 >= targsize) ++ return (-1); ++ target[tarindex] |= (pos - Base64) >> 2; ++ target[tarindex+1] = ((pos - Base64) & 0x03) ++ << 6; ++ } ++ tarindex++; ++ state = 3; ++ break; ++ case 3: ++ if (target) { ++ if ((size_t)tarindex >= targsize) ++ return (-1); ++ target[tarindex] |= (pos - Base64); ++ } ++ tarindex++; ++ state = 0; ++ break; ++ default: ++ abort(); ++ } ++ } ++ ++ /* ++ * We are done decoding Base-64 chars. Let's see if we ended ++ * on a byte boundary, and/or with erroneous trailing characters. ++ */ ++ ++ if (ch == Pad64) { /* We got a pad char. */ ++ ch = *src++; /* Skip it, get next. */ ++ switch (state) { ++ case 0: /* Invalid = in first position */ ++ case 1: /* Invalid = in second position */ ++ return (-1); ++ ++ case 2: /* Valid, means one byte of info */ ++ /* Skip any number of spaces. */ ++ for ((void)NULL; ch != '\0'; ch = *src++) ++ if (!isspace(ch)) ++ break; ++ /* Make sure there is another trailing = sign. */ ++ if (ch != Pad64) ++ return (-1); ++ ch = *src++; /* Skip the = */ ++ /* Fall through to "single trailing =" case. */ ++ /* FALLTHROUGH */ ++ ++ case 3: /* Valid, means two bytes of info */ ++ /* ++ * We know this char is an =. Is there anything but ++ * whitespace after it? ++ */ ++ for ((void)NULL; ch != '\0'; ch = *src++) ++ if (!isspace(ch)) ++ return (-1); ++ ++ /* ++ * Now make sure for cases 2 and 3 that the "extra" ++ * bits that slopped past the last full byte were ++ * zeros. If we don't check them, they become a ++ * subliminal channel. ++ */ ++ if (target && target[tarindex] != 0) ++ return (-1); ++ } ++ } else { ++ /* ++ * We ended by seeing the end of the string. Make sure we ++ * have no partial bytes lying around. ++ */ ++ if (state != 0) ++ return (-1); ++ } ++ ++ return (tarindex); ++} ++ +-- +2.14.1 + diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/0002-adb-Musl-fixes.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/0002-adb-Musl-fixes.patch new file mode 100644 index 000000000..c7aebb641 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/0002-adb-Musl-fixes.patch @@ -0,0 +1,134 @@ +From f8653ed0ede4aa781ab758fcd44fdc05ffbe0b0a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 15 Sep 2017 15:50:57 -0700 +Subject: [PATCH 2/2] adb: Musl fixes + +__nonnull is gcc specific +include sys/types.h for size_t +Do not redefine close() and lseek() + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + system/core/adb/adb.h | 2 ++ + system/core/adb/disable_verity_service.c | 13 ++++++++----- + system/core/adb/framebuffer_service.c | 7 ++++--- + system/core/adb/sysdeps.h | 12 ++++++------ + 4 files changed, 20 insertions(+), 14 deletions(-) + +diff --git a/system/core/adb/adb.h b/system/core/adb/adb.h +index 44e5981..bcdc49f 100644 +--- a/system/core/adb/adb.h ++++ b/system/core/adb/adb.h +@@ -18,7 +18,9 @@ + #define __ADB_H + + #include <limits.h> ++#include <sys/types.h> + ++#include "fdevent.h" + #include "adb_trace.h" + #include "transport.h" /* readx(), writex() */ + +diff --git a/system/core/adb/disable_verity_service.c b/system/core/adb/disable_verity_service.c +index ed3da52..29fa3d6 100644 +--- a/system/core/adb/disable_verity_service.c ++++ b/system/core/adb/disable_verity_service.c +@@ -14,25 +14,28 @@ + * limitations under the License. + */ + +-#include "sysdeps.h" + + #define TRACE_TAG TRACE_ADB + #include "adb.h" ++#include "sysdeps.h" ++#include "cutils/properties.h" ++#include "ext4_sb.h" ++#include <fs_mgr.h> + + #include <stdio.h> + #include <stdarg.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <inttypes.h> ++#include <unistd.h> ++#include <errno.h> ++#include <stdbool.h> + +-#include "cutils/properties.h" +-#include "ext4_sb.h" +-#include <fs_mgr.h> + + #define FSTAB_PREFIX "/fstab." + struct fstab *fstab; + +-__attribute__((__format__(printf, 2, 3))) __nonnull((2)) ++__attribute__((__format__(printf, 2, 3))) __attribute__((nonnull((2)))) + static void write_console(int fd, const char* format, ...) + { + char buffer[256]; +diff --git a/system/core/adb/framebuffer_service.c b/system/core/adb/framebuffer_service.c +index 8cbe840..8f0ccfb 100644 +--- a/system/core/adb/framebuffer_service.c ++++ b/system/core/adb/framebuffer_service.c +@@ -14,6 +14,10 @@ + * limitations under the License. + */ + ++#include "fdevent.h" ++#include "adb.h" ++#include "sysdeps.h" ++ + #include <stdlib.h> + #include <stdio.h> + #include <unistd.h> +@@ -23,9 +27,6 @@ + #include <sys/types.h> + #include <sys/wait.h> + +-#include "fdevent.h" +-#include "adb.h" +- + #include <linux/fb.h> + #include <sys/ioctl.h> + #include <sys/mman.h> +diff --git a/system/core/adb/sysdeps.h b/system/core/adb/sysdeps.h +index cc1f839..ea39ac3 100644 +--- a/system/core/adb/sysdeps.h ++++ b/system/core/adb/sysdeps.h +@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd) + { + return close(fd); + } +-#undef close +-#define close ____xxx_close ++//#undef close ++//#define close ____xxx_close + + static __inline__ int unix_read(int fd, void* buf, size_t len) + { +@@ -369,8 +369,8 @@ static __inline__ int adb_close(int fd) + { + return close(fd); + } +-#undef close +-#define close ____xxx_close ++//#undef close ++//#define close ____xxx_close + + + static __inline__ int adb_read(int fd, void* buf, size_t len) +@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int fd, int pos, int where) + { + return lseek(fd, pos, where); + } +-#undef lseek +-#define lseek ___xxx_lseek ++//#undef lseek ++//#define lseek ___xxx_lseek + + static __inline__ int adb_unlink(const char* path) + { +-- +2.14.1 + diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk new file mode 100644 index 000000000..0687c22c1 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk @@ -0,0 +1,72 @@ +# Makefile for adb + +SRCDIR ?= $(S) + +VPATH += $(SRCDIR)/system/core/adb +adb_SRC_FILES += adb.c +adb_SRC_FILES += console.c +adb_SRC_FILES += transport.c +adb_SRC_FILES += transport_local.c +adb_SRC_FILES += transport_usb.c +adb_SRC_FILES += commandline.c +adb_SRC_FILES += adb_client.c +adb_SRC_FILES += adb_auth_host.c +adb_SRC_FILES += sockets.c +adb_SRC_FILES += services.c +adb_SRC_FILES += file_sync_client.c +adb_SRC_FILES += get_my_path_linux.c +adb_SRC_FILES += usb_linux.c +adb_SRC_FILES += usb_vendors.c +adb_SRC_FILES += fdevent.c +adb_OBJS := $(adb_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/libcutils +libcutils_SRC_FILES += atomic.c +libcutils_SRC_FILES += hashmap.c +libcutils_SRC_FILES += native_handle.c +libcutils_SRC_FILES += config_utils.c +libcutils_SRC_FILES += cpu_info.c +libcutils_SRC_FILES += load_file.c +# libcutils_SRC_FILES += open_memstream.c +# libcutils_SRC_FILES += strdup16to8.c +# libcutils_SRC_FILES += strdup8to16.c +# libcutils_SRC_FILES += record_stream.c +# libcutils_SRC_FILES += process_name.c +# libcutils_SRC_FILES += threads.c +# libcutils_SRC_FILES += sched_policy.c +# libcutils_SRC_FILES += iosched_policy.c +libcutils_SRC_FILES += str_parms.c +libcutils_SRC_FILES += fs.c +libcutils_SRC_FILES += multiuser.c +libcutils_SRC_FILES += socket_inaddr_any_server.c +libcutils_SRC_FILES += socket_local_client.c +libcutils_SRC_FILES += socket_local_server.c +libcutils_SRC_FILES += socket_loopback_client.c +libcutils_SRC_FILES += socket_loopback_server.c +libcutils_SRC_FILES += socket_network_client.c +libcutils_SRC_FILES += sockets.c +libcutils_SRC_FILES += ashmem-host.c +libcutils_SRC_FILES += dlmalloc_stubs.c +libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o) + +CFLAGS += -DANDROID +CFLAGS += -DWORKAROUND_BUG6558362 +CFLAGS += -DADB_HOST=1 +CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE +CFLAGS += -DANDROID_SMP=0 +CFLAGS += -I$(SRCDIR)/system/core/adb +CFLAGS += -I$(SRCDIR)/system/core/include +CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h + +LIBS += libcutils.a -lpthread -lcrypto + +all: adb + +adb: libcutils.a $(adb_OBJS) + $(CC) -o $@ $(LDFLAGS) $(adb_OBJS) $(LIBS) + +libcutils.a: $(libcutils_OBJS) + $(AR) rcs $@ $(libcutils_OBJS) + +clean: + $(RM) $(adb_OBJS) $(libcutils_OBJS) adb *.a diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk new file mode 100644 index 000000000..31452ae10 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk @@ -0,0 +1,164 @@ +# Makefile for adbd + +SRCDIR ?= $(S) + +VPATH += $(SRCDIR)/system/core/adb +adbd_SRC_FILES += adb.c +adbd_SRC_FILES += fdevent.c +adbd_SRC_FILES += transport.c +adbd_SRC_FILES += transport_local.c +adbd_SRC_FILES += transport_usb.c +adbd_SRC_FILES += adb_auth_client.c +adbd_SRC_FILES += sockets.c +adbd_SRC_FILES += services.c +adbd_SRC_FILES += file_sync_service.c +adbd_SRC_FILES += jdwp_service.c +adbd_SRC_FILES += framebuffer_service.c +adbd_SRC_FILES += remount_service.c +adbd_SRC_FILES += disable_verity_service.c +adbd_SRC_FILES += base64.c +adbd_SRC_FILES += usb_linux_client.c +adbd_OBJS := $(adbd_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/liblog +liblog_SRC_FILES += logd_write.c +liblog_SRC_FILES += log_event_write.c +liblog_SRC_FILES += logprint.c +liblog_SRC_FILES += event_tag_map.c +liblog_SRC_FILES += fake_log_device.c +liblog_OBJS := $(liblog_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/fs_mgr +fs_mgr_SRC_FILES += fs_mgr_fstab.c +fs_mgr_OBJS := $(fs_mgr_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/libcutils +libcutils_SRC_FILES += atomic.c +libcutils_SRC_FILES += hashmap.c +libcutils_SRC_FILES += native_handle.c +libcutils_SRC_FILES += config_utils.c +libcutils_SRC_FILES += cpu_info.c +libcutils_SRC_FILES += load_file.c +# libcutils_SRC_FILES += open_memstream.c +# libcutils_SRC_FILES += strdup16to8.c +# libcutils_SRC_FILES += strdup8to16.c +# libcutils_SRC_FILES += record_stream.c +# libcutils_SRC_FILES += process_name.c +# libcutils_SRC_FILES += threads.c +# libcutils_SRC_FILES += sched_policy.c +# libcutils_SRC_FILES += iosched_policy.c +libcutils_SRC_FILES += str_parms.c +libcutils_SRC_FILES += fs.c +libcutils_SRC_FILES += multiuser.c +libcutils_SRC_FILES += socket_inaddr_any_server.c +libcutils_SRC_FILES += socket_local_client.c +libcutils_SRC_FILES += socket_local_server.c +libcutils_SRC_FILES += socket_loopback_client.c +libcutils_SRC_FILES += socket_loopback_server.c +libcutils_SRC_FILES += socket_network_client.c +libcutils_SRC_FILES += sockets.c +libcutils_SRC_FILES += ashmem-host.c +libcutils_SRC_FILES += dlmalloc_stubs.c +libcutils_SRC_FILES += klog.c +libcutils_SRC_FILES += properties.c +libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/external/libselinux/src +libselinux_SRC_FILES += booleans.c +libselinux_SRC_FILES += canonicalize_context.c +libselinux_SRC_FILES += disable.c +libselinux_SRC_FILES += enabled.c +libselinux_SRC_FILES += fgetfilecon.c +libselinux_SRC_FILES += fsetfilecon.c +libselinux_SRC_FILES += getenforce.c +libselinux_SRC_FILES += getfilecon.c +libselinux_SRC_FILES += getpeercon.c +libselinux_SRC_FILES += lgetfilecon.c +libselinux_SRC_FILES += load_policy.c +libselinux_SRC_FILES += lsetfilecon.c +libselinux_SRC_FILES += policyvers.c +libselinux_SRC_FILES += procattr.c +libselinux_SRC_FILES += setenforce.c +libselinux_SRC_FILES += setfilecon.c +libselinux_SRC_FILES += context.c +libselinux_SRC_FILES += mapping.c +libselinux_SRC_FILES += stringrep.c +libselinux_SRC_FILES += compute_create.c +libselinux_SRC_FILES += compute_av.c +libselinux_SRC_FILES += avc.c +libselinux_SRC_FILES += avc_internal.c +libselinux_SRC_FILES += avc_sidtab.c +libselinux_SRC_FILES += get_initial_context.c +libselinux_SRC_FILES += checkAccess.c +libselinux_SRC_FILES += sestatus.c +libselinux_SRC_FILES += deny_unknown.c + +libselinux_SRC_FILES += callbacks.c +libselinux_SRC_FILES += check_context.c +libselinux_SRC_FILES += freecon.c +libselinux_SRC_FILES += init.c +libselinux_SRC_FILES += label.c +libselinux_SRC_FILES += label_file.c +libselinux_SRC_FILES += label_android_property.c +libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/extras/ext4_utils +libext4_utils_SRC_FILES += make_ext4fs.c +libext4_utils_SRC_FILES += ext4fixup.c +libext4_utils_SRC_FILES += ext4_utils.c +libext4_utils_SRC_FILES += allocate.c +libext4_utils_SRC_FILES += contents.c +libext4_utils_SRC_FILES += extent.c +libext4_utils_SRC_FILES += indirect.c +libext4_utils_SRC_FILES += uuid.c +libext4_utils_SRC_FILES += sha1.c +libext4_utils_SRC_FILES += wipe.c +libext4_utils_SRC_FILES += crc16.c +libext4_utils_SRC_FILES += ext4_sb.c +libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o) + +CFLAGS += -std=gnu11 +CFLAGS += -DANDROID +CFLAGS += -DADB_HOST=0 +CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE +CFLAGS += -DALLOW_ADBD_ROOT=1 +CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 +CFLAGS += -DPROP_NAME_MAX=32 +CFLAGS += -DPROP_VALUE_MAX=92 +CFLAGS += -DAUDITD_LOG_TAG=1003 +# CFLAGS += -DHOST +CFLAGS += -DANDROID_SMP=0 +CFLAGS += -I$(SRCDIR)/system/core/adb +CFLAGS += -I$(SRCDIR)/system/core/include +CFLAGS += -I$(SRCDIR)/system/core/libsparse/include +CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils +CFLAGS += -I$(SRCDIR)/system/core/fs_mgr/include +CFLAGS += -I$(SRCDIR)/hardware/libhardware/include +CFLAGS += -I$(SRCDIR)/external/libselinux/include +CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h + +LIBS += liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a -lpthread -lbsd -lpcre -lresolv -lcrypto + +all: adbd + +adbd: liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a $(adbd_OBJS) + $(CC) -o $@ $(LDFLAGS) $(adbd_OBJS) $(LIBS) + +liblog.a: $(liblog_OBJS) + $(AR) rcs $@ $(liblog_OBJS) + +libfs_mgr.a: $(fs_mgr_OBJS) + $(AR) rcs $@ $(fs_mgr_OBJS) + +libcutils.a: $(libcutils_OBJS) + $(AR) rcs $@ $(libcutils_OBJS) + +libselinux.a: $(libselinux_OBJS) + export CFLAGS="-DANDROID -DHOST" + $(AR) rcs $@ $(libselinux_OBJS) + +libext4_utils.a: $(libext4_utils_OBJS) + $(AR) rcs $@ $(libext4_utils_OBJS) + +clean: + $(RM) *.o *.a adbd diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service new file mode 100644 index 000000000..88ed6871d --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Android Debug Bridge + +[Service] +Type=simple +Restart=on-failure +ExecStartPre=/usr/bin/android-gadget-setup adb +ExecStart=/usr/bin/adbd +StandardOutput=null + +[Install] +WantedBy=basic.target diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch new file mode 100644 index 000000000..8381967c4 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch @@ -0,0 +1,23 @@ +Description: we intend to run on Linux system so the shell is always /bin/sh, + for the host or the target. +Author: Fathi Boudra <fabo@debian.org> + +Upstream-Status: Inappropriate +--- + system/core/adb/services.c | 4 ---- + 1 file changed, 4 deletions(-) + +--- a/system/core/adb/services.c ++++ b/system/core/adb/services.c +@@ -299,11 +299,7 @@ static int create_subproc_raw(const char + } + #endif /* !ABD_HOST */ + +-#if ADB_HOST + #define SHELL_COMMAND "/bin/sh" +-#else +-#define SHELL_COMMAND "/system/bin/sh" +-#endif + + #if !ADB_HOST + static void subproc_waiter_service(int fd, void *cookie) diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk new file mode 100644 index 000000000..c18aa9c4d --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk @@ -0,0 +1,103 @@ +# Makefile for ext4_utils + +SRCDIR ?= $(S) + +VPATH += $(SRCDIR)/system/extras/ext4_utils +make_ext4fs_SRC_FILES += make_ext4fs_main.c +make_ext4fs_SRC_FILES += canned_fs_config.c +make_ext4fs_OBJS := $(make_ext4fs_SRC_FILES:.c=.o) + +ext2simg_SRC_FILES += ext2simg.c +ext2simg_OBJS := $(ext2simg_SRC_FILES:.c=.o) + +ext4fixup_SRC_FILES += ext4fixup_main.c +ext4fixup_OBJS := $(ext4fixup_SRC_FILES:.c=.o) + +libext4_utils_SRC_FILES += make_ext4fs.c +libext4_utils_SRC_FILES += ext4fixup.c +libext4_utils_SRC_FILES += ext4_utils.c +libext4_utils_SRC_FILES += allocate.c +libext4_utils_SRC_FILES += contents.c +libext4_utils_SRC_FILES += extent.c +libext4_utils_SRC_FILES += indirect.c +libext4_utils_SRC_FILES += uuid.c +libext4_utils_SRC_FILES += sha1.c +libext4_utils_SRC_FILES += wipe.c +libext4_utils_SRC_FILES += crc16.c +libext4_utils_SRC_FILES += ext4_sb.c +libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/libsparse +simg2img_SRC_FILES += simg2img.c +simg2img_SRC_FILES += sparse_crc32.c +simg2img_OBJS := $(simg2img_SRC_FILES:.c=.o) + +img2simg_SRC_FILES += img2simg.c +img2simg_OBJS := $(img2simg_SRC_FILES:.c=.o) + +simg2simg_SRC_FILES += simg2simg.c +simg2simg_SRC_FILES += sparse_crc32.c +simg2simg_OBJS := $(simg2simg_SRC_FILES:.c=.o) + +libsparse_SRC_FILES += backed_block.c +libsparse_SRC_FILES += output_file.c +libsparse_SRC_FILES += sparse.c +libsparse_SRC_FILES += sparse_crc32.c +libsparse_SRC_FILES += sparse_err.c +libsparse_SRC_FILES += sparse_read.c +libsparse_OBJS := $(libsparse_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/external/libselinux/src +libselinux_SRC_FILES += callbacks.c +libselinux_SRC_FILES += check_context.c +libselinux_SRC_FILES += freecon.c +libselinux_SRC_FILES += init.c +libselinux_SRC_FILES += label.c +libselinux_SRC_FILES += label_file.c +libselinux_SRC_FILES += label_android_property.c +libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o) + +CFLAGS += -DANDROID +CFLAGS += -DHOST +CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils +CFLAGS += -I$(SRCDIR)/system/core/include +CFLAGS += -I$(SRCDIR)/system/core/libsparse/include +CFLAGS += -I$(SRCDIR)/external/libselinux/include +CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h + +all: make_ext4fs ext2simg ext4fixup simg2img img2simg simg2simg + +make_ext4fs: libext4_utils.a libsparse.a libselinux.a $(make_ext4fs_OBJS) + $(CC) -o $@ $(LDFLAGS) $(make_ext4fs_OBJS) \ + libext4_utils.a libsparse.a libselinux.a -lz -lpcre + +ext2simg: libext4_utils.a libselinux.a libsparse.a $(ext2simg_OBJS) + $(CC) -o $@ $(LDFLAGS) $(ext2simg_OBJS) \ + libext4_utils.a libselinux.a libsparse.a -lz -lpcre + +ext4fixup: libext4_utils.a libsparse.a $(ext4fixup_OBJS) + $(CC) -o $@ $(LDFLAGS) $(ext4fixup_OBJS) libext4_utils.a libsparse.a -lz + +simg2img: libsparse.a $(simg2img_OBJS) + $(CC) -o $@ $(LDFLAGS) $(simg2img_OBJS) libsparse.a -lz + +img2simg: libsparse.a $(img2simg_OBJS) + $(CC) -o $@ $(LDFLAGS) $(img2simg_OBJS) libsparse.a -lz + +simg2simg: libsparse.a $(simg2simg_OBJS) + $(CC) -o $@ $(LDFLAGS) $(simg2simg_OBJS) libsparse.a -lz + +libext4_utils.a: $(libext4_utils_OBJS) + $(AR) rcs $@ $(libext4_utils_OBJS) + +libsparse.a: $(libsparse_OBJS) + $(AR) rcs $@ $(libsparse_OBJS) + +libselinux.a: $(libselinux_OBJS) + $(AR) rcs $@ $(libselinux_OBJS) + +clean: + $(RM) $(make_ext4fs_OBJS) $(ext2simg_OBJS) $(ext4fixup_OBJS) \ + $(simg2img_OBJS) $(img2simg_OBJS) $(simg2simg_OBJS) \ + $(libext4_utils_OBJS) $(libsparse_OBJS) $(libselinux_OBJS) \ + make_ext4fs ext2simg ext4fixup simg2img img2simg simg2simg *.a diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk new file mode 100644 index 000000000..b9ba95f38 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk @@ -0,0 +1,89 @@ +# Makefile for fastboot + +SRCDIR ?= $(S) + +VPATH += $(SRCDIR)/system/core/fastboot +fastboot_SRC_FILES += protocol.c +fastboot_SRC_FILES += engine.c +fastboot_SRC_FILES += bootimg.c +fastboot_SRC_FILES += fastboot.c +fastboot_SRC_FILES += util.c +fastboot_SRC_FILES += fs.c +fastboot_SRC_FILES += usb_linux.c +fastboot_SRC_FILES += util_linux.c +fastboot_OBJS := $(fastboot_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/libzipfile +libzipfile_SRC_FILES += centraldir.c +libzipfile_SRC_FILES += zipfile.c +libzipfile_OBJS := $(libzipfile_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/extras/ext4_utils +libext4_utils_SRC_FILES += make_ext4fs.c +libext4_utils_SRC_FILES += ext4fixup.c +libext4_utils_SRC_FILES += ext4_utils.c +libext4_utils_SRC_FILES += allocate.c +libext4_utils_SRC_FILES += contents.c +libext4_utils_SRC_FILES += extent.c +libext4_utils_SRC_FILES += indirect.c +libext4_utils_SRC_FILES += uuid.c +libext4_utils_SRC_FILES += sha1.c +libext4_utils_SRC_FILES += wipe.c +libext4_utils_SRC_FILES += crc16.c +libext4_utils_SRC_FILES += ext4_sb.c +libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/libsparse +libsparse_SRC_FILES += backed_block.c +libsparse_SRC_FILES += output_file.c +libsparse_SRC_FILES += sparse.c +libsparse_SRC_FILES += sparse_crc32.c +libsparse_SRC_FILES += sparse_err.c +libsparse_SRC_FILES += sparse_read.c +libsparse_OBJS := $(libsparse_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/external/libselinux/src +libselinux_SRC_FILES += callbacks.c +libselinux_SRC_FILES += check_context.c +libselinux_SRC_FILES += freecon.c +libselinux_SRC_FILES += init.c +libselinux_SRC_FILES += label.c +libselinux_SRC_FILES += label_file.c +libselinux_SRC_FILES += label_android_property.c +libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o) + +CFLAGS += -std=gnu11 +CFLAGS += -DANDROID +# CFLAGS += -DUSE_F2FS +CFLAGS += -DHOST +CFLAGS += -I$(SRCDIR)/system/core/fastboot +CFLAGS += -I$(SRCDIR)/system/core/include +CFLAGS += -I$(SRCDIR)/system/core/mkbootimg +CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils +CFLAGS += -I$(SRCDIR)/system/extras/f2fs_utils +CFLAGS += -I$(SRCDIR)/system/core/libsparse/include +CFLAGS += -I$(SRCDIR)/external/libselinux/include +CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h + +LIBS += libzipfile.a libext4_utils.a libsparse.a libselinux.a -lz -lpcre + +all: fastboot + +fastboot: libzipfile.a libext4_utils.a libsparse.a libselinux.a $(fastboot_OBJS) + $(CC) -o $@ $(LDFLAGS) $(fastboot_OBJS) $(LIBS) + +libzipfile.a: $(libzipfile_OBJS) + $(AR) rcs $@ $(libzipfile_OBJS) + +libext4_utils.a: $(libext4_utils_OBJS) + $(AR) rcs $@ $(libext4_utils_OBJS) + +libsparse.a: $(libsparse_OBJS) + $(AR) rcs $@ $(libsparse_OBJS) + +libselinux.a: $(libselinux_OBJS) + $(AR) rcs $@ $(libselinux_OBJS) + +clean: + $(RM) $(fastboot_OBJS) $(libzipfile_OBJS) $(libext4_utils_OBJS) \ + $(libsparse_OBJS) $(libselinux_OBJS) fastboot *.a diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch new file mode 100644 index 000000000..8deaf3a3d --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch @@ -0,0 +1,39 @@ +Fix build on big endian systems + +The usb_linux_client.c file defines cpu_to_le16/32 by using the C +library htole16/32 function calls. However, cpu_to_le16/32 are used +when initializing structures, i.e in a context where a function call +is not allowed. + +It works fine on little endian systems because htole16/32 are defined +by the C library as no-ops. But on big-endian systems, they are +actually doing something, which might involve calling a function, +causing build failures. + +To solve this, we simply open-code cpu_to_le16/32 in a way that allows +them to be used when initializing structures. + +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> + +Index: b/system/core/adb/usb_linux_client.c +=================================================================== +--- a/system/core/adb/usb_linux_client.c ++++ b/system/core/adb/usb_linux_client.c +@@ -34,8 +34,15 @@ + #define MAX_PACKET_SIZE_FS 64 + #define MAX_PACKET_SIZE_HS 512 + +-#define cpu_to_le16(x) htole16(x) +-#define cpu_to_le32(x) htole32(x) ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# define cpu_to_le16(x) (x) ++# define cpu_to_le32(x) (x) ++#else ++# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) ++# define cpu_to_le32(x) \ ++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ ++ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) ++#endif + + struct usb_handle + { diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/implicit-declaration-function-strlcat-strlcopy.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/implicit-declaration-function-strlcat-strlcopy.patch new file mode 100644 index 000000000..64db6168c --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/implicit-declaration-function-strlcat-strlcopy.patch @@ -0,0 +1,42 @@ +Description: fix implicit declaration of stlcat/strlcopy functions. +Author: Fathi Boudra <fabo@debian.org> + +Upstream-Status: Inappropriate +--- + system/core/adb/adb.c | 1 + + system/core/fs_mgr/fs_mgr_fstab.c | 2 +- + system/core/include/cutils/sockets.h | 2 +- + 3 files changed, 3 insertions(+), 2 deletions(-) + +--- a/system/core/fs_mgr/fs_mgr_fstab.c ++++ b/system/core/fs_mgr/fs_mgr_fstab.c +@@ -17,7 +17,7 @@ + #include <ctype.h> + #include <stdio.h> + #include <stdlib.h> +-#include <string.h> ++#include <bsd/string.h> + #include <sys/mount.h> + + #include "fs_mgr_priv.h" +--- a/system/core/include/cutils/sockets.h ++++ b/system/core/include/cutils/sockets.h +@@ -19,7 +19,7 @@ + + #include <errno.h> + #include <stdlib.h> +-#include <string.h> ++#include <bsd/string.h> + #include <stdbool.h> + + #ifdef HAVE_WINSOCK +--- a/system/core/adb/adb.c ++++ b/system/core/adb/adb.c +@@ -41,6 +41,7 @@ + #include <sys/prctl.h> + #include <getopt.h> + #include <selinux/selinux.h> ++#include <grp.h> + #else + #include "usb_vendors.h" + #endif diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg-Add-dt-parameter-to-specify-DT-image.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg-Add-dt-parameter-to-specify-DT-image.patch new file mode 100644 index 000000000..35bb766a7 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg-Add-dt-parameter-to-specify-DT-image.patch @@ -0,0 +1,108 @@ +From cc5e7b02a3be57709a1aed6e34be100b82a71620 Mon Sep 17 00:00:00 2001 +From: David Ng <dave@codeaurora.org> +Date: Fri, 27 Jul 2012 17:15:03 -0700 +Subject: [PATCH 1/2] mkbootimg: Add --dt parameter to specify DT image + +New optional --dt parameter to specify a kernel device +tree image. + +Change-Id: Ie29a11cbf4138426bfd19ae486d69a5fcbd8f442 + +Upstream-Status: Inappropriate +--- + system/core/mkbootimg/bootimg.h | 7 +++++-- + system/core/mkbootimg/mkbootimg.c | 21 +++++++++++++++++++++ + 2 files changed, 26 insertions(+), 2 deletions(-) + +--- a/system/core/mkbootimg/bootimg.h ++++ b/system/core/mkbootimg/bootimg.h +@@ -41,8 +41,8 @@ struct boot_img_hdr + + unsigned tags_addr; /* physical addr for kernel tags */ + unsigned page_size; /* flash page size we assume */ +- unsigned unused[2]; /* future expansion: should be 0 */ +- ++ unsigned dt_size; /* device tree in bytes */ ++ unsigned unused; /* future expansion: should be 0 */ + unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */ + + unsigned char cmdline[BOOT_ARGS_SIZE]; +@@ -64,10 +64,13 @@ struct boot_img_hdr + ** +-----------------+ + ** | second stage | o pages + ** +-----------------+ ++** | device tree | p pages ++** +-----------------+ + ** + ** n = (kernel_size + page_size - 1) / page_size + ** m = (ramdisk_size + page_size - 1) / page_size + ** o = (second_size + page_size - 1) / page_size ++** p = (dt_size + page_size - 1) / page_size + ** + ** 0. all entities are page_size aligned in flash + ** 1. kernel and ramdisk are required (size != 0) +--- a/system/core/mkbootimg/mkbootimg.c ++++ b/system/core/mkbootimg/mkbootimg.c +@@ -65,6 +65,7 @@ int usage(void) + " [ --board <boardname> ]\n" + " [ --base <address> ]\n" + " [ --pagesize <pagesize> ]\n" ++ " [ --dt <filename> ]\n" + " -o|--output <filename>\n" + ); + return 1; +@@ -105,6 +106,8 @@ int main(int argc, char **argv) + char *cmdline = ""; + char *bootimg = 0; + char *board = ""; ++ char *dt_fn = 0; ++ void *dt_data = 0; + unsigned pagesize = 2048; + int fd; + SHA_CTX ctx; +@@ -158,6 +161,8 @@ int main(int argc, char **argv) + fprintf(stderr,"error: unsupported page size %d\n", pagesize); + return -1; + } ++ } else if(!strcmp(arg, "--dt")) { ++ dt_fn = val; + } else { + return usage(); + } +@@ -232,6 +237,14 @@ int main(int argc, char **argv) + } + } + ++ if(dt_fn) { ++ dt_data = load_file(dt_fn, &hdr.dt_size); ++ if (dt_data == 0) { ++ fprintf(stderr,"error: could not load device tree image '%s'\n", dt_fn); ++ return 1; ++ } ++ } ++ + /* put a hash of the contents in the header so boot images can be + * differentiated based on their first 2k. + */ +@@ -242,6 +255,10 @@ int main(int argc, char **argv) + SHA_update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size)); + SHA_update(&ctx, second_data, hdr.second_size); + SHA_update(&ctx, &hdr.second_size, sizeof(hdr.second_size)); ++ if(dt_data) { ++ SHA_update(&ctx, dt_data, hdr.dt_size); ++ SHA_update(&ctx, &hdr.dt_size, sizeof(hdr.dt_size)); ++ } + sha = SHA_final(&ctx); + memcpy(hdr.id, sha, + SHA_DIGEST_SIZE > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_SIZE); +@@ -266,6 +283,10 @@ int main(int argc, char **argv) + if(write_padding(fd, pagesize, hdr.second_size)) goto fail; + } + ++ if(dt_data) { ++ if(write(fd, dt_data, hdr.dt_size) != (ssize_t) hdr.dt_size) goto fail; ++ if(write_padding(fd, pagesize, hdr.dt_size)) goto fail; ++ } + return 0; + + fail: diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk new file mode 100644 index 000000000..519f609fd --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk @@ -0,0 +1,29 @@ +# Makefile for mkbootimg + +SRCDIR ?= $(S) + +VPATH += $(SRCDIR)/system/core/mkbootimg +mkbootimg_SRC_FILES += mkbootimg.c +mkbootimg_OBJS := $(mkbootimg_SRC_FILES:.c=.o) + +VPATH += $(SRCDIR)/system/core/libmincrypt +libmincrypt_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c +libmincrypt_OBJS := $(libmincrypt_SRC_FILES:.c=.o) + +CFLAGS += -DANDROID +CFLAGS += -I$(SRCDIR)/system/core/mkbootimg +CFLAGS += -I$(SRCDIR)/system/core/include +CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h + +LIBS += libmincrypt.a + +all: mkbootimg + +mkbootimg: libmincrypt.a $(mkbootimg_OBJS) + $(CC) -o $@ $(LDFLAGS) $(mkbootimg_OBJS) $(LIBS) + +libmincrypt.a: $(libmincrypt_OBJS) + $(AR) rcs $@ $(libmincrypt_OBJS) + +clean: + $(RM) $(mkbootimg_OBJS) $(libmincrypt_OBJS) mkbootimg *.a diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch new file mode 100644 index 000000000..5c9039719 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch @@ -0,0 +1,81 @@ +From aa669312a380611d280d126cb509fa282080707e Mon Sep 17 00:00:00 2001 +From: Markus Mayer <mmayer@mmayer.net> +Date: Wed, 7 Sep 2016 12:58:47 +0300 +Subject: [PATCH] android-tools: add recipe from AOSP tag android-5.1.1_r37 + +Description: add -o argument to preserve ownership + +See also https://android-review.googlesource.com/#/c/100312/ + +Upstream-Status: Inappropriate + +--- + ext4_utils/make_ext4fs.c | 6 ++++++ + ext4_utils/make_ext4fs_main.c | 10 ++++++++-- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c +index 2f89ae8a..cc41d623 100644 +--- a/ext4_utils/make_ext4fs.c ++++ b/ext4_utils/make_ext4fs.c +@@ -68,6 +68,8 @@ + + #endif + ++int preserve_owner = 0; ++ + /* TODO: Not implemented: + Allocating blocks in the same block group as the file inode + Hash or binary tree directories +@@ -186,6 +188,10 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path + } else { + dentries[i].mtime = fixed_time; + } ++ if (preserve_owner) { ++ dentries[i].uid = stat.st_uid; ++ dentries[i].gid = stat.st_gid; ++ } + uint64_t capabilities; + if (fs_config_func != NULL) { + #ifdef ANDROID +diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c +index a6c5f616..7af0dddf 100644 +--- a/ext4_utils/make_ext4fs_main.c ++++ b/ext4_utils/make_ext4fs_main.c +@@ -48,13 +48,15 @@ struct selabel_handle; + extern struct fs_info info; + + ++extern int preserve_owner; ++ + static void usage(char *path) + { + fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path)); + fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n"); + fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n"); + fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n"); +- fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n"); ++ fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -o ] [ -v ] [ -B <block_list_file> ]\n"); + fprintf(stderr, " <filename> [<directory>]\n"); + } + +@@ -80,7 +82,7 @@ int main(int argc, char **argv) + struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } }; + #endif + +- while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctv")) != -1) { ++ while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctov")) != -1) { + switch (opt) { + case 'l': + info.len = parse_num(optarg); +@@ -143,6 +145,10 @@ int main(int argc, char **argv) + } + #endif + break; ++ case 'o': ++ preserve_owner = 1; ++ printf("Warning: Enabling 'preserve ownership', this is an unofficial feature!\n"); ++ break; + case 'v': + verbose = 1; + break; diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch new file mode 100644 index 000000000..e933724cf --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch @@ -0,0 +1,67 @@ +Description: remove bionic specific calls +Author: Fathi Boudra <fabo@debian.org> + +Upstream-Status: Inappropriate +--- + system/core/include/cutils/properties.h | 1 - + system/core/libcutils/properties.c | 2 +- + system/core/liblog/logd_write.c | 5 +++++ + 3 files changed, 6 insertions(+), 2 deletions(-) + +--- a/system/core/include/cutils/properties.h ++++ b/system/core/include/cutils/properties.h +@@ -19,7 +19,6 @@ + + #include <sys/cdefs.h> + #include <stddef.h> +-#include <sys/system_properties.h> + #include <stdint.h> + + #ifdef __cplusplus +--- a/system/core/liblog/logd_write.c ++++ b/system/core/liblog/logd_write.c +@@ -23,6 +23,7 @@ + #include <stdlib.h> + #include <string.h> + #include <sys/stat.h> ++#include <sys/syscall.h> + #include <sys/types.h> + #if (FAKE_LOG_DEVICE == 0) + #include <sys/socket.h> +@@ -205,7 +206,11 @@ static int __write_to_log_kernel(log_id_ + realtime_ts.tv_nsec = ts.tv_nsec; + + log_id_buf = log_id; ++#ifdef __BIONIC__ + tid = gettid(); ++#else ++ tid = (pid_t) syscall(__NR_gettid); ++#endif + + newVec[0].iov_base = (unsigned char *) &log_id_buf; + newVec[0].iov_len = sizeof_log_id_t; +--- a/system/core/libcutils/properties.c ++++ b/system/core/libcutils/properties.c +@@ -104,10 +104,10 @@ int32_t property_get_int32(const char *k + return (int32_t)property_get_imax(key, INT32_MIN, INT32_MAX, default_value); + } + ++#undef HAVE_LIBC_SYSTEM_PROPERTIES + #ifdef HAVE_LIBC_SYSTEM_PROPERTIES + + #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ +-#include <sys/_system_properties.h> + + int property_set(const char *key, const char *value) + { +--- a/external/libselinux/src/procattr.c ++++ b/external/libselinux/src/procattr.c +@@ -8,7 +8,7 @@ + #include "selinux_internal.h" + #include "policy.h" + +-#ifdef HOST ++#ifndef __BIONIC__ + static pid_t gettid(void) + { + return syscall(__NR_gettid); diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch new file mode 100644 index 000000000..d4a37f82b --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch @@ -0,0 +1,56 @@ +Subject: drop useless includes of Android SELINUX extensions; avoids having to clone another module; this should be sent upstream +Author: Sergio Schvezov <sergio.schvezov@canonical.com> + +Upstream-Status: Inappropriate +--- + system/core/adb/file_sync_service.c | 3 --- + system/extras/ext4_utils/make_ext4fs.c | 1 - + system/extras/ext4_utils/make_ext4fs_main.c | 1 - + 3 files changed, 5 deletions(-) + +--- a/system/extras/ext4_utils/make_ext4fs.c ++++ b/system/extras/ext4_utils/make_ext4fs.c +@@ -62,7 +62,6 @@ + + #include <selinux/selinux.h> + #include <selinux/label.h> +-#include <selinux/android.h> + + #define O_BINARY 0 + +--- a/system/extras/ext4_utils/make_ext4fs_main.c ++++ b/system/extras/ext4_utils/make_ext4fs_main.c +@@ -32,7 +32,6 @@ + #ifndef USE_MINGW + #include <selinux/selinux.h> + #include <selinux/label.h> +-#include <selinux/android.h> + #else + struct selabel_handle; + #endif +--- a/system/core/adb/file_sync_service.c ++++ b/system/core/adb/file_sync_service.c +@@ -26,7 +26,6 @@ + + #include <errno.h> + #include <private/android_filesystem_config.h> +-#include <selinux/android.h> + #include "sysdeps.h" + + #define TRACE_TAG TRACE_SYNC +@@ -73,7 +72,6 @@ static int mkdirs(char *name) + *x = '/'; + return ret; + } +- selinux_android_restorecon(name, 0); + } + *x++ = '/'; + } +@@ -251,7 +249,6 @@ static int handle_send_file(int s, char + if(fd >= 0) { + struct utimbuf u; + adb_close(fd); +- selinux_android_restorecon(path, 0); + u.actime = timestamp; + u.modtime = timestamp; + utime(path, &u); diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch new file mode 100644 index 000000000..b8ebe09dc --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch @@ -0,0 +1,19 @@ +Subject: use linux/capability.h on linux systems too +Author: Loïc Minier <loic.minier@ubuntu.com> + +Upstream-Status: Inappropriate +--- + system/core/include/private/android_filesystem_config.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/system/core/include/private/android_filesystem_config.h ++++ b/system/core/include/private/android_filesystem_config.h +@@ -27,7 +27,7 @@ + #include <sys/types.h> + #include <stdint.h> + +-#ifdef HAVE_ANDROID_OS ++#if defined(HAVE_ANDROID_OS) || defined(__linux__) + #include <linux/capability.h> + #else + #include "android_filesystem_capability.h" diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch new file mode 100644 index 000000000..7facd61b9 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch @@ -0,0 +1,62 @@ +Subject: adb: Use local sockets where appropriate +Author: Hilko Bengen <bengen@debian.org> + +Upstream-Status: Inappropriate +--- + system/core/adb/adb.c | 6 +++++- + system/core/adb/adb_client.c | 5 +++-- + system/core/adb/transport_local.c | 3 ++- + 3 files changed, 10 insertions(+), 4 deletions(-) + +--- a/system/core/adb/adb.c ++++ b/system/core/adb/adb.c +@@ -1230,7 +1230,11 @@ int launch_server(int server_port) + */ + void build_local_name(char* target_str, size_t target_size, int server_port) + { +- snprintf(target_str, target_size, "tcp:%d", server_port); ++ if (gListenAll > 0) { ++ snprintf(target_str, target_size, "tcp:%d", server_port); ++ } else { ++ snprintf(target_str, target_size, "local:%d", server_port); ++ } + } + + #if !ADB_HOST +--- a/system/core/adb/adb_client.c ++++ b/system/core/adb/adb_client.c +@@ -185,12 +185,12 @@ int _adb_connect(const char *service) + strcpy(__adb_error, "service name too long"); + return -1; + } +- snprintf(tmp, sizeof tmp, "%04x", len); ++ snprintf(tmp, sizeof tmp, "%d", __adb_server_port); + + if (__adb_server_name) + fd = socket_network_client(__adb_server_name, __adb_server_port, SOCK_STREAM); + else +- fd = socket_loopback_client(__adb_server_port, SOCK_STREAM); ++ fd = socket_local_client(tmp, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM); + + if(fd < 0) { + strcpy(__adb_error, "cannot connect to daemon"); +@@ -201,6 +201,7 @@ int _adb_connect(const char *service) + return -1; + } + ++ snprintf(tmp, sizeof tmp, "%04x", len); + if(writex(fd, tmp, 4) || writex(fd, service, len)) { + strcpy(__adb_error, "write failure during connection"); + adb_close(fd); +--- a/system/core/adb/transport_local.c ++++ b/system/core/adb/transport_local.c +@@ -121,7 +121,8 @@ int local_connect_arbitrary_ports(int co + } + #endif + if (fd < 0) { +- fd = socket_loopback_client(adb_port, SOCK_STREAM); ++ snprintf(buf, sizeof buf, "%d", adb_port); ++ fd = socket_local_client(buf, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM); + } + + if (fd >= 0) { diff --git a/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb new file mode 100644 index 000000000..780ecaa11 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb @@ -0,0 +1,158 @@ +DESCRIPTION = "Different utilities from Android" +SECTION = "console/utils" +LICENSE = "Apache-2.0 & GPL-2.0 & BSD-2-Clause & BSD-3-Clause" +LIC_FILES_CHKSUM = " \ + file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ + file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \ + file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \ + file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ +" +DEPENDS = "libbsd libpcre openssl zlib libcap" + +ANDROID_MIRROR = "android.googlesource.com" +CORE_REPO = "${ANDROID_MIRROR}/platform/system/core" +EXTRAS_REPO = "${ANDROID_MIRROR}/platform/system/extras" +LIBHARDWARE_REPO = "${ANDROID_MIRROR}/platform/hardware/libhardware" +LIBSELINUX_REPO = "${ANDROID_MIRROR}/platform/external/libselinux" +BUILD_REPO = "${ANDROID_MIRROR}/platform/build" + +# matches with android-5.1.1_r37 +SRCREV_core = "2314b110bdebdbfd2d94c502282f9e57c849897e" +SRCREV_extras = "3ecbe8d841df96127d7855661293e5ab6ba6c205" +SRCREV_libhardware = "be55eb1f4d840c82ffaf7c47460df17ff5bc4d9b" +SRCREV_libselinux = "07e9e1339ad1ba608acfba9dce2d0f474b252feb" +SRCREV_build = "16e987def3d7d8f7d30805eb95cef69e52a87dbc" + +SRC_URI = " \ + git://${CORE_REPO};name=core;protocol=https;nobranch=1;destsuffix=git/system/core \ + git://${EXTRAS_REPO};name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \ + git://${LIBHARDWARE_REPO};name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \ + git://${LIBSELINUX_REPO};name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux \ + git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build \ + file://remove-selinux-android.patch \ + file://use-capability.patch \ + file://use-local-socket.patch \ + file://preserve-ownership.patch;patchdir=system/extras \ + file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch \ + file://remove-bionic-android.patch \ + file://define-shell-command.patch \ + file://implicit-declaration-function-strlcat-strlcopy.patch \ + file://fix-big-endian-build.patch \ + file://0001-add-base64-implementation.patch \ + file://0002-adb-Musl-fixes.patch \ + file://android-tools-adbd.service \ + file://.gitignore;subdir=git \ + file://adb.mk;subdir=${BPN} \ + file://adbd.mk;subdir=${BPN} \ + file://ext4_utils.mk;subdir=${BPN} \ + file://fastboot.mk;subdir=${BPN} \ + file://mkbootimg.mk;subdir=${BPN} \ +" + +S = "${WORKDIR}/git" +B = "${WORKDIR}/${BPN}" + +# http://errors.yoctoproject.org/Errors/Details/133881/ +ARM_INSTRUCTION_SET_armv4 = "arm" +ARM_INSTRUCTION_SET_armv5 = "arm" + +inherit systemd + +SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service" + +# Find libbsd headers during native builds +CC_append_class-native = " -I${STAGING_INCDIR}" +CC_append_class-nativesdk = " -I${STAGING_INCDIR}" + +TOOLS = "adb fastboot ext4_utils mkbootimg adbd" + +# Adb needs sys/capability.h, which is not available for native* +TOOLS_class-native = "fastboot ext4_utils mkbootimg" +TOOLS_class-nativesdk = "fastboot ext4_utils mkbootimg" + +do_compile() { + # Setting both variables below causing our makefiles to not work with + # implicit make rules + unset CFLAGS + unset CPPFLAGS + + export SRCDIR=${S} + + case "${HOST_ARCH}" in + arm) + export android_arch=linux-arm + ;; + aarch64) + export android_arch=linux-arm64 + ;; + mips|mipsel) + export android_arch=linux-mips + ;; + powerpc|powerpc64) + export android_arch=linux-ppc + ;; + i586|x86_64) + export android_arch=linux-x86 + ;; + esac + + for tool in ${TOOLS}; do + mkdir -p ${B}/${tool} + oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool} + done +} + +do_install() { + if echo ${TOOLS} | grep -q "ext4_utils" ; then + install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump + install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg + + install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir} + install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir} + install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir} + install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir} + install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir} + install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir} + fi + + if echo ${TOOLS} | grep -q "adb " ; then + install -d ${D}${bindir} + install -m0755 ${B}/adb/adb ${D}${bindir} + fi + + if echo ${TOOLS} | grep -q "adbd" ; then + install -d ${D}${bindir} + install -m0755 ${B}/adbd/adbd ${D}${bindir} + fi + + # Outside the if statement to avoid errors during do_package + install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ + ${D}${systemd_unitdir}/system/android-tools-adbd.service + + if echo ${TOOLS} | grep -q "fastboot" ; then + install -d ${D}${bindir} + install -m0755 ${B}/fastboot/fastboot ${D}${bindir} + fi + + if echo ${TOOLS} | grep -q "mkbootimg" ; then + install -d ${D}${bindir} + install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} + fi +} + +PACKAGES += "${PN}-fstools" + +RDEPENDS_${BPN} = "${BPN}-conf bash" + +FILES_${PN}-fstools = "\ + ${bindir}/ext2simg \ + ${bindir}/ext4fixup \ + ${bindir}/img2simg \ + ${bindir}/make_ext4fs \ + ${bindir}/simg2img \ + ${bindir}/simg2simg \ + ${bindir}/simg_dump \ + ${bindir}/mkuserimg \ +" + +BBCLASSEXTEND = "native" |