summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2017-02-21 19:46:24 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2017-02-22 13:17:07 +0100
commitf7326128b848e798922ccba07eeb4c5f51ca8ce0 (patch)
tree4441a9123b60000c000e5212e3778bfecb1f5c9c
parent4816cb8bc5f73f412fd516c71531b8a6c2ca318c (diff)
downloadmeta-openembedded-f7326128b848e798922ccba07eeb4c5f51ca8ce0.tar.gz
android-tools: add libcap dependency and fix build on big endian systems
* add dependency on libcap to fix: android-tools/5.1.1.r37-r0/git/system/core/adb/adb.c:39:28: fatal error: sys/capability.h: No such file or directory #include <sys/capability.h> ^ * add patch from buildroot to fix build with newer glibc and on bit-endian systems android-tools/5.1.1.r37-r0/git/system/core/adb/usb_linux_client.c:38:25: error: initializer element is not constant #define cpu_to_le32(x) htole32(x) ^ * and also disable thumb to fix: http://errors.yoctoproject.org/Errors/Details/133881/ * drop default apply=yes for the .patch files Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch39
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb23
2 files changed, 53 insertions, 9 deletions
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch b/meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch
new file mode 100644
index 000000000..8deaf3a3d
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/fix-big-endian-build.patch
@@ -0,0 +1,39 @@
1Fix build on big endian systems
2
3The usb_linux_client.c file defines cpu_to_le16/32 by using the C
4library htole16/32 function calls. However, cpu_to_le16/32 are used
5when initializing structures, i.e in a context where a function call
6is not allowed.
7
8It works fine on little endian systems because htole16/32 are defined
9by the C library as no-ops. But on big-endian systems, they are
10actually doing something, which might involve calling a function,
11causing build failures.
12
13To solve this, we simply open-code cpu_to_le16/32 in a way that allows
14them to be used when initializing structures.
15
16Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17
18Index: b/system/core/adb/usb_linux_client.c
19===================================================================
20--- a/system/core/adb/usb_linux_client.c
21+++ b/system/core/adb/usb_linux_client.c
22@@ -34,8 +34,15 @@
23 #define MAX_PACKET_SIZE_FS 64
24 #define MAX_PACKET_SIZE_HS 512
25
26-#define cpu_to_le16(x) htole16(x)
27-#define cpu_to_le32(x) htole32(x)
28+#if __BYTE_ORDER == __LITTLE_ENDIAN
29+# define cpu_to_le16(x) (x)
30+# define cpu_to_le32(x) (x)
31+#else
32+# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))
33+# define cpu_to_le32(x) \
34+ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \
35+ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
36+#endif
37
38 struct usb_handle
39 {
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
index a9e7d5d82..f39a82ccc 100644
--- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
+++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = " \
7 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \ 7 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \
8 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ 8 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \
9" 9"
10DEPENDS = "libbsd libpcre openssl zlib" 10DEPENDS = "libbsd libpcre openssl zlib libcap"
11 11
12ANDROID_TAG = "android-5.1.1_r37" 12ANDROID_TAG = "android-5.1.1_r37"
13ANDROID_MIRROR = "android.googlesource.com" 13ANDROID_MIRROR = "android.googlesource.com"
@@ -23,14 +23,15 @@ SRC_URI = " \
23 git://${LIBHARDWARE_REPO};name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware;tag=${ANDROID_TAG} \ 23 git://${LIBHARDWARE_REPO};name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware;tag=${ANDROID_TAG} \
24 git://${LIBSELINUX_REPO};name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux;tag=${ANDROID_TAG} \ 24 git://${LIBSELINUX_REPO};name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux;tag=${ANDROID_TAG} \
25 git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build;tag=${ANDROID_TAG} \ 25 git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build;tag=${ANDROID_TAG} \
26 file://remove-selinux-android.patch;apply=yes \ 26 file://remove-selinux-android.patch \
27 file://use-capability.patch;apply=yes \ 27 file://use-capability.patch \
28 file://use-local-socket.patch;apply=yes \ 28 file://use-local-socket.patch \
29 file://preserve-ownership.patch;apply=yes \ 29 file://preserve-ownership.patch \
30 file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch;apply=yes \ 30 file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch \
31 file://remove-bionic-android.patch;apply=yes \ 31 file://remove-bionic-android.patch \
32 file://define-shell-command.patch;apply=yes \ 32 file://define-shell-command.patch \
33 file://implicit-declaration-function-strlcat-strlcopy.patch;apply=yes \ 33 file://implicit-declaration-function-strlcat-strlcopy.patch \
34 file://fix-big-endian-build.patch \
34 file://android-tools-adbd.service \ 35 file://android-tools-adbd.service \
35 file://.gitignore;subdir=git \ 36 file://.gitignore;subdir=git \
36 file://adb.mk;subdir=${BPN} \ 37 file://adb.mk;subdir=${BPN} \
@@ -43,6 +44,10 @@ SRC_URI = " \
43S = "${WORKDIR}/git" 44S = "${WORKDIR}/git"
44B = "${WORKDIR}/${BPN}" 45B = "${WORKDIR}/${BPN}"
45 46
47# http://errors.yoctoproject.org/Errors/Details/133881/
48ARM_INSTRUCTION_SET_armv4 = "arm"
49ARM_INSTRUCTION_SET_armv5 = "arm"
50
46inherit systemd 51inherit systemd
47 52
48SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service" 53SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service"