summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2016-09-07 12:58:47 +0300
committerMartin Jansa <Martin.Jansa@gmail.com>2016-09-15 10:22:46 +0200
commita231c431a522ae1821fc484bb1a1f9997ecabf20 (patch)
tree0513730154c45ce23dc35393bcf1ec609590a23b /meta-oe/recipes-devtools
parent4fad615950a92db633d2d46fddd3fc491a853e55 (diff)
downloadmeta-openembedded-a231c431a522ae1821fc484bb1a1f9997ecabf20.tar.gz
android-tools: add recipe from AOSP tag android-5.1.1_r37
Android tools offer filsystem tools for creating sparse images, so package them in package of its own. This recipe is re-worked and not a straight import from meta-shr. It's built from AOSP source. I've dropped the ubuntu-ism which will never be upstreamed. The intent is to be closer to the upstream AOSP source code and be able to update the recipe regularly. Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-devtools')
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup25
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb13
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/.gitignore57
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/adb.mk72
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk163
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service12
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch23
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk103
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk89
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/implicit-declaration-function-strlcat-strlcopy.patch42
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg-Add-dt-parameter-to-specify-DT-image.patch108
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk29
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch72
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch67
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch56
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch19
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch62
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb136
18 files changed, 1148 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup b/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup
new file mode 100644
index 000000000..f7d997372
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup
@@ -0,0 +1,25 @@
1#!/bin/sh
2
3# TODO enable the lines below once we have support for getprop
4# retrieve the product info from Android
5# manufacturer=$(getprop ro.product.manufacturer Android)
6# model=$(getprop ro.product.model Android)
7# serial=$(getprop ro.serialno 0123456789ABCDEF)
8
9manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)"
10model="$(cat /system/build.prop | grep -o 'ro.product.model=.*' | cut -d'=' -f 2)"
11# get the device serial number from /proc/cmdline directly(since we have no getprop on
12# GNU/Linux)
13serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')"
14
15echo $serial > /sys/class/android_usb/android0/iSerial
16echo $manufacturer > /sys/class/android_usb/android0/iManufacturer
17echo $model > /sys/class/android_usb/android0/iProduct
18
19echo "0" > /sys/class/android_usb/android0/enable
20echo "18d1" > /sys/class/android_usbid_usb/android0/idVendor
21echo "D002" > /sys/class/android_usb/android0/idProduct
22echo "adb" > /sys/class/android_usb/android0/functions
23echo "1" > /sys/class/android_usb/android0/enable
24
25sleep 4
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb b/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb
new file mode 100644
index 000000000..af98f92f0
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb
@@ -0,0 +1,13 @@
1DESCRIPTION = "Different utilities from Android - corressponding configuration files"
2SECTION = "console/utils"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
5
6SRC_URI = "file://android-gadget-setup"
7
8PACKAGE_ARCH = "${MACHINE_ARCH}"
9
10do_install() {
11 install -d ${D}${bindir}
12 install -m 0755 ${WORKDIR}/android-gadget-setup ${D}${bindir}
13}
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/.gitignore b/meta-oe/recipes-devtools/android-tools/android-tools/.gitignore
new file mode 100644
index 000000000..b8a08f824
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/.gitignore
@@ -0,0 +1,57 @@
1*
2!.gitignore
3!*.indirectionsymlink
4!*.[ch]
5!*.mk
6!NOTICE
7!MODULE_LICENSE_*
8!/system/
9!/system/core/
10!/system/core/adb/
11!/system/core/fastboot/
12!/system/core/fs_mgr/
13!/system/core/fs_mgr/include/
14!/system/core/include/
15!/system/core/include/android/
16!/system/core/include/cutils/
17!/system/core/include/log/
18!/system/core/include/mincrypt/
19!/system/core/include/private/
20!/system/core/include/utils/
21!/system/core/include/zipfile/
22!/system/core/liblog/
23!/system/core/liblog/tests/
24!/system/core/libcutils/
25!/system/core/libmincrypt/
26!/system/core/libzipfile/
27!/system/core/libsparse/
28!/system/core/libsparse/include/
29!/system/core/libsparse/include/sparse/
30!/system/core/libsparse/simg_dump.py
31!/system/core/mkbootimg/
32!/system/extras/
33!/system/extras/ext4_utils/
34!/system/extras/ext4_utils/mkuserimg.sh
35!/system/extras/ext4_utils/test_ext4fixup
36!/system/extras/f2fs_utils/
37!/hardware/
38!/hardware/libhardware/
39!/hardware/libhardware/include/
40!/hardware/libhardware/include/hardware/
41!/external/
42!/external/libselinux/
43!/external/libselinux/include/
44!/external/libselinux/include/selinux/
45!/external/libselinux/src/
46!/external/f2fs-tools/
47!/external/f2fs-tools/include/
48!/external/f2fs-tools/lib/
49!/external/f2fs-tools/mkfs/
50!/build/
51!/build/core/
52!/build/core/version_defaults.mk
53!/build/core/combo/
54!/build/core/combo/include/
55!/build/core/combo/include/arch/
56!/build/core/combo/include/arch/linux-*/
57!/build/core/combo/include/arch/linux-*/AndroidConfig.h
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk b/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk
new file mode 100644
index 000000000..0687c22c1
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk
@@ -0,0 +1,72 @@
1# Makefile for adb
2
3SRCDIR ?= $(S)
4
5VPATH += $(SRCDIR)/system/core/adb
6adb_SRC_FILES += adb.c
7adb_SRC_FILES += console.c
8adb_SRC_FILES += transport.c
9adb_SRC_FILES += transport_local.c
10adb_SRC_FILES += transport_usb.c
11adb_SRC_FILES += commandline.c
12adb_SRC_FILES += adb_client.c
13adb_SRC_FILES += adb_auth_host.c
14adb_SRC_FILES += sockets.c
15adb_SRC_FILES += services.c
16adb_SRC_FILES += file_sync_client.c
17adb_SRC_FILES += get_my_path_linux.c
18adb_SRC_FILES += usb_linux.c
19adb_SRC_FILES += usb_vendors.c
20adb_SRC_FILES += fdevent.c
21adb_OBJS := $(adb_SRC_FILES:.c=.o)
22
23VPATH += $(SRCDIR)/system/core/libcutils
24libcutils_SRC_FILES += atomic.c
25libcutils_SRC_FILES += hashmap.c
26libcutils_SRC_FILES += native_handle.c
27libcutils_SRC_FILES += config_utils.c
28libcutils_SRC_FILES += cpu_info.c
29libcutils_SRC_FILES += load_file.c
30# libcutils_SRC_FILES += open_memstream.c
31# libcutils_SRC_FILES += strdup16to8.c
32# libcutils_SRC_FILES += strdup8to16.c
33# libcutils_SRC_FILES += record_stream.c
34# libcutils_SRC_FILES += process_name.c
35# libcutils_SRC_FILES += threads.c
36# libcutils_SRC_FILES += sched_policy.c
37# libcutils_SRC_FILES += iosched_policy.c
38libcutils_SRC_FILES += str_parms.c
39libcutils_SRC_FILES += fs.c
40libcutils_SRC_FILES += multiuser.c
41libcutils_SRC_FILES += socket_inaddr_any_server.c
42libcutils_SRC_FILES += socket_local_client.c
43libcutils_SRC_FILES += socket_local_server.c
44libcutils_SRC_FILES += socket_loopback_client.c
45libcutils_SRC_FILES += socket_loopback_server.c
46libcutils_SRC_FILES += socket_network_client.c
47libcutils_SRC_FILES += sockets.c
48libcutils_SRC_FILES += ashmem-host.c
49libcutils_SRC_FILES += dlmalloc_stubs.c
50libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o)
51
52CFLAGS += -DANDROID
53CFLAGS += -DWORKAROUND_BUG6558362
54CFLAGS += -DADB_HOST=1
55CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
56CFLAGS += -DANDROID_SMP=0
57CFLAGS += -I$(SRCDIR)/system/core/adb
58CFLAGS += -I$(SRCDIR)/system/core/include
59CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h
60
61LIBS += libcutils.a -lpthread -lcrypto
62
63all: adb
64
65adb: libcutils.a $(adb_OBJS)
66 $(CC) -o $@ $(LDFLAGS) $(adb_OBJS) $(LIBS)
67
68libcutils.a: $(libcutils_OBJS)
69 $(AR) rcs $@ $(libcutils_OBJS)
70
71clean:
72 $(RM) $(adb_OBJS) $(libcutils_OBJS) adb *.a
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk b/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk
new file mode 100644
index 000000000..84cd06b10
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk
@@ -0,0 +1,163 @@
1# Makefile for adbd
2
3SRCDIR ?= $(S)
4
5VPATH += $(SRCDIR)/system/core/adb
6adbd_SRC_FILES += adb.c
7adbd_SRC_FILES += fdevent.c
8adbd_SRC_FILES += transport.c
9adbd_SRC_FILES += transport_local.c
10adbd_SRC_FILES += transport_usb.c
11adbd_SRC_FILES += adb_auth_client.c
12adbd_SRC_FILES += sockets.c
13adbd_SRC_FILES += services.c
14adbd_SRC_FILES += file_sync_service.c
15adbd_SRC_FILES += jdwp_service.c
16adbd_SRC_FILES += framebuffer_service.c
17adbd_SRC_FILES += remount_service.c
18adbd_SRC_FILES += disable_verity_service.c
19adbd_SRC_FILES += usb_linux_client.c
20adbd_OBJS := $(adbd_SRC_FILES:.c=.o)
21
22VPATH += $(SRCDIR)/system/core/liblog
23liblog_SRC_FILES += logd_write.c
24liblog_SRC_FILES += log_event_write.c
25liblog_SRC_FILES += logprint.c
26liblog_SRC_FILES += event_tag_map.c
27liblog_SRC_FILES += fake_log_device.c
28liblog_OBJS := $(liblog_SRC_FILES:.c=.o)
29
30VPATH += $(SRCDIR)/system/core/fs_mgr
31fs_mgr_SRC_FILES += fs_mgr_fstab.c
32fs_mgr_OBJS := $(fs_mgr_SRC_FILES:.c=.o)
33
34VPATH += $(SRCDIR)/system/core/libcutils
35libcutils_SRC_FILES += atomic.c
36libcutils_SRC_FILES += hashmap.c
37libcutils_SRC_FILES += native_handle.c
38libcutils_SRC_FILES += config_utils.c
39libcutils_SRC_FILES += cpu_info.c
40libcutils_SRC_FILES += load_file.c
41# libcutils_SRC_FILES += open_memstream.c
42# libcutils_SRC_FILES += strdup16to8.c
43# libcutils_SRC_FILES += strdup8to16.c
44# libcutils_SRC_FILES += record_stream.c
45# libcutils_SRC_FILES += process_name.c
46# libcutils_SRC_FILES += threads.c
47# libcutils_SRC_FILES += sched_policy.c
48# libcutils_SRC_FILES += iosched_policy.c
49libcutils_SRC_FILES += str_parms.c
50libcutils_SRC_FILES += fs.c
51libcutils_SRC_FILES += multiuser.c
52libcutils_SRC_FILES += socket_inaddr_any_server.c
53libcutils_SRC_FILES += socket_local_client.c
54libcutils_SRC_FILES += socket_local_server.c
55libcutils_SRC_FILES += socket_loopback_client.c
56libcutils_SRC_FILES += socket_loopback_server.c
57libcutils_SRC_FILES += socket_network_client.c
58libcutils_SRC_FILES += sockets.c
59libcutils_SRC_FILES += ashmem-host.c
60libcutils_SRC_FILES += dlmalloc_stubs.c
61libcutils_SRC_FILES += klog.c
62libcutils_SRC_FILES += properties.c
63libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o)
64
65VPATH += $(SRCDIR)/external/libselinux/src
66libselinux_SRC_FILES += booleans.c
67libselinux_SRC_FILES += canonicalize_context.c
68libselinux_SRC_FILES += disable.c
69libselinux_SRC_FILES += enabled.c
70libselinux_SRC_FILES += fgetfilecon.c
71libselinux_SRC_FILES += fsetfilecon.c
72libselinux_SRC_FILES += getenforce.c
73libselinux_SRC_FILES += getfilecon.c
74libselinux_SRC_FILES += getpeercon.c
75libselinux_SRC_FILES += lgetfilecon.c
76libselinux_SRC_FILES += load_policy.c
77libselinux_SRC_FILES += lsetfilecon.c
78libselinux_SRC_FILES += policyvers.c
79libselinux_SRC_FILES += procattr.c
80libselinux_SRC_FILES += setenforce.c
81libselinux_SRC_FILES += setfilecon.c
82libselinux_SRC_FILES += context.c
83libselinux_SRC_FILES += mapping.c
84libselinux_SRC_FILES += stringrep.c
85libselinux_SRC_FILES += compute_create.c
86libselinux_SRC_FILES += compute_av.c
87libselinux_SRC_FILES += avc.c
88libselinux_SRC_FILES += avc_internal.c
89libselinux_SRC_FILES += avc_sidtab.c
90libselinux_SRC_FILES += get_initial_context.c
91libselinux_SRC_FILES += checkAccess.c
92libselinux_SRC_FILES += sestatus.c
93libselinux_SRC_FILES += deny_unknown.c
94
95libselinux_SRC_FILES += callbacks.c
96libselinux_SRC_FILES += check_context.c
97libselinux_SRC_FILES += freecon.c
98libselinux_SRC_FILES += init.c
99libselinux_SRC_FILES += label.c
100libselinux_SRC_FILES += label_file.c
101libselinux_SRC_FILES += label_android_property.c
102libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o)
103
104VPATH += $(SRCDIR)/system/extras/ext4_utils
105libext4_utils_SRC_FILES += make_ext4fs.c
106libext4_utils_SRC_FILES += ext4fixup.c
107libext4_utils_SRC_FILES += ext4_utils.c
108libext4_utils_SRC_FILES += allocate.c
109libext4_utils_SRC_FILES += contents.c
110libext4_utils_SRC_FILES += extent.c
111libext4_utils_SRC_FILES += indirect.c
112libext4_utils_SRC_FILES += uuid.c
113libext4_utils_SRC_FILES += sha1.c
114libext4_utils_SRC_FILES += wipe.c
115libext4_utils_SRC_FILES += crc16.c
116libext4_utils_SRC_FILES += ext4_sb.c
117libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o)
118
119CFLAGS += -std=gnu11
120CFLAGS += -DANDROID
121CFLAGS += -DADB_HOST=0
122CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
123CFLAGS += -DALLOW_ADBD_ROOT=1
124CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
125CFLAGS += -DPROP_NAME_MAX=32
126CFLAGS += -DPROP_VALUE_MAX=92
127CFLAGS += -DAUDITD_LOG_TAG=1003
128# CFLAGS += -DHOST
129CFLAGS += -DANDROID_SMP=0
130CFLAGS += -I$(SRCDIR)/system/core/adb
131CFLAGS += -I$(SRCDIR)/system/core/include
132CFLAGS += -I$(SRCDIR)/system/core/libsparse/include
133CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils
134CFLAGS += -I$(SRCDIR)/system/core/fs_mgr/include
135CFLAGS += -I$(SRCDIR)/hardware/libhardware/include
136CFLAGS += -I$(SRCDIR)/external/libselinux/include
137CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h
138
139LIBS += liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a -lpthread -lbsd -lpcre -lresolv -lcrypto
140
141all: adbd
142
143adbd: liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a $(adbd_OBJS)
144 $(CC) -o $@ $(LDFLAGS) $(adbd_OBJS) $(LIBS)
145
146liblog.a: $(liblog_OBJS)
147 $(AR) rcs $@ $(liblog_OBJS)
148
149libfs_mgr.a: $(fs_mgr_OBJS)
150 $(AR) rcs $@ $(fs_mgr_OBJS)
151
152libcutils.a: $(libcutils_OBJS)
153 $(AR) rcs $@ $(libcutils_OBJS)
154
155libselinux.a: $(libselinux_OBJS)
156 export CFLAGS="-DANDROID -DHOST"
157 $(AR) rcs $@ $(libselinux_OBJS)
158
159libext4_utils.a: $(libext4_utils_OBJS)
160 $(AR) rcs $@ $(libext4_utils_OBJS)
161
162clean:
163 $(RM) *.o *.a adbd
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service b/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service
new file mode 100644
index 000000000..88ed6871d
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service
@@ -0,0 +1,12 @@
1[Unit]
2Description=Android Debug Bridge
3
4[Service]
5Type=simple
6Restart=on-failure
7ExecStartPre=/usr/bin/android-gadget-setup adb
8ExecStart=/usr/bin/adbd
9StandardOutput=null
10
11[Install]
12WantedBy=basic.target
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch b/meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch
new file mode 100644
index 000000000..8381967c4
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/define-shell-command.patch
@@ -0,0 +1,23 @@
1Description: we intend to run on Linux system so the shell is always /bin/sh,
2 for the host or the target.
3Author: Fathi Boudra <fabo@debian.org>
4
5Upstream-Status: Inappropriate
6---
7 system/core/adb/services.c | 4 ----
8 1 file changed, 4 deletions(-)
9
10--- a/system/core/adb/services.c
11+++ b/system/core/adb/services.c
12@@ -299,11 +299,7 @@ static int create_subproc_raw(const char
13 }
14 #endif /* !ABD_HOST */
15
16-#if ADB_HOST
17 #define SHELL_COMMAND "/bin/sh"
18-#else
19-#define SHELL_COMMAND "/system/bin/sh"
20-#endif
21
22 #if !ADB_HOST
23 static void subproc_waiter_service(int fd, void *cookie)
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk b/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk
new file mode 100644
index 000000000..c18aa9c4d
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk
@@ -0,0 +1,103 @@
1# Makefile for ext4_utils
2
3SRCDIR ?= $(S)
4
5VPATH += $(SRCDIR)/system/extras/ext4_utils
6make_ext4fs_SRC_FILES += make_ext4fs_main.c
7make_ext4fs_SRC_FILES += canned_fs_config.c
8make_ext4fs_OBJS := $(make_ext4fs_SRC_FILES:.c=.o)
9
10ext2simg_SRC_FILES += ext2simg.c
11ext2simg_OBJS := $(ext2simg_SRC_FILES:.c=.o)
12
13ext4fixup_SRC_FILES += ext4fixup_main.c
14ext4fixup_OBJS := $(ext4fixup_SRC_FILES:.c=.o)
15
16libext4_utils_SRC_FILES += make_ext4fs.c
17libext4_utils_SRC_FILES += ext4fixup.c
18libext4_utils_SRC_FILES += ext4_utils.c
19libext4_utils_SRC_FILES += allocate.c
20libext4_utils_SRC_FILES += contents.c
21libext4_utils_SRC_FILES += extent.c
22libext4_utils_SRC_FILES += indirect.c
23libext4_utils_SRC_FILES += uuid.c
24libext4_utils_SRC_FILES += sha1.c
25libext4_utils_SRC_FILES += wipe.c
26libext4_utils_SRC_FILES += crc16.c
27libext4_utils_SRC_FILES += ext4_sb.c
28libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o)
29
30VPATH += $(SRCDIR)/system/core/libsparse
31simg2img_SRC_FILES += simg2img.c
32simg2img_SRC_FILES += sparse_crc32.c
33simg2img_OBJS := $(simg2img_SRC_FILES:.c=.o)
34
35img2simg_SRC_FILES += img2simg.c
36img2simg_OBJS := $(img2simg_SRC_FILES:.c=.o)
37
38simg2simg_SRC_FILES += simg2simg.c
39simg2simg_SRC_FILES += sparse_crc32.c
40simg2simg_OBJS := $(simg2simg_SRC_FILES:.c=.o)
41
42libsparse_SRC_FILES += backed_block.c
43libsparse_SRC_FILES += output_file.c
44libsparse_SRC_FILES += sparse.c
45libsparse_SRC_FILES += sparse_crc32.c
46libsparse_SRC_FILES += sparse_err.c
47libsparse_SRC_FILES += sparse_read.c
48libsparse_OBJS := $(libsparse_SRC_FILES:.c=.o)
49
50VPATH += $(SRCDIR)/external/libselinux/src
51libselinux_SRC_FILES += callbacks.c
52libselinux_SRC_FILES += check_context.c
53libselinux_SRC_FILES += freecon.c
54libselinux_SRC_FILES += init.c
55libselinux_SRC_FILES += label.c
56libselinux_SRC_FILES += label_file.c
57libselinux_SRC_FILES += label_android_property.c
58libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o)
59
60CFLAGS += -DANDROID
61CFLAGS += -DHOST
62CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils
63CFLAGS += -I$(SRCDIR)/system/core/include
64CFLAGS += -I$(SRCDIR)/system/core/libsparse/include
65CFLAGS += -I$(SRCDIR)/external/libselinux/include
66CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h
67
68all: make_ext4fs ext2simg ext4fixup simg2img img2simg simg2simg
69
70make_ext4fs: libext4_utils.a libsparse.a libselinux.a $(make_ext4fs_OBJS)
71 $(CC) -o $@ $(LDFLAGS) $(make_ext4fs_OBJS) \
72 libext4_utils.a libsparse.a libselinux.a -lz -lpcre
73
74ext2simg: libext4_utils.a libselinux.a libsparse.a $(ext2simg_OBJS)
75 $(CC) -o $@ $(LDFLAGS) $(ext2simg_OBJS) \
76 libext4_utils.a libselinux.a libsparse.a -lz -lpcre
77
78ext4fixup: libext4_utils.a libsparse.a $(ext4fixup_OBJS)
79 $(CC) -o $@ $(LDFLAGS) $(ext4fixup_OBJS) libext4_utils.a libsparse.a -lz
80
81simg2img: libsparse.a $(simg2img_OBJS)
82 $(CC) -o $@ $(LDFLAGS) $(simg2img_OBJS) libsparse.a -lz
83
84img2simg: libsparse.a $(img2simg_OBJS)
85 $(CC) -o $@ $(LDFLAGS) $(img2simg_OBJS) libsparse.a -lz
86
87simg2simg: libsparse.a $(simg2simg_OBJS)
88 $(CC) -o $@ $(LDFLAGS) $(simg2simg_OBJS) libsparse.a -lz
89
90libext4_utils.a: $(libext4_utils_OBJS)
91 $(AR) rcs $@ $(libext4_utils_OBJS)
92
93libsparse.a: $(libsparse_OBJS)
94 $(AR) rcs $@ $(libsparse_OBJS)
95
96libselinux.a: $(libselinux_OBJS)
97 $(AR) rcs $@ $(libselinux_OBJS)
98
99clean:
100 $(RM) $(make_ext4fs_OBJS) $(ext2simg_OBJS) $(ext4fixup_OBJS) \
101 $(simg2img_OBJS) $(img2simg_OBJS) $(simg2simg_OBJS) \
102 $(libext4_utils_OBJS) $(libsparse_OBJS) $(libselinux_OBJS) \
103 make_ext4fs ext2simg ext4fixup simg2img img2simg simg2simg *.a
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk b/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk
new file mode 100644
index 000000000..b9ba95f38
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk
@@ -0,0 +1,89 @@
1# Makefile for fastboot
2
3SRCDIR ?= $(S)
4
5VPATH += $(SRCDIR)/system/core/fastboot
6fastboot_SRC_FILES += protocol.c
7fastboot_SRC_FILES += engine.c
8fastboot_SRC_FILES += bootimg.c
9fastboot_SRC_FILES += fastboot.c
10fastboot_SRC_FILES += util.c
11fastboot_SRC_FILES += fs.c
12fastboot_SRC_FILES += usb_linux.c
13fastboot_SRC_FILES += util_linux.c
14fastboot_OBJS := $(fastboot_SRC_FILES:.c=.o)
15
16VPATH += $(SRCDIR)/system/core/libzipfile
17libzipfile_SRC_FILES += centraldir.c
18libzipfile_SRC_FILES += zipfile.c
19libzipfile_OBJS := $(libzipfile_SRC_FILES:.c=.o)
20
21VPATH += $(SRCDIR)/system/extras/ext4_utils
22libext4_utils_SRC_FILES += make_ext4fs.c
23libext4_utils_SRC_FILES += ext4fixup.c
24libext4_utils_SRC_FILES += ext4_utils.c
25libext4_utils_SRC_FILES += allocate.c
26libext4_utils_SRC_FILES += contents.c
27libext4_utils_SRC_FILES += extent.c
28libext4_utils_SRC_FILES += indirect.c
29libext4_utils_SRC_FILES += uuid.c
30libext4_utils_SRC_FILES += sha1.c
31libext4_utils_SRC_FILES += wipe.c
32libext4_utils_SRC_FILES += crc16.c
33libext4_utils_SRC_FILES += ext4_sb.c
34libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o)
35
36VPATH += $(SRCDIR)/system/core/libsparse
37libsparse_SRC_FILES += backed_block.c
38libsparse_SRC_FILES += output_file.c
39libsparse_SRC_FILES += sparse.c
40libsparse_SRC_FILES += sparse_crc32.c
41libsparse_SRC_FILES += sparse_err.c
42libsparse_SRC_FILES += sparse_read.c
43libsparse_OBJS := $(libsparse_SRC_FILES:.c=.o)
44
45VPATH += $(SRCDIR)/external/libselinux/src
46libselinux_SRC_FILES += callbacks.c
47libselinux_SRC_FILES += check_context.c
48libselinux_SRC_FILES += freecon.c
49libselinux_SRC_FILES += init.c
50libselinux_SRC_FILES += label.c
51libselinux_SRC_FILES += label_file.c
52libselinux_SRC_FILES += label_android_property.c
53libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o)
54
55CFLAGS += -std=gnu11
56CFLAGS += -DANDROID
57# CFLAGS += -DUSE_F2FS
58CFLAGS += -DHOST
59CFLAGS += -I$(SRCDIR)/system/core/fastboot
60CFLAGS += -I$(SRCDIR)/system/core/include
61CFLAGS += -I$(SRCDIR)/system/core/mkbootimg
62CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils
63CFLAGS += -I$(SRCDIR)/system/extras/f2fs_utils
64CFLAGS += -I$(SRCDIR)/system/core/libsparse/include
65CFLAGS += -I$(SRCDIR)/external/libselinux/include
66CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h
67
68LIBS += libzipfile.a libext4_utils.a libsparse.a libselinux.a -lz -lpcre
69
70all: fastboot
71
72fastboot: libzipfile.a libext4_utils.a libsparse.a libselinux.a $(fastboot_OBJS)
73 $(CC) -o $@ $(LDFLAGS) $(fastboot_OBJS) $(LIBS)
74
75libzipfile.a: $(libzipfile_OBJS)
76 $(AR) rcs $@ $(libzipfile_OBJS)
77
78libext4_utils.a: $(libext4_utils_OBJS)
79 $(AR) rcs $@ $(libext4_utils_OBJS)
80
81libsparse.a: $(libsparse_OBJS)
82 $(AR) rcs $@ $(libsparse_OBJS)
83
84libselinux.a: $(libselinux_OBJS)
85 $(AR) rcs $@ $(libselinux_OBJS)
86
87clean:
88 $(RM) $(fastboot_OBJS) $(libzipfile_OBJS) $(libext4_utils_OBJS) \
89 $(libsparse_OBJS) $(libselinux_OBJS) fastboot *.a
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/implicit-declaration-function-strlcat-strlcopy.patch b/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-oe/recipes-devtools/android-tools/android-tools/implicit-declaration-function-strlcat-strlcopy.patch
@@ -0,0 +1,42 @@
1Description: fix implicit declaration of stlcat/strlcopy functions.
2Author: Fathi Boudra <fabo@debian.org>
3
4Upstream-Status: Inappropriate
5---
6 system/core/adb/adb.c | 1 +
7 system/core/fs_mgr/fs_mgr_fstab.c | 2 +-
8 system/core/include/cutils/sockets.h | 2 +-
9 3 files changed, 3 insertions(+), 2 deletions(-)
10
11--- a/system/core/fs_mgr/fs_mgr_fstab.c
12+++ b/system/core/fs_mgr/fs_mgr_fstab.c
13@@ -17,7 +17,7 @@
14 #include <ctype.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17-#include <string.h>
18+#include <bsd/string.h>
19 #include <sys/mount.h>
20
21 #include "fs_mgr_priv.h"
22--- a/system/core/include/cutils/sockets.h
23+++ b/system/core/include/cutils/sockets.h
24@@ -19,7 +19,7 @@
25
26 #include <errno.h>
27 #include <stdlib.h>
28-#include <string.h>
29+#include <bsd/string.h>
30 #include <stdbool.h>
31
32 #ifdef HAVE_WINSOCK
33--- a/system/core/adb/adb.c
34+++ b/system/core/adb/adb.c
35@@ -41,6 +41,7 @@
36 #include <sys/prctl.h>
37 #include <getopt.h>
38 #include <selinux/selinux.h>
39+#include <grp.h>
40 #else
41 #include "usb_vendors.h"
42 #endif
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg-Add-dt-parameter-to-specify-DT-image.patch b/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-oe/recipes-devtools/android-tools/android-tools/mkbootimg-Add-dt-parameter-to-specify-DT-image.patch
@@ -0,0 +1,108 @@
1From cc5e7b02a3be57709a1aed6e34be100b82a71620 Mon Sep 17 00:00:00 2001
2From: David Ng <dave@codeaurora.org>
3Date: Fri, 27 Jul 2012 17:15:03 -0700
4Subject: [PATCH 1/2] mkbootimg: Add --dt parameter to specify DT image
5
6New optional --dt parameter to specify a kernel device
7tree image.
8
9Change-Id: Ie29a11cbf4138426bfd19ae486d69a5fcbd8f442
10
11Upstream-Status: Inappropriate
12---
13 system/core/mkbootimg/bootimg.h | 7 +++++--
14 system/core/mkbootimg/mkbootimg.c | 21 +++++++++++++++++++++
15 2 files changed, 26 insertions(+), 2 deletions(-)
16
17--- a/system/core/mkbootimg/bootimg.h
18+++ b/system/core/mkbootimg/bootimg.h
19@@ -41,8 +41,8 @@ struct boot_img_hdr
20
21 unsigned tags_addr; /* physical addr for kernel tags */
22 unsigned page_size; /* flash page size we assume */
23- unsigned unused[2]; /* future expansion: should be 0 */
24-
25+ unsigned dt_size; /* device tree in bytes */
26+ unsigned unused; /* future expansion: should be 0 */
27 unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */
28
29 unsigned char cmdline[BOOT_ARGS_SIZE];
30@@ -64,10 +64,13 @@ struct boot_img_hdr
31 ** +-----------------+
32 ** | second stage | o pages
33 ** +-----------------+
34+** | device tree | p pages
35+** +-----------------+
36 **
37 ** n = (kernel_size + page_size - 1) / page_size
38 ** m = (ramdisk_size + page_size - 1) / page_size
39 ** o = (second_size + page_size - 1) / page_size
40+** p = (dt_size + page_size - 1) / page_size
41 **
42 ** 0. all entities are page_size aligned in flash
43 ** 1. kernel and ramdisk are required (size != 0)
44--- a/system/core/mkbootimg/mkbootimg.c
45+++ b/system/core/mkbootimg/mkbootimg.c
46@@ -65,6 +65,7 @@ int usage(void)
47 " [ --board <boardname> ]\n"
48 " [ --base <address> ]\n"
49 " [ --pagesize <pagesize> ]\n"
50+ " [ --dt <filename> ]\n"
51 " -o|--output <filename>\n"
52 );
53 return 1;
54@@ -105,6 +106,8 @@ int main(int argc, char **argv)
55 char *cmdline = "";
56 char *bootimg = 0;
57 char *board = "";
58+ char *dt_fn = 0;
59+ void *dt_data = 0;
60 unsigned pagesize = 2048;
61 int fd;
62 SHA_CTX ctx;
63@@ -158,6 +161,8 @@ int main(int argc, char **argv)
64 fprintf(stderr,"error: unsupported page size %d\n", pagesize);
65 return -1;
66 }
67+ } else if(!strcmp(arg, "--dt")) {
68+ dt_fn = val;
69 } else {
70 return usage();
71 }
72@@ -232,6 +237,14 @@ int main(int argc, char **argv)
73 }
74 }
75
76+ if(dt_fn) {
77+ dt_data = load_file(dt_fn, &hdr.dt_size);
78+ if (dt_data == 0) {
79+ fprintf(stderr,"error: could not load device tree image '%s'\n", dt_fn);
80+ return 1;
81+ }
82+ }
83+
84 /* put a hash of the contents in the header so boot images can be
85 * differentiated based on their first 2k.
86 */
87@@ -242,6 +255,10 @@ int main(int argc, char **argv)
88 SHA_update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size));
89 SHA_update(&ctx, second_data, hdr.second_size);
90 SHA_update(&ctx, &hdr.second_size, sizeof(hdr.second_size));
91+ if(dt_data) {
92+ SHA_update(&ctx, dt_data, hdr.dt_size);
93+ SHA_update(&ctx, &hdr.dt_size, sizeof(hdr.dt_size));
94+ }
95 sha = SHA_final(&ctx);
96 memcpy(hdr.id, sha,
97 SHA_DIGEST_SIZE > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_SIZE);
98@@ -266,6 +283,10 @@ int main(int argc, char **argv)
99 if(write_padding(fd, pagesize, hdr.second_size)) goto fail;
100 }
101
102+ if(dt_data) {
103+ if(write(fd, dt_data, hdr.dt_size) != (ssize_t) hdr.dt_size) goto fail;
104+ if(write_padding(fd, pagesize, hdr.dt_size)) goto fail;
105+ }
106 return 0;
107
108 fail:
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk b/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk
new file mode 100644
index 000000000..519f609fd
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk
@@ -0,0 +1,29 @@
1# Makefile for mkbootimg
2
3SRCDIR ?= $(S)
4
5VPATH += $(SRCDIR)/system/core/mkbootimg
6mkbootimg_SRC_FILES += mkbootimg.c
7mkbootimg_OBJS := $(mkbootimg_SRC_FILES:.c=.o)
8
9VPATH += $(SRCDIR)/system/core/libmincrypt
10libmincrypt_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c
11libmincrypt_OBJS := $(libmincrypt_SRC_FILES:.c=.o)
12
13CFLAGS += -DANDROID
14CFLAGS += -I$(SRCDIR)/system/core/mkbootimg
15CFLAGS += -I$(SRCDIR)/system/core/include
16CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h
17
18LIBS += libmincrypt.a
19
20all: mkbootimg
21
22mkbootimg: libmincrypt.a $(mkbootimg_OBJS)
23 $(CC) -o $@ $(LDFLAGS) $(mkbootimg_OBJS) $(LIBS)
24
25libmincrypt.a: $(libmincrypt_OBJS)
26 $(AR) rcs $@ $(libmincrypt_OBJS)
27
28clean:
29 $(RM) $(mkbootimg_OBJS) $(libmincrypt_OBJS) mkbootimg *.a
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch b/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch
new file mode 100644
index 000000000..85af81f0f
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/preserve-ownership.patch
@@ -0,0 +1,72 @@
1Description: add -o argument to preserve ownership
2Author: Markus Mayer <mmayer@mmayer.net>
3
4See also https://android-review.googlesource.com/#/c/100312/
5
6Upstream-Status: Inappropriate
7---
8 system/extras/ext4_utils/make_ext4fs.c | 6 ++++++
9 system/extras/ext4_utils/make_ext4fs_main.c | 10 ++++++++--
10 2 files changed, 14 insertions(+), 2 deletions(-)
11
12--- a/system/extras/ext4_utils/make_ext4fs_main.c
13+++ b/system/extras/ext4_utils/make_ext4fs_main.c
14@@ -49,13 +49,15 @@ extern struct fs_info info;
15
16 extern struct selabel_handle* selinux_android_file_context_handle(void);
17
18+extern int preserve_owner;
19+
20 static void usage(char *path)
21 {
22 fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
23 fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
24 fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n");
25 fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
26- fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
27+ fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -o ] [ -v ] [ -B <block_list_file> ]\n");
28 fprintf(stderr, " <filename> [<directory>]\n");
29 }
30
31@@ -81,7 +83,7 @@ int main(int argc, char **argv)
32 struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } };
33 #endif
34
35- while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctv")) != -1) {
36+ while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctov")) != -1) {
37 switch (opt) {
38 case 'l':
39 info.len = parse_num(optarg);
40@@ -144,6 +146,10 @@ int main(int argc, char **argv)
41 }
42 #endif
43 break;
44+ case 'o':
45+ preserve_owner = 1;
46+ printf("Warning: Enabling 'preserve ownership', this is an unofficial feature!\n");
47+ break;
48 case 'v':
49 verbose = 1;
50 break;
51--- a/system/extras/ext4_utils/make_ext4fs.c
52+++ b/system/extras/ext4_utils/make_ext4fs.c
53@@ -67,6 +67,8 @@
54
55 #endif
56
57+int preserve_owner = 0;
58+
59 /* TODO: Not implemented:
60 Allocating blocks in the same block group as the file inode
61 Hash or binary tree directories
62@@ -185,6 +187,10 @@ static u32 build_directory_structure(con
63 } else {
64 dentries[i].mtime = fixed_time;
65 }
66+ if (preserve_owner) {
67+ dentries[i].uid = stat.st_uid;
68+ dentries[i].gid = stat.st_gid;
69+ }
70 uint64_t capabilities;
71 if (fs_config_func != NULL) {
72 #ifdef ANDROID
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch b/meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch
new file mode 100644
index 000000000..e933724cf
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/remove-bionic-android.patch
@@ -0,0 +1,67 @@
1Description: remove bionic specific calls
2Author: Fathi Boudra <fabo@debian.org>
3
4Upstream-Status: Inappropriate
5---
6 system/core/include/cutils/properties.h | 1 -
7 system/core/libcutils/properties.c | 2 +-
8 system/core/liblog/logd_write.c | 5 +++++
9 3 files changed, 6 insertions(+), 2 deletions(-)
10
11--- a/system/core/include/cutils/properties.h
12+++ b/system/core/include/cutils/properties.h
13@@ -19,7 +19,6 @@
14
15 #include <sys/cdefs.h>
16 #include <stddef.h>
17-#include <sys/system_properties.h>
18 #include <stdint.h>
19
20 #ifdef __cplusplus
21--- a/system/core/liblog/logd_write.c
22+++ b/system/core/liblog/logd_write.c
23@@ -23,6 +23,7 @@
24 #include <stdlib.h>
25 #include <string.h>
26 #include <sys/stat.h>
27+#include <sys/syscall.h>
28 #include <sys/types.h>
29 #if (FAKE_LOG_DEVICE == 0)
30 #include <sys/socket.h>
31@@ -205,7 +206,11 @@ static int __write_to_log_kernel(log_id_
32 realtime_ts.tv_nsec = ts.tv_nsec;
33
34 log_id_buf = log_id;
35+#ifdef __BIONIC__
36 tid = gettid();
37+#else
38+ tid = (pid_t) syscall(__NR_gettid);
39+#endif
40
41 newVec[0].iov_base = (unsigned char *) &log_id_buf;
42 newVec[0].iov_len = sizeof_log_id_t;
43--- a/system/core/libcutils/properties.c
44+++ b/system/core/libcutils/properties.c
45@@ -104,10 +104,10 @@ int32_t property_get_int32(const char *k
46 return (int32_t)property_get_imax(key, INT32_MIN, INT32_MAX, default_value);
47 }
48
49+#undef HAVE_LIBC_SYSTEM_PROPERTIES
50 #ifdef HAVE_LIBC_SYSTEM_PROPERTIES
51
52 #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
53-#include <sys/_system_properties.h>
54
55 int property_set(const char *key, const char *value)
56 {
57--- a/external/libselinux/src/procattr.c
58+++ b/external/libselinux/src/procattr.c
59@@ -8,7 +8,7 @@
60 #include "selinux_internal.h"
61 #include "policy.h"
62
63-#ifdef HOST
64+#ifndef __BIONIC__
65 static pid_t gettid(void)
66 {
67 return syscall(__NR_gettid);
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch b/meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch
new file mode 100644
index 000000000..d4a37f82b
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/remove-selinux-android.patch
@@ -0,0 +1,56 @@
1Subject: drop useless includes of Android SELINUX extensions; avoids having to clone another module; this should be sent upstream
2Author: Sergio Schvezov <sergio.schvezov@canonical.com>
3
4Upstream-Status: Inappropriate
5---
6 system/core/adb/file_sync_service.c | 3 ---
7 system/extras/ext4_utils/make_ext4fs.c | 1 -
8 system/extras/ext4_utils/make_ext4fs_main.c | 1 -
9 3 files changed, 5 deletions(-)
10
11--- a/system/extras/ext4_utils/make_ext4fs.c
12+++ b/system/extras/ext4_utils/make_ext4fs.c
13@@ -62,7 +62,6 @@
14
15 #include <selinux/selinux.h>
16 #include <selinux/label.h>
17-#include <selinux/android.h>
18
19 #define O_BINARY 0
20
21--- a/system/extras/ext4_utils/make_ext4fs_main.c
22+++ b/system/extras/ext4_utils/make_ext4fs_main.c
23@@ -32,7 +32,6 @@
24 #ifndef USE_MINGW
25 #include <selinux/selinux.h>
26 #include <selinux/label.h>
27-#include <selinux/android.h>
28 #else
29 struct selabel_handle;
30 #endif
31--- a/system/core/adb/file_sync_service.c
32+++ b/system/core/adb/file_sync_service.c
33@@ -26,7 +26,6 @@
34
35 #include <errno.h>
36 #include <private/android_filesystem_config.h>
37-#include <selinux/android.h>
38 #include "sysdeps.h"
39
40 #define TRACE_TAG TRACE_SYNC
41@@ -73,7 +72,6 @@ static int mkdirs(char *name)
42 *x = '/';
43 return ret;
44 }
45- selinux_android_restorecon(name, 0);
46 }
47 *x++ = '/';
48 }
49@@ -251,7 +249,6 @@ static int handle_send_file(int s, char
50 if(fd >= 0) {
51 struct utimbuf u;
52 adb_close(fd);
53- selinux_android_restorecon(path, 0);
54 u.actime = timestamp;
55 u.modtime = timestamp;
56 utime(path, &u);
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch b/meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch
new file mode 100644
index 000000000..b8ebe09dc
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/use-capability.patch
@@ -0,0 +1,19 @@
1Subject: use linux/capability.h on linux systems too
2Author: Loïc Minier <loic.minier@ubuntu.com>
3
4Upstream-Status: Inappropriate
5---
6 system/core/include/private/android_filesystem_config.h | 2 +-
7 1 file changed, 1 insertion(+), 1 deletion(-)
8
9--- a/system/core/include/private/android_filesystem_config.h
10+++ b/system/core/include/private/android_filesystem_config.h
11@@ -27,7 +27,7 @@
12 #include <sys/types.h>
13 #include <stdint.h>
14
15-#ifdef HAVE_ANDROID_OS
16+#if defined(HAVE_ANDROID_OS) || defined(__linux__)
17 #include <linux/capability.h>
18 #else
19 #include "android_filesystem_capability.h"
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch b/meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch
new file mode 100644
index 000000000..7facd61b9
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools/use-local-socket.patch
@@ -0,0 +1,62 @@
1Subject: adb: Use local sockets where appropriate
2Author: Hilko Bengen <bengen@debian.org>
3
4Upstream-Status: Inappropriate
5---
6 system/core/adb/adb.c | 6 +++++-
7 system/core/adb/adb_client.c | 5 +++--
8 system/core/adb/transport_local.c | 3 ++-
9 3 files changed, 10 insertions(+), 4 deletions(-)
10
11--- a/system/core/adb/adb.c
12+++ b/system/core/adb/adb.c
13@@ -1230,7 +1230,11 @@ int launch_server(int server_port)
14 */
15 void build_local_name(char* target_str, size_t target_size, int server_port)
16 {
17- snprintf(target_str, target_size, "tcp:%d", server_port);
18+ if (gListenAll > 0) {
19+ snprintf(target_str, target_size, "tcp:%d", server_port);
20+ } else {
21+ snprintf(target_str, target_size, "local:%d", server_port);
22+ }
23 }
24
25 #if !ADB_HOST
26--- a/system/core/adb/adb_client.c
27+++ b/system/core/adb/adb_client.c
28@@ -185,12 +185,12 @@ int _adb_connect(const char *service)
29 strcpy(__adb_error, "service name too long");
30 return -1;
31 }
32- snprintf(tmp, sizeof tmp, "%04x", len);
33+ snprintf(tmp, sizeof tmp, "%d", __adb_server_port);
34
35 if (__adb_server_name)
36 fd = socket_network_client(__adb_server_name, __adb_server_port, SOCK_STREAM);
37 else
38- fd = socket_loopback_client(__adb_server_port, SOCK_STREAM);
39+ fd = socket_local_client(tmp, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
40
41 if(fd < 0) {
42 strcpy(__adb_error, "cannot connect to daemon");
43@@ -201,6 +201,7 @@ int _adb_connect(const char *service)
44 return -1;
45 }
46
47+ snprintf(tmp, sizeof tmp, "%04x", len);
48 if(writex(fd, tmp, 4) || writex(fd, service, len)) {
49 strcpy(__adb_error, "write failure during connection");
50 adb_close(fd);
51--- a/system/core/adb/transport_local.c
52+++ b/system/core/adb/transport_local.c
53@@ -121,7 +121,8 @@ int local_connect_arbitrary_ports(int co
54 }
55 #endif
56 if (fd < 0) {
57- fd = socket_loopback_client(adb_port, SOCK_STREAM);
58+ snprintf(buf, sizeof buf, "%d", adb_port);
59+ fd = socket_local_client(buf, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
60 }
61
62 if (fd >= 0) {
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
new file mode 100644
index 000000000..2dbddf157
--- /dev/null
+++ b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
@@ -0,0 +1,136 @@
1DESCRIPTION = "Different utilities from Android"
2SECTION = "console/utils"
3LICENSE = "Apache-2.0 & GPL-2.0 & BSD-2-Clause & BSD-3-Clause"
4LIC_FILES_CHKSUM = " \
5 file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \
6 file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \
7 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \
8 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \
9"
10DEPENDS = "libbsd libpcre openssl zlib"
11
12ANDROID_TAG = "android-5.1.1_r37"
13ANDROID_MIRROR = "android.googlesource.com"
14CORE_REPO = "${ANDROID_MIRROR}/platform/system/core"
15EXTRAS_REPO = "${ANDROID_MIRROR}/platform/system/extras"
16LIBHARDWARE_REPO = "${ANDROID_MIRROR}/platform/hardware/libhardware"
17LIBSELINUX_REPO = "${ANDROID_MIRROR}/platform/external/libselinux"
18BUILD_REPO = "${ANDROID_MIRROR}/platform/build"
19
20SRC_URI = " \
21 git://${CORE_REPO};name=core;protocol=https;nobranch=1;destsuffix=git/system/core;tag=${ANDROID_TAG} \
22 git://${EXTRAS_REPO};name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras;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} \
25 git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build;tag=${ANDROID_TAG} \
26 file://remove-selinux-android.patch;apply=yes \
27 file://use-capability.patch;apply=yes \
28 file://use-local-socket.patch;apply=yes \
29 file://preserve-ownership.patch;apply=yes \
30 file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch;apply=yes \
31 file://remove-bionic-android.patch;apply=yes \
32 file://define-shell-command.patch;apply=yes \
33 file://implicit-declaration-function-strlcat-strlcopy.patch;apply=yes \
34 file://android-tools-adbd.service \
35 file://.gitignore;subdir=git \
36 file://adb.mk;subdir=${BPN} \
37 file://adbd.mk;subdir=${BPN} \
38 file://ext4_utils.mk;subdir=${BPN} \
39 file://fastboot.mk;subdir=${BPN} \
40 file://mkbootimg.mk;subdir=${BPN} \
41"
42
43S = "${WORKDIR}/git"
44B = "${WORKDIR}/${BPN}"
45
46inherit systemd
47
48SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service"
49
50# Get rid of files uneeded to build Android tools
51do_unpack_extra() {
52 cd ${S}
53 rm -rf \
54 system/core/.git \
55 system/extras/.git \
56 hardware/libhardware/.git \
57 external/libselinux/.git \
58 build/.git
59 git init
60 git add .
61 git commit -m \
62 "Initial import - committed ${ANDROID_TAG}"
63 git clean -fdx
64}
65
66addtask unpack_extra after do_unpack before do_patch
67
68do_compile() {
69 # Setting both variables below causing our makefiles to not work with
70 # implicit make rules
71 unset CFLAGS
72 unset CPPFLAGS
73
74 export SRCDIR=${S}
75
76 case "${HOST_ARCH}" in
77 arm)
78 export android_arch=linux-arm
79 ;;
80 aarch64)
81 export android_arch=linux-arm64
82 ;;
83 mips|mipsel)
84 export android_arch=linux-mips
85 ;;
86 powerpc|powerpc64)
87 export android_arch=linux-ppc
88 ;;
89 i586|x86_64)
90 export android_arch=linux-x86
91 ;;
92 esac
93
94 tools="adb fastboot ext4_utils mkbootimg adbd"
95 for tool in ${tools}; do
96 mkdir -p ${B}/${tool}
97 oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool}
98 done
99}
100
101do_install() {
102 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
103 install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg
104
105 install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir}
106 install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir}
107 install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir}
108 install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir}
109 install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir}
110 install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}
111
112 install -m0755 ${B}/adb/adb ${D}${bindir}
113 install -m0755 ${B}/adbd/adbd ${D}${bindir}
114 install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
115 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
116
117 install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
118 ${D}${systemd_unitdir}/system/android-tools-adbd.service
119}
120
121PACKAGES += "${PN}-fstools"
122
123RDEPENDS_${BPN} = "${BPN}-conf bash"
124
125FILES_${PN}-fstools = "\
126 ${bindir}/ext2simg \
127 ${bindir}/ext4fixup \
128 ${bindir}/img2simg \
129 ${bindir}/make_ext4fs \
130 ${bindir}/simg2img \
131 ${bindir}/simg2simg \
132 ${bindir}/simg_dump \
133 ${bindir}/mkuserimg \
134"
135
136BBCLASSEXTEND += "native"