diff options
author | Fathi Boudra <fathi.boudra@linaro.org> | 2016-09-07 12:58:47 +0300 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2016-09-15 10:22:46 +0200 |
commit | a231c431a522ae1821fc484bb1a1f9997ecabf20 (patch) | |
tree | 0513730154c45ce23dc35393bcf1ec609590a23b /meta-oe/recipes-devtools | |
parent | 4fad615950a92db633d2d46fddd3fc491a853e55 (diff) | |
download | meta-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')
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 | |||
9 | manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)" | ||
10 | model="$(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) | ||
13 | serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')" | ||
14 | |||
15 | echo $serial > /sys/class/android_usb/android0/iSerial | ||
16 | echo $manufacturer > /sys/class/android_usb/android0/iManufacturer | ||
17 | echo $model > /sys/class/android_usb/android0/iProduct | ||
18 | |||
19 | echo "0" > /sys/class/android_usb/android0/enable | ||
20 | echo "18d1" > /sys/class/android_usbid_usb/android0/idVendor | ||
21 | echo "D002" > /sys/class/android_usb/android0/idProduct | ||
22 | echo "adb" > /sys/class/android_usb/android0/functions | ||
23 | echo "1" > /sys/class/android_usb/android0/enable | ||
24 | |||
25 | sleep 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 @@ | |||
1 | DESCRIPTION = "Different utilities from Android - corressponding configuration files" | ||
2 | SECTION = "console/utils" | ||
3 | LICENSE = "MIT" | ||
4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
5 | |||
6 | SRC_URI = "file://android-gadget-setup" | ||
7 | |||
8 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
9 | |||
10 | do_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 | |||
3 | SRCDIR ?= $(S) | ||
4 | |||
5 | VPATH += $(SRCDIR)/system/core/adb | ||
6 | adb_SRC_FILES += adb.c | ||
7 | adb_SRC_FILES += console.c | ||
8 | adb_SRC_FILES += transport.c | ||
9 | adb_SRC_FILES += transport_local.c | ||
10 | adb_SRC_FILES += transport_usb.c | ||
11 | adb_SRC_FILES += commandline.c | ||
12 | adb_SRC_FILES += adb_client.c | ||
13 | adb_SRC_FILES += adb_auth_host.c | ||
14 | adb_SRC_FILES += sockets.c | ||
15 | adb_SRC_FILES += services.c | ||
16 | adb_SRC_FILES += file_sync_client.c | ||
17 | adb_SRC_FILES += get_my_path_linux.c | ||
18 | adb_SRC_FILES += usb_linux.c | ||
19 | adb_SRC_FILES += usb_vendors.c | ||
20 | adb_SRC_FILES += fdevent.c | ||
21 | adb_OBJS := $(adb_SRC_FILES:.c=.o) | ||
22 | |||
23 | VPATH += $(SRCDIR)/system/core/libcutils | ||
24 | libcutils_SRC_FILES += atomic.c | ||
25 | libcutils_SRC_FILES += hashmap.c | ||
26 | libcutils_SRC_FILES += native_handle.c | ||
27 | libcutils_SRC_FILES += config_utils.c | ||
28 | libcutils_SRC_FILES += cpu_info.c | ||
29 | libcutils_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 | ||
38 | libcutils_SRC_FILES += str_parms.c | ||
39 | libcutils_SRC_FILES += fs.c | ||
40 | libcutils_SRC_FILES += multiuser.c | ||
41 | libcutils_SRC_FILES += socket_inaddr_any_server.c | ||
42 | libcutils_SRC_FILES += socket_local_client.c | ||
43 | libcutils_SRC_FILES += socket_local_server.c | ||
44 | libcutils_SRC_FILES += socket_loopback_client.c | ||
45 | libcutils_SRC_FILES += socket_loopback_server.c | ||
46 | libcutils_SRC_FILES += socket_network_client.c | ||
47 | libcutils_SRC_FILES += sockets.c | ||
48 | libcutils_SRC_FILES += ashmem-host.c | ||
49 | libcutils_SRC_FILES += dlmalloc_stubs.c | ||
50 | libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o) | ||
51 | |||
52 | CFLAGS += -DANDROID | ||
53 | CFLAGS += -DWORKAROUND_BUG6558362 | ||
54 | CFLAGS += -DADB_HOST=1 | ||
55 | CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE | ||
56 | CFLAGS += -DANDROID_SMP=0 | ||
57 | CFLAGS += -I$(SRCDIR)/system/core/adb | ||
58 | CFLAGS += -I$(SRCDIR)/system/core/include | ||
59 | CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h | ||
60 | |||
61 | LIBS += libcutils.a -lpthread -lcrypto | ||
62 | |||
63 | all: adb | ||
64 | |||
65 | adb: libcutils.a $(adb_OBJS) | ||
66 | $(CC) -o $@ $(LDFLAGS) $(adb_OBJS) $(LIBS) | ||
67 | |||
68 | libcutils.a: $(libcutils_OBJS) | ||
69 | $(AR) rcs $@ $(libcutils_OBJS) | ||
70 | |||
71 | clean: | ||
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 | |||
3 | SRCDIR ?= $(S) | ||
4 | |||
5 | VPATH += $(SRCDIR)/system/core/adb | ||
6 | adbd_SRC_FILES += adb.c | ||
7 | adbd_SRC_FILES += fdevent.c | ||
8 | adbd_SRC_FILES += transport.c | ||
9 | adbd_SRC_FILES += transport_local.c | ||
10 | adbd_SRC_FILES += transport_usb.c | ||
11 | adbd_SRC_FILES += adb_auth_client.c | ||
12 | adbd_SRC_FILES += sockets.c | ||
13 | adbd_SRC_FILES += services.c | ||
14 | adbd_SRC_FILES += file_sync_service.c | ||
15 | adbd_SRC_FILES += jdwp_service.c | ||
16 | adbd_SRC_FILES += framebuffer_service.c | ||
17 | adbd_SRC_FILES += remount_service.c | ||
18 | adbd_SRC_FILES += disable_verity_service.c | ||
19 | adbd_SRC_FILES += usb_linux_client.c | ||
20 | adbd_OBJS := $(adbd_SRC_FILES:.c=.o) | ||
21 | |||
22 | VPATH += $(SRCDIR)/system/core/liblog | ||
23 | liblog_SRC_FILES += logd_write.c | ||
24 | liblog_SRC_FILES += log_event_write.c | ||
25 | liblog_SRC_FILES += logprint.c | ||
26 | liblog_SRC_FILES += event_tag_map.c | ||
27 | liblog_SRC_FILES += fake_log_device.c | ||
28 | liblog_OBJS := $(liblog_SRC_FILES:.c=.o) | ||
29 | |||
30 | VPATH += $(SRCDIR)/system/core/fs_mgr | ||
31 | fs_mgr_SRC_FILES += fs_mgr_fstab.c | ||
32 | fs_mgr_OBJS := $(fs_mgr_SRC_FILES:.c=.o) | ||
33 | |||
34 | VPATH += $(SRCDIR)/system/core/libcutils | ||
35 | libcutils_SRC_FILES += atomic.c | ||
36 | libcutils_SRC_FILES += hashmap.c | ||
37 | libcutils_SRC_FILES += native_handle.c | ||
38 | libcutils_SRC_FILES += config_utils.c | ||
39 | libcutils_SRC_FILES += cpu_info.c | ||
40 | libcutils_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 | ||
49 | libcutils_SRC_FILES += str_parms.c | ||
50 | libcutils_SRC_FILES += fs.c | ||
51 | libcutils_SRC_FILES += multiuser.c | ||
52 | libcutils_SRC_FILES += socket_inaddr_any_server.c | ||
53 | libcutils_SRC_FILES += socket_local_client.c | ||
54 | libcutils_SRC_FILES += socket_local_server.c | ||
55 | libcutils_SRC_FILES += socket_loopback_client.c | ||
56 | libcutils_SRC_FILES += socket_loopback_server.c | ||
57 | libcutils_SRC_FILES += socket_network_client.c | ||
58 | libcutils_SRC_FILES += sockets.c | ||
59 | libcutils_SRC_FILES += ashmem-host.c | ||
60 | libcutils_SRC_FILES += dlmalloc_stubs.c | ||
61 | libcutils_SRC_FILES += klog.c | ||
62 | libcutils_SRC_FILES += properties.c | ||
63 | libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o) | ||
64 | |||
65 | VPATH += $(SRCDIR)/external/libselinux/src | ||
66 | libselinux_SRC_FILES += booleans.c | ||
67 | libselinux_SRC_FILES += canonicalize_context.c | ||
68 | libselinux_SRC_FILES += disable.c | ||
69 | libselinux_SRC_FILES += enabled.c | ||
70 | libselinux_SRC_FILES += fgetfilecon.c | ||
71 | libselinux_SRC_FILES += fsetfilecon.c | ||
72 | libselinux_SRC_FILES += getenforce.c | ||
73 | libselinux_SRC_FILES += getfilecon.c | ||
74 | libselinux_SRC_FILES += getpeercon.c | ||
75 | libselinux_SRC_FILES += lgetfilecon.c | ||
76 | libselinux_SRC_FILES += load_policy.c | ||
77 | libselinux_SRC_FILES += lsetfilecon.c | ||
78 | libselinux_SRC_FILES += policyvers.c | ||
79 | libselinux_SRC_FILES += procattr.c | ||
80 | libselinux_SRC_FILES += setenforce.c | ||
81 | libselinux_SRC_FILES += setfilecon.c | ||
82 | libselinux_SRC_FILES += context.c | ||
83 | libselinux_SRC_FILES += mapping.c | ||
84 | libselinux_SRC_FILES += stringrep.c | ||
85 | libselinux_SRC_FILES += compute_create.c | ||
86 | libselinux_SRC_FILES += compute_av.c | ||
87 | libselinux_SRC_FILES += avc.c | ||
88 | libselinux_SRC_FILES += avc_internal.c | ||
89 | libselinux_SRC_FILES += avc_sidtab.c | ||
90 | libselinux_SRC_FILES += get_initial_context.c | ||
91 | libselinux_SRC_FILES += checkAccess.c | ||
92 | libselinux_SRC_FILES += sestatus.c | ||
93 | libselinux_SRC_FILES += deny_unknown.c | ||
94 | |||
95 | libselinux_SRC_FILES += callbacks.c | ||
96 | libselinux_SRC_FILES += check_context.c | ||
97 | libselinux_SRC_FILES += freecon.c | ||
98 | libselinux_SRC_FILES += init.c | ||
99 | libselinux_SRC_FILES += label.c | ||
100 | libselinux_SRC_FILES += label_file.c | ||
101 | libselinux_SRC_FILES += label_android_property.c | ||
102 | libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o) | ||
103 | |||
104 | VPATH += $(SRCDIR)/system/extras/ext4_utils | ||
105 | libext4_utils_SRC_FILES += make_ext4fs.c | ||
106 | libext4_utils_SRC_FILES += ext4fixup.c | ||
107 | libext4_utils_SRC_FILES += ext4_utils.c | ||
108 | libext4_utils_SRC_FILES += allocate.c | ||
109 | libext4_utils_SRC_FILES += contents.c | ||
110 | libext4_utils_SRC_FILES += extent.c | ||
111 | libext4_utils_SRC_FILES += indirect.c | ||
112 | libext4_utils_SRC_FILES += uuid.c | ||
113 | libext4_utils_SRC_FILES += sha1.c | ||
114 | libext4_utils_SRC_FILES += wipe.c | ||
115 | libext4_utils_SRC_FILES += crc16.c | ||
116 | libext4_utils_SRC_FILES += ext4_sb.c | ||
117 | libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o) | ||
118 | |||
119 | CFLAGS += -std=gnu11 | ||
120 | CFLAGS += -DANDROID | ||
121 | CFLAGS += -DADB_HOST=0 | ||
122 | CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE | ||
123 | CFLAGS += -DALLOW_ADBD_ROOT=1 | ||
124 | CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1 | ||
125 | CFLAGS += -DPROP_NAME_MAX=32 | ||
126 | CFLAGS += -DPROP_VALUE_MAX=92 | ||
127 | CFLAGS += -DAUDITD_LOG_TAG=1003 | ||
128 | # CFLAGS += -DHOST | ||
129 | CFLAGS += -DANDROID_SMP=0 | ||
130 | CFLAGS += -I$(SRCDIR)/system/core/adb | ||
131 | CFLAGS += -I$(SRCDIR)/system/core/include | ||
132 | CFLAGS += -I$(SRCDIR)/system/core/libsparse/include | ||
133 | CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils | ||
134 | CFLAGS += -I$(SRCDIR)/system/core/fs_mgr/include | ||
135 | CFLAGS += -I$(SRCDIR)/hardware/libhardware/include | ||
136 | CFLAGS += -I$(SRCDIR)/external/libselinux/include | ||
137 | CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h | ||
138 | |||
139 | LIBS += liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a -lpthread -lbsd -lpcre -lresolv -lcrypto | ||
140 | |||
141 | all: adbd | ||
142 | |||
143 | adbd: liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a $(adbd_OBJS) | ||
144 | $(CC) -o $@ $(LDFLAGS) $(adbd_OBJS) $(LIBS) | ||
145 | |||
146 | liblog.a: $(liblog_OBJS) | ||
147 | $(AR) rcs $@ $(liblog_OBJS) | ||
148 | |||
149 | libfs_mgr.a: $(fs_mgr_OBJS) | ||
150 | $(AR) rcs $@ $(fs_mgr_OBJS) | ||
151 | |||
152 | libcutils.a: $(libcutils_OBJS) | ||
153 | $(AR) rcs $@ $(libcutils_OBJS) | ||
154 | |||
155 | libselinux.a: $(libselinux_OBJS) | ||
156 | export CFLAGS="-DANDROID -DHOST" | ||
157 | $(AR) rcs $@ $(libselinux_OBJS) | ||
158 | |||
159 | libext4_utils.a: $(libext4_utils_OBJS) | ||
160 | $(AR) rcs $@ $(libext4_utils_OBJS) | ||
161 | |||
162 | clean: | ||
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] | ||
2 | Description=Android Debug Bridge | ||
3 | |||
4 | [Service] | ||
5 | Type=simple | ||
6 | Restart=on-failure | ||
7 | ExecStartPre=/usr/bin/android-gadget-setup adb | ||
8 | ExecStart=/usr/bin/adbd | ||
9 | StandardOutput=null | ||
10 | |||
11 | [Install] | ||
12 | WantedBy=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 @@ | |||
1 | Description: we intend to run on Linux system so the shell is always /bin/sh, | ||
2 | for the host or the target. | ||
3 | Author: Fathi Boudra <fabo@debian.org> | ||
4 | |||
5 | Upstream-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 | |||
3 | SRCDIR ?= $(S) | ||
4 | |||
5 | VPATH += $(SRCDIR)/system/extras/ext4_utils | ||
6 | make_ext4fs_SRC_FILES += make_ext4fs_main.c | ||
7 | make_ext4fs_SRC_FILES += canned_fs_config.c | ||
8 | make_ext4fs_OBJS := $(make_ext4fs_SRC_FILES:.c=.o) | ||
9 | |||
10 | ext2simg_SRC_FILES += ext2simg.c | ||
11 | ext2simg_OBJS := $(ext2simg_SRC_FILES:.c=.o) | ||
12 | |||
13 | ext4fixup_SRC_FILES += ext4fixup_main.c | ||
14 | ext4fixup_OBJS := $(ext4fixup_SRC_FILES:.c=.o) | ||
15 | |||
16 | libext4_utils_SRC_FILES += make_ext4fs.c | ||
17 | libext4_utils_SRC_FILES += ext4fixup.c | ||
18 | libext4_utils_SRC_FILES += ext4_utils.c | ||
19 | libext4_utils_SRC_FILES += allocate.c | ||
20 | libext4_utils_SRC_FILES += contents.c | ||
21 | libext4_utils_SRC_FILES += extent.c | ||
22 | libext4_utils_SRC_FILES += indirect.c | ||
23 | libext4_utils_SRC_FILES += uuid.c | ||
24 | libext4_utils_SRC_FILES += sha1.c | ||
25 | libext4_utils_SRC_FILES += wipe.c | ||
26 | libext4_utils_SRC_FILES += crc16.c | ||
27 | libext4_utils_SRC_FILES += ext4_sb.c | ||
28 | libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o) | ||
29 | |||
30 | VPATH += $(SRCDIR)/system/core/libsparse | ||
31 | simg2img_SRC_FILES += simg2img.c | ||
32 | simg2img_SRC_FILES += sparse_crc32.c | ||
33 | simg2img_OBJS := $(simg2img_SRC_FILES:.c=.o) | ||
34 | |||
35 | img2simg_SRC_FILES += img2simg.c | ||
36 | img2simg_OBJS := $(img2simg_SRC_FILES:.c=.o) | ||
37 | |||
38 | simg2simg_SRC_FILES += simg2simg.c | ||
39 | simg2simg_SRC_FILES += sparse_crc32.c | ||
40 | simg2simg_OBJS := $(simg2simg_SRC_FILES:.c=.o) | ||
41 | |||
42 | libsparse_SRC_FILES += backed_block.c | ||
43 | libsparse_SRC_FILES += output_file.c | ||
44 | libsparse_SRC_FILES += sparse.c | ||
45 | libsparse_SRC_FILES += sparse_crc32.c | ||
46 | libsparse_SRC_FILES += sparse_err.c | ||
47 | libsparse_SRC_FILES += sparse_read.c | ||
48 | libsparse_OBJS := $(libsparse_SRC_FILES:.c=.o) | ||
49 | |||
50 | VPATH += $(SRCDIR)/external/libselinux/src | ||
51 | libselinux_SRC_FILES += callbacks.c | ||
52 | libselinux_SRC_FILES += check_context.c | ||
53 | libselinux_SRC_FILES += freecon.c | ||
54 | libselinux_SRC_FILES += init.c | ||
55 | libselinux_SRC_FILES += label.c | ||
56 | libselinux_SRC_FILES += label_file.c | ||
57 | libselinux_SRC_FILES += label_android_property.c | ||
58 | libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o) | ||
59 | |||
60 | CFLAGS += -DANDROID | ||
61 | CFLAGS += -DHOST | ||
62 | CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils | ||
63 | CFLAGS += -I$(SRCDIR)/system/core/include | ||
64 | CFLAGS += -I$(SRCDIR)/system/core/libsparse/include | ||
65 | CFLAGS += -I$(SRCDIR)/external/libselinux/include | ||
66 | CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h | ||
67 | |||
68 | all: make_ext4fs ext2simg ext4fixup simg2img img2simg simg2simg | ||
69 | |||
70 | make_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 | |||
74 | ext2simg: 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 | |||
78 | ext4fixup: libext4_utils.a libsparse.a $(ext4fixup_OBJS) | ||
79 | $(CC) -o $@ $(LDFLAGS) $(ext4fixup_OBJS) libext4_utils.a libsparse.a -lz | ||
80 | |||
81 | simg2img: libsparse.a $(simg2img_OBJS) | ||
82 | $(CC) -o $@ $(LDFLAGS) $(simg2img_OBJS) libsparse.a -lz | ||
83 | |||
84 | img2simg: libsparse.a $(img2simg_OBJS) | ||
85 | $(CC) -o $@ $(LDFLAGS) $(img2simg_OBJS) libsparse.a -lz | ||
86 | |||
87 | simg2simg: libsparse.a $(simg2simg_OBJS) | ||
88 | $(CC) -o $@ $(LDFLAGS) $(simg2simg_OBJS) libsparse.a -lz | ||
89 | |||
90 | libext4_utils.a: $(libext4_utils_OBJS) | ||
91 | $(AR) rcs $@ $(libext4_utils_OBJS) | ||
92 | |||
93 | libsparse.a: $(libsparse_OBJS) | ||
94 | $(AR) rcs $@ $(libsparse_OBJS) | ||
95 | |||
96 | libselinux.a: $(libselinux_OBJS) | ||
97 | $(AR) rcs $@ $(libselinux_OBJS) | ||
98 | |||
99 | clean: | ||
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 | |||
3 | SRCDIR ?= $(S) | ||
4 | |||
5 | VPATH += $(SRCDIR)/system/core/fastboot | ||
6 | fastboot_SRC_FILES += protocol.c | ||
7 | fastboot_SRC_FILES += engine.c | ||
8 | fastboot_SRC_FILES += bootimg.c | ||
9 | fastboot_SRC_FILES += fastboot.c | ||
10 | fastboot_SRC_FILES += util.c | ||
11 | fastboot_SRC_FILES += fs.c | ||
12 | fastboot_SRC_FILES += usb_linux.c | ||
13 | fastboot_SRC_FILES += util_linux.c | ||
14 | fastboot_OBJS := $(fastboot_SRC_FILES:.c=.o) | ||
15 | |||
16 | VPATH += $(SRCDIR)/system/core/libzipfile | ||
17 | libzipfile_SRC_FILES += centraldir.c | ||
18 | libzipfile_SRC_FILES += zipfile.c | ||
19 | libzipfile_OBJS := $(libzipfile_SRC_FILES:.c=.o) | ||
20 | |||
21 | VPATH += $(SRCDIR)/system/extras/ext4_utils | ||
22 | libext4_utils_SRC_FILES += make_ext4fs.c | ||
23 | libext4_utils_SRC_FILES += ext4fixup.c | ||
24 | libext4_utils_SRC_FILES += ext4_utils.c | ||
25 | libext4_utils_SRC_FILES += allocate.c | ||
26 | libext4_utils_SRC_FILES += contents.c | ||
27 | libext4_utils_SRC_FILES += extent.c | ||
28 | libext4_utils_SRC_FILES += indirect.c | ||
29 | libext4_utils_SRC_FILES += uuid.c | ||
30 | libext4_utils_SRC_FILES += sha1.c | ||
31 | libext4_utils_SRC_FILES += wipe.c | ||
32 | libext4_utils_SRC_FILES += crc16.c | ||
33 | libext4_utils_SRC_FILES += ext4_sb.c | ||
34 | libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o) | ||
35 | |||
36 | VPATH += $(SRCDIR)/system/core/libsparse | ||
37 | libsparse_SRC_FILES += backed_block.c | ||
38 | libsparse_SRC_FILES += output_file.c | ||
39 | libsparse_SRC_FILES += sparse.c | ||
40 | libsparse_SRC_FILES += sparse_crc32.c | ||
41 | libsparse_SRC_FILES += sparse_err.c | ||
42 | libsparse_SRC_FILES += sparse_read.c | ||
43 | libsparse_OBJS := $(libsparse_SRC_FILES:.c=.o) | ||
44 | |||
45 | VPATH += $(SRCDIR)/external/libselinux/src | ||
46 | libselinux_SRC_FILES += callbacks.c | ||
47 | libselinux_SRC_FILES += check_context.c | ||
48 | libselinux_SRC_FILES += freecon.c | ||
49 | libselinux_SRC_FILES += init.c | ||
50 | libselinux_SRC_FILES += label.c | ||
51 | libselinux_SRC_FILES += label_file.c | ||
52 | libselinux_SRC_FILES += label_android_property.c | ||
53 | libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o) | ||
54 | |||
55 | CFLAGS += -std=gnu11 | ||
56 | CFLAGS += -DANDROID | ||
57 | # CFLAGS += -DUSE_F2FS | ||
58 | CFLAGS += -DHOST | ||
59 | CFLAGS += -I$(SRCDIR)/system/core/fastboot | ||
60 | CFLAGS += -I$(SRCDIR)/system/core/include | ||
61 | CFLAGS += -I$(SRCDIR)/system/core/mkbootimg | ||
62 | CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils | ||
63 | CFLAGS += -I$(SRCDIR)/system/extras/f2fs_utils | ||
64 | CFLAGS += -I$(SRCDIR)/system/core/libsparse/include | ||
65 | CFLAGS += -I$(SRCDIR)/external/libselinux/include | ||
66 | CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h | ||
67 | |||
68 | LIBS += libzipfile.a libext4_utils.a libsparse.a libselinux.a -lz -lpcre | ||
69 | |||
70 | all: fastboot | ||
71 | |||
72 | fastboot: libzipfile.a libext4_utils.a libsparse.a libselinux.a $(fastboot_OBJS) | ||
73 | $(CC) -o $@ $(LDFLAGS) $(fastboot_OBJS) $(LIBS) | ||
74 | |||
75 | libzipfile.a: $(libzipfile_OBJS) | ||
76 | $(AR) rcs $@ $(libzipfile_OBJS) | ||
77 | |||
78 | libext4_utils.a: $(libext4_utils_OBJS) | ||
79 | $(AR) rcs $@ $(libext4_utils_OBJS) | ||
80 | |||
81 | libsparse.a: $(libsparse_OBJS) | ||
82 | $(AR) rcs $@ $(libsparse_OBJS) | ||
83 | |||
84 | libselinux.a: $(libselinux_OBJS) | ||
85 | $(AR) rcs $@ $(libselinux_OBJS) | ||
86 | |||
87 | clean: | ||
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 @@ | |||
1 | Description: fix implicit declaration of stlcat/strlcopy functions. | ||
2 | Author: Fathi Boudra <fabo@debian.org> | ||
3 | |||
4 | Upstream-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 @@ | |||
1 | From cc5e7b02a3be57709a1aed6e34be100b82a71620 Mon Sep 17 00:00:00 2001 | ||
2 | From: David Ng <dave@codeaurora.org> | ||
3 | Date: Fri, 27 Jul 2012 17:15:03 -0700 | ||
4 | Subject: [PATCH 1/2] mkbootimg: Add --dt parameter to specify DT image | ||
5 | |||
6 | New optional --dt parameter to specify a kernel device | ||
7 | tree image. | ||
8 | |||
9 | Change-Id: Ie29a11cbf4138426bfd19ae486d69a5fcbd8f442 | ||
10 | |||
11 | Upstream-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 | |||
3 | SRCDIR ?= $(S) | ||
4 | |||
5 | VPATH += $(SRCDIR)/system/core/mkbootimg | ||
6 | mkbootimg_SRC_FILES += mkbootimg.c | ||
7 | mkbootimg_OBJS := $(mkbootimg_SRC_FILES:.c=.o) | ||
8 | |||
9 | VPATH += $(SRCDIR)/system/core/libmincrypt | ||
10 | libmincrypt_SRC_FILES := dsa_sig.c p256.c p256_ec.c p256_ecdsa.c rsa.c sha.c sha256.c | ||
11 | libmincrypt_OBJS := $(libmincrypt_SRC_FILES:.c=.o) | ||
12 | |||
13 | CFLAGS += -DANDROID | ||
14 | CFLAGS += -I$(SRCDIR)/system/core/mkbootimg | ||
15 | CFLAGS += -I$(SRCDIR)/system/core/include | ||
16 | CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h | ||
17 | |||
18 | LIBS += libmincrypt.a | ||
19 | |||
20 | all: mkbootimg | ||
21 | |||
22 | mkbootimg: libmincrypt.a $(mkbootimg_OBJS) | ||
23 | $(CC) -o $@ $(LDFLAGS) $(mkbootimg_OBJS) $(LIBS) | ||
24 | |||
25 | libmincrypt.a: $(libmincrypt_OBJS) | ||
26 | $(AR) rcs $@ $(libmincrypt_OBJS) | ||
27 | |||
28 | clean: | ||
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 @@ | |||
1 | Description: add -o argument to preserve ownership | ||
2 | Author: Markus Mayer <mmayer@mmayer.net> | ||
3 | |||
4 | See also https://android-review.googlesource.com/#/c/100312/ | ||
5 | |||
6 | Upstream-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 @@ | |||
1 | Description: remove bionic specific calls | ||
2 | Author: Fathi Boudra <fabo@debian.org> | ||
3 | |||
4 | Upstream-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 @@ | |||
1 | Subject: drop useless includes of Android SELINUX extensions; avoids having to clone another module; this should be sent upstream | ||
2 | Author: Sergio Schvezov <sergio.schvezov@canonical.com> | ||
3 | |||
4 | Upstream-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 @@ | |||
1 | Subject: use linux/capability.h on linux systems too | ||
2 | Author: Loïc Minier <loic.minier@ubuntu.com> | ||
3 | |||
4 | Upstream-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 @@ | |||
1 | Subject: adb: Use local sockets where appropriate | ||
2 | Author: Hilko Bengen <bengen@debian.org> | ||
3 | |||
4 | Upstream-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 @@ | |||
1 | DESCRIPTION = "Different utilities from Android" | ||
2 | SECTION = "console/utils" | ||
3 | LICENSE = "Apache-2.0 & GPL-2.0 & BSD-2-Clause & BSD-3-Clause" | ||
4 | LIC_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 | " | ||
10 | DEPENDS = "libbsd libpcre openssl zlib" | ||
11 | |||
12 | ANDROID_TAG = "android-5.1.1_r37" | ||
13 | ANDROID_MIRROR = "android.googlesource.com" | ||
14 | CORE_REPO = "${ANDROID_MIRROR}/platform/system/core" | ||
15 | EXTRAS_REPO = "${ANDROID_MIRROR}/platform/system/extras" | ||
16 | LIBHARDWARE_REPO = "${ANDROID_MIRROR}/platform/hardware/libhardware" | ||
17 | LIBSELINUX_REPO = "${ANDROID_MIRROR}/platform/external/libselinux" | ||
18 | BUILD_REPO = "${ANDROID_MIRROR}/platform/build" | ||
19 | |||
20 | SRC_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 | |||
43 | S = "${WORKDIR}/git" | ||
44 | B = "${WORKDIR}/${BPN}" | ||
45 | |||
46 | inherit systemd | ||
47 | |||
48 | SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service" | ||
49 | |||
50 | # Get rid of files uneeded to build Android tools | ||
51 | do_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 | |||
66 | addtask unpack_extra after do_unpack before do_patch | ||
67 | |||
68 | do_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 | |||
101 | do_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 | |||
121 | PACKAGES += "${PN}-fstools" | ||
122 | |||
123 | RDEPENDS_${BPN} = "${BPN}-conf bash" | ||
124 | |||
125 | FILES_${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 | |||
136 | BBCLASSEXTEND += "native" | ||