summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshishKumar Mishra <ashishkumar.mishra@bmwtechworks.in>2026-05-05 20:36:31 +0530
committerKhem Raj <khem.raj@oss.qualcomm.com>2026-05-12 01:07:01 -0700
commit5aaebcd7a880e7ba0b4a93e04730fc4eb8f8c4f6 (patch)
tree007fe882e6ebb85b64bb255ae70ee5966703cbe8
parentb9d0dc6d8634bccca8e13bcb985b4033f95adb6d (diff)
downloadmeta-openembedded-5aaebcd7a880e7ba0b4a93e04730fc4eb8f8c4f6.tar.gz
android-tools: remove android-tools 5.x from meta-oe/recipes-devtools
We plan to upgrade android-tools from the legacy 5.1.1 version to 29.0.6.r14 To achive this we are removing the older version from meta-oe/recipes-devtools/ Signed-off-by: AshishKumar Mishra <ashishkumar.mishra@bmwtechworks.in> Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf4
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-cleanup24
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup38
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start9
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs_1.0.bb38
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup37
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb22
-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.mk164
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service13
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch361
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0001-adb-remove-selinux-extensions.patch44
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0001-memory.h-Always-define-strlcpy-for-glibc-based-syste.patch35
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0002-adb-Use-local-sockets-where-appropriate.patch70
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0003-adb-define-shell-command.patch29
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0004-adb-Fix-build-on-big-endian-systems.patch47
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0005-adb-add-base64-implementation.patch350
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch130
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0007-adb-usb_linux.c-fix-build-with-glibc-2.28.patch26
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0008-adb-Allow-adbd-to-be-ran-as-root.patch23
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0009-mkbootimg-Add-dt-parameter-to-specify-DT-image.patch110
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0010-Use-linux-capability.h-on-linux-systems-too.patch23
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0011-Remove-bionic-specific-calls.patch64
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch50
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch191
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0014-add-u3-ss-descriptor-support-for-adb.patch344
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0015-libsparse-Split-off-most-of-sparse_file_read_normal-.patch60
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0016-libsparse-Add-hole-mode-to-sparse_file_read.patch188
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/0017-img2simg-Add-support-for-converting-holes-to-don-t-c.patch114
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff48
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/core/b64_pton_function_decl.patch14
-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/extras/0001-ext4_utils-remove-selinux-extensions.patch39
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch78
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/extras/0003-ext4_utils-drop-unused-parameter-from-allocate_inode.patch69
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk89
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/gitignore59
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-Remove-bionic-specific-calls.patch25
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch51
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk29
-rw-r--r--meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb189
41 files changed, 0 insertions, 3473 deletions
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf
deleted file mode 100644
index ddf155a907..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf
+++ /dev/null
@@ -1,4 +0,0 @@
1[Service]
2ExecStartPre=/usr/bin/android-gadget-setup
3ExecStartPost=/usr/bin/android-gadget-start
4ExecStopPost=/usr/bin/android-gadget-cleanup
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-cleanup b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-cleanup
deleted file mode 100644
index f27d77df51..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-cleanup
+++ /dev/null
@@ -1,24 +0,0 @@
1#!/bin/sh
2
3[ -d /sys/kernel/config/usb_gadget ] || exit 0
4
5cd /sys/kernel/config/usb_gadget
6
7cd adb
8
9echo -n "" > UDC || true
10
11killall adbd || true
12
13umount /dev/usb-ffs/adb
14
15rm configs/c.1/ffs.usb0
16
17rmdir configs/c.1/strings/0x409
18rmdir configs/c.1
19
20rmdir functions/ffs.usb0
21rmdir strings/0x409
22
23cd ..
24rmdir adb
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
deleted file mode 100644
index 47e4edb9be..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
+++ /dev/null
@@ -1,38 +0,0 @@
1#!/bin/sh
2
3set -e
4
5conf="Conf 1"
6manufacturer=RPB
7model="Android device"
8product=0xd002
9serial=0123456789ABCDEF
10vendor=0x18d1
11
12if [ -r /etc/android-gadget-setup.machine ] ; then
13 . /etc/android-gadget-setup.machine
14fi
15
16[ -d /sys/kernel/config/usb_gadget ] || modprobe libcomposite
17
18cd /sys/kernel/config/usb_gadget
19
20[ -d adb ] && /usr/bin/android-gadget-cleanup || true
21
22mkdir adb
23cd adb
24
25mkdir configs/c.1
26mkdir functions/ffs.usb0
27mkdir strings/0x409
28mkdir configs/c.1/strings/0x409
29echo -n "$vendor" > idVendor
30echo -n "$product" > idProduct
31echo "$serial" > strings/0x409/serialnumber
32echo "$manufacturer" > strings/0x409/manufacturer
33echo "$model" > strings/0x409/product
34echo "$conf" > configs/c.1/strings/0x409/configuration
35ln -s functions/ffs.usb0 configs/c.1
36
37mkdir -p /dev/usb-ffs/adb
38mount -t functionfs usb0 /dev/usb-ffs/adb
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start
deleted file mode 100644
index 76b5e29624..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-start
+++ /dev/null
@@ -1,9 +0,0 @@
1#!/bin/sh
2
3set -e
4
5sleep 10
6
7ls /sys/class/udc/ | head -n 1 | xargs echo -n > /sys/kernel/config/usb_gadget/adb/UDC
8
9echo "Setting UDC $(ls /sys/class/udc/ | head -n 1) for USB ADB Gadget usage"
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs_1.0.bb b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs_1.0.bb
deleted file mode 100644
index 342e7fd1a5..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs_1.0.bb
+++ /dev/null
@@ -1,38 +0,0 @@
1DESCRIPTION = "Different utilities from Android - corressponding configuration files for using ConfigFS"
2SECTION = "console/utils"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
5
6S = "${UNPACKDIR}"
7
8SRC_URI = " \
9 file://android-gadget-setup \
10 file://android-gadget-start \
11 file://android-gadget-cleanup \
12 file://10-adbd-configfs.conf \
13"
14
15PACKAGE_ARCH = "${MACHINE_ARCH}"
16
17do_install() {
18 install -d ${D}${bindir}
19 install -m 0755 ${UNPACKDIR}/android-gadget-setup ${D}${bindir}
20 install -m 0755 ${UNPACKDIR}/android-gadget-start ${D}${bindir}
21 install -m 0755 ${UNPACKDIR}/android-gadget-cleanup ${D}${bindir}
22
23 if [ -r ${UNPACKDIR}/android-gadget-setup.machine ] ; then
24 install -d ${D}${sysconfdir}
25 install -m 0644 ${UNPACKDIR}/android-gadget-setup.machine ${D}${sysconfdir}
26 fi
27
28 install -d ${D}${systemd_unitdir}/system/android-tools-adbd.service.d
29 install -m 0644 ${UNPACKDIR}/10-adbd-configfs.conf ${D}${systemd_unitdir}/system/android-tools-adbd.service.d
30}
31
32FILES:${PN} += " \
33 ${systemd_unitdir}/system/ \
34"
35
36PROVIDES += "android-tools-conf"
37RPROVIDES:${PN} = "android-tools-conf"
38BBCLASSEXTEND = "native"
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
deleted file mode 100644
index 26cf30eddd..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf/android-gadget-setup
+++ /dev/null
@@ -1,37 +0,0 @@
1#!/bin/sh
2
3[ ! -e /dev/pts ] && mkdir -p /dev/pts
4[ ! -e /dev/pts/0 ] && mount devpts /dev/pts -t devpts
5
6# TODO enable the lines below once we have support for getprop
7# retrieve the product info from Android
8# manufacturer=$(getprop ro.product.manufacturer Android)
9# model=$(getprop ro.product.model Android)
10# serial=$(getprop ro.serialno 0123456789ABCDEF)
11
12#below are now needed in order to use FunctionFS for ADB, tested to work with 3.4+ kernels
13if grep -q functionfs /proc/filesystems; then
14 mkdir -p /dev/usb-ffs/adb
15 mount -t functionfs adb /dev/usb-ffs/adb
16 #android-gadget-setup doesn't provide below 2 and without them it won't work, so we provide them here.
17 echo adb > /sys/class/android_usb/android0/f_ffs/aliases
18 echo ffs > /sys/class/android_usb/android0/functions
19fi
20
21manufacturer="$(cat /system/build.prop | grep -o 'ro.product.manufacturer=.*' | cut -d'=' -f 2)"
22model="$(cat /system/build.prop | grep -o 'ro.product.model=.*' | cut -d'=' -f 2)"
23# get the device serial number from /proc/cmdline directly(since we have no getprop on
24# GNU/Linux)
25serial="$(cat /proc/cmdline | sed 's/.*androidboot.serialno=//' | sed 's/ .*//')"
26
27echo $serial > /sys/class/android_usb/android0/iSerial
28echo $manufacturer > /sys/class/android_usb/android0/iManufacturer
29echo $model > /sys/class/android_usb/android0/iProduct
30
31echo "0" > /sys/class/android_usb/android0/enable
32echo "18d1" > /sys/class/android_usb/android0/idVendor
33echo "D002" > /sys/class/android_usb/android0/idProduct
34echo "adb" > /sys/class/android_usb/android0/functions
35echo "1" > /sys/class/android_usb/android0/enable
36
37sleep 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
deleted file mode 100644
index 764d6b404f..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf_1.0.bb
+++ /dev/null
@@ -1,22 +0,0 @@
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
8S = "${UNPACKDIR}"
9
10PACKAGE_ARCH = "${MACHINE_ARCH}"
11
12do_install() {
13 install -d ${D}${bindir}
14 install -m 0755 ${UNPACKDIR}/android-gadget-setup ${D}${bindir}
15}
16
17python () {
18 pn = d.getVar('PN')
19 profprov = d.getVar("PREFERRED_PROVIDER_" + pn)
20 if profprov and pn != profprov:
21 raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (pn, profprov, pn))
22}
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk b/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk
deleted file mode 100644
index 0687c22c17..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/adb.mk
+++ /dev/null
@@ -1,72 +0,0 @@
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
deleted file mode 100644
index 31452ae104..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/adbd.mk
+++ /dev/null
@@ -1,164 +0,0 @@
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 += base64.c
20adbd_SRC_FILES += usb_linux_client.c
21adbd_OBJS := $(adbd_SRC_FILES:.c=.o)
22
23VPATH += $(SRCDIR)/system/core/liblog
24liblog_SRC_FILES += logd_write.c
25liblog_SRC_FILES += log_event_write.c
26liblog_SRC_FILES += logprint.c
27liblog_SRC_FILES += event_tag_map.c
28liblog_SRC_FILES += fake_log_device.c
29liblog_OBJS := $(liblog_SRC_FILES:.c=.o)
30
31VPATH += $(SRCDIR)/system/core/fs_mgr
32fs_mgr_SRC_FILES += fs_mgr_fstab.c
33fs_mgr_OBJS := $(fs_mgr_SRC_FILES:.c=.o)
34
35VPATH += $(SRCDIR)/system/core/libcutils
36libcutils_SRC_FILES += atomic.c
37libcutils_SRC_FILES += hashmap.c
38libcutils_SRC_FILES += native_handle.c
39libcutils_SRC_FILES += config_utils.c
40libcutils_SRC_FILES += cpu_info.c
41libcutils_SRC_FILES += load_file.c
42# libcutils_SRC_FILES += open_memstream.c
43# libcutils_SRC_FILES += strdup16to8.c
44# libcutils_SRC_FILES += strdup8to16.c
45# libcutils_SRC_FILES += record_stream.c
46# libcutils_SRC_FILES += process_name.c
47# libcutils_SRC_FILES += threads.c
48# libcutils_SRC_FILES += sched_policy.c
49# libcutils_SRC_FILES += iosched_policy.c
50libcutils_SRC_FILES += str_parms.c
51libcutils_SRC_FILES += fs.c
52libcutils_SRC_FILES += multiuser.c
53libcutils_SRC_FILES += socket_inaddr_any_server.c
54libcutils_SRC_FILES += socket_local_client.c
55libcutils_SRC_FILES += socket_local_server.c
56libcutils_SRC_FILES += socket_loopback_client.c
57libcutils_SRC_FILES += socket_loopback_server.c
58libcutils_SRC_FILES += socket_network_client.c
59libcutils_SRC_FILES += sockets.c
60libcutils_SRC_FILES += ashmem-host.c
61libcutils_SRC_FILES += dlmalloc_stubs.c
62libcutils_SRC_FILES += klog.c
63libcutils_SRC_FILES += properties.c
64libcutils_OBJS := $(libcutils_SRC_FILES:.c=.o)
65
66VPATH += $(SRCDIR)/external/libselinux/src
67libselinux_SRC_FILES += booleans.c
68libselinux_SRC_FILES += canonicalize_context.c
69libselinux_SRC_FILES += disable.c
70libselinux_SRC_FILES += enabled.c
71libselinux_SRC_FILES += fgetfilecon.c
72libselinux_SRC_FILES += fsetfilecon.c
73libselinux_SRC_FILES += getenforce.c
74libselinux_SRC_FILES += getfilecon.c
75libselinux_SRC_FILES += getpeercon.c
76libselinux_SRC_FILES += lgetfilecon.c
77libselinux_SRC_FILES += load_policy.c
78libselinux_SRC_FILES += lsetfilecon.c
79libselinux_SRC_FILES += policyvers.c
80libselinux_SRC_FILES += procattr.c
81libselinux_SRC_FILES += setenforce.c
82libselinux_SRC_FILES += setfilecon.c
83libselinux_SRC_FILES += context.c
84libselinux_SRC_FILES += mapping.c
85libselinux_SRC_FILES += stringrep.c
86libselinux_SRC_FILES += compute_create.c
87libselinux_SRC_FILES += compute_av.c
88libselinux_SRC_FILES += avc.c
89libselinux_SRC_FILES += avc_internal.c
90libselinux_SRC_FILES += avc_sidtab.c
91libselinux_SRC_FILES += get_initial_context.c
92libselinux_SRC_FILES += checkAccess.c
93libselinux_SRC_FILES += sestatus.c
94libselinux_SRC_FILES += deny_unknown.c
95
96libselinux_SRC_FILES += callbacks.c
97libselinux_SRC_FILES += check_context.c
98libselinux_SRC_FILES += freecon.c
99libselinux_SRC_FILES += init.c
100libselinux_SRC_FILES += label.c
101libselinux_SRC_FILES += label_file.c
102libselinux_SRC_FILES += label_android_property.c
103libselinux_OBJS := $(libselinux_SRC_FILES:.c=.o)
104
105VPATH += $(SRCDIR)/system/extras/ext4_utils
106libext4_utils_SRC_FILES += make_ext4fs.c
107libext4_utils_SRC_FILES += ext4fixup.c
108libext4_utils_SRC_FILES += ext4_utils.c
109libext4_utils_SRC_FILES += allocate.c
110libext4_utils_SRC_FILES += contents.c
111libext4_utils_SRC_FILES += extent.c
112libext4_utils_SRC_FILES += indirect.c
113libext4_utils_SRC_FILES += uuid.c
114libext4_utils_SRC_FILES += sha1.c
115libext4_utils_SRC_FILES += wipe.c
116libext4_utils_SRC_FILES += crc16.c
117libext4_utils_SRC_FILES += ext4_sb.c
118libext4_utils_OBJS := $(libext4_utils_SRC_FILES:.c=.o)
119
120CFLAGS += -std=gnu11
121CFLAGS += -DANDROID
122CFLAGS += -DADB_HOST=0
123CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
124CFLAGS += -DALLOW_ADBD_ROOT=1
125CFLAGS += -DALLOW_ADBD_DISABLE_VERITY=1
126CFLAGS += -DPROP_NAME_MAX=32
127CFLAGS += -DPROP_VALUE_MAX=92
128CFLAGS += -DAUDITD_LOG_TAG=1003
129# CFLAGS += -DHOST
130CFLAGS += -DANDROID_SMP=0
131CFLAGS += -I$(SRCDIR)/system/core/adb
132CFLAGS += -I$(SRCDIR)/system/core/include
133CFLAGS += -I$(SRCDIR)/system/core/libsparse/include
134CFLAGS += -I$(SRCDIR)/system/extras/ext4_utils
135CFLAGS += -I$(SRCDIR)/system/core/fs_mgr/include
136CFLAGS += -I$(SRCDIR)/hardware/libhardware/include
137CFLAGS += -I$(SRCDIR)/external/libselinux/include
138CFLAGS += -include $(SRCDIR)/build/core/combo/include/arch/$(android_arch)/AndroidConfig.h
139
140LIBS += liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a -lpthread -lbsd -lpcre -lresolv -lcrypto
141
142all: adbd
143
144adbd: liblog.a libfs_mgr.a libcutils.a libselinux.a libext4_utils.a $(adbd_OBJS)
145 $(CC) -o $@ $(LDFLAGS) $(adbd_OBJS) $(LIBS)
146
147liblog.a: $(liblog_OBJS)
148 $(AR) rcs $@ $(liblog_OBJS)
149
150libfs_mgr.a: $(fs_mgr_OBJS)
151 $(AR) rcs $@ $(fs_mgr_OBJS)
152
153libcutils.a: $(libcutils_OBJS)
154 $(AR) rcs $@ $(libcutils_OBJS)
155
156libselinux.a: $(libselinux_OBJS)
157 export CFLAGS="-DANDROID -DHOST"
158 $(AR) rcs $@ $(libselinux_OBJS)
159
160libext4_utils.a: $(libext4_utils_OBJS)
161 $(AR) rcs $@ $(libext4_utils_OBJS)
162
163clean:
164 $(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
deleted file mode 100644
index b6661f2e39..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/android-tools-adbd.service
+++ /dev/null
@@ -1,13 +0,0 @@
1[Unit]
2Description=Android Debug Bridge
3ConditionPathExists=/etc/usb-debugging-enabled
4Before=android-system.service
5
6[Service]
7Type=simple
8Restart=on-failure
9ExecStartPre=-/usr/bin/android-gadget-setup adb
10ExecStart=/usr/bin/adbd
11
12[Install]
13WantedBy=basic.target
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch b/meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch
deleted file mode 100644
index c091fd404b..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/build/0001-Riscv-Add-risc-v-Android-config-header.patch
+++ /dev/null
@@ -1,361 +0,0 @@
1From 82dce13ea7b5b31c63851bd67f66072413917e73 Mon Sep 17 00:00:00 2001
2From: Chenxi Mao <maochenxi@eswin.com>
3Date: Mon, 20 Apr 2020 15:32:40 +0800
4Subject: [PATCH 1/1] Riscv: Add risc-v Android config header
5
6---
7Upstream-Status: Pending
8
9 .../arch/linux-riscv64/AndroidConfig.h | 340 ++++++++++++++++++
10 1 file changed, 340 insertions(+)
11 create mode 100644 core/combo/include/arch/linux-riscv64/AndroidConfig.h
12
13diff --git a/core/combo/include/arch/linux-riscv64/AndroidConfig.h b/core/combo/include/arch/linux-riscv64/AndroidConfig.h
14new file mode 100644
15index 0000000000..bcbda8f87f
16--- /dev/null
17+++ b/core/combo/include/arch/linux-riscv64/AndroidConfig.h
18@@ -0,0 +1,340 @@
19+/*
20+ * Copyright (C) 2013 The Android Open Source Project
21+ *
22+ * Licensed under the Apache License, Version 2.0 (the "License");
23+ * you may not use this file except in compliance with the License.
24+ * You may obtain a copy of the License at
25+ *
26+ * http://www.apache.org/licenses/LICENSE-2.0
27+ *
28+ * Unless required by applicable law or agreed to in writing, software
29+ * distributed under the License is distributed on an "AS IS" BASIS,
30+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31+ * See the License for the specific language governing permissions and
32+ * limitations under the License.
33+ */
34+
35+/*
36+ * Android config -- "android-aarch64". Used for ARM aarch64 device builds.
37+ */
38+#ifndef _ANDROID_CONFIG_H
39+#define _ANDROID_CONFIG_H
40+
41+/*
42+ * ===========================================================================
43+ * !!! IMPORTANT !!!
44+ * ===========================================================================
45+ *
46+ * This file is included by ALL C/C++ source files. Don't put anything in
47+ * here unless you are absolutely certain it can't go anywhere else.
48+ *
49+ * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
50+ * comments.
51+ */
52+
53+/*
54+ * Threading model. Choose one:
55+ *
56+ * HAVE_PTHREADS - use the pthreads library.
57+ * HAVE_WIN32_THREADS - use Win32 thread primitives.
58+ * -- combine HAVE_CREATETHREAD, HAVE_CREATEMUTEX, and HAVE__BEGINTHREADEX
59+ */
60+#define HAVE_PTHREADS
61+
62+/*
63+ * Do we have pthread_setname_np()?
64+ *
65+ * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with
66+ * the same name but different parameters, so we can't use that here.)
67+ */
68+#define HAVE_ANDROID_PTHREAD_SETNAME_NP
69+
70+/*
71+ * Do we have the futex syscall?
72+ */
73+#define HAVE_FUTEX
74+
75+/*
76+ * Process creation model. Choose one:
77+ *
78+ * HAVE_FORKEXEC - use fork() and exec()
79+ * HAVE_WIN32_PROC - use CreateProcess()
80+ */
81+#define HAVE_FORKEXEC
82+
83+/*
84+ * Process out-of-memory adjustment. Set if running on Linux,
85+ * where we can write to /proc/<pid>/oom_adj to modify the out-of-memory
86+ * badness adjustment.
87+ */
88+#define HAVE_OOM_ADJ
89+
90+/*
91+ * IPC model. Choose one:
92+ *
93+ * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget).
94+ * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap).
95+ * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping).
96+ * HAVE_ANDROID_IPC - use Android versions (?, mmap).
97+ */
98+#define HAVE_ANDROID_IPC
99+
100+/*
101+ * Memory-mapping model. Choose one:
102+ *
103+ * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h
104+ * HAVE_WIN32_FILEMAP - use Win32 filemaps
105+ */
106+#define HAVE_POSIX_FILEMAP
107+
108+/*
109+ * Define this if you have <termio.h>
110+ */
111+#define HAVE_TERMIO_H 1
112+
113+/*
114+ * Define this if you have <sys/sendfile.h>
115+ */
116+#define HAVE_SYS_SENDFILE_H 1
117+
118+/*
119+ * Define this if you build against MSVCRT.DLL
120+ */
121+/* #define HAVE_MS_C_RUNTIME */
122+
123+/*
124+ * Define this if you have sys/uio.h
125+ */
126+#define HAVE_SYS_UIO_H 1
127+
128+/*
129+ * Define this if your platforms implements symbolic links
130+ * in its filesystems
131+ */
132+#define HAVE_SYMLINKS
133+
134+/*
135+ * Define this if we have localtime_r().
136+ */
137+/* #define HAVE_LOCALTIME_R 1 */
138+
139+/*
140+ * Define this if we have gethostbyname_r().
141+ */
142+/* #define HAVE_GETHOSTBYNAME_R */
143+
144+/*
145+ * Define this if we have ioctl().
146+ */
147+#define HAVE_IOCTL
148+
149+/*
150+ * Define this if we want to use WinSock.
151+ */
152+/* #define HAVE_WINSOCK */
153+
154+/*
155+ * Define this if have clock_gettime() and friends
156+ */
157+#define HAVE_POSIX_CLOCKS
158+
159+/*
160+ * Define this if we have linux style epoll()
161+ */
162+#define HAVE_EPOLL
163+
164+/*
165+ * Endianness of the target machine. Choose one:
166+ *
167+ * HAVE_ENDIAN_H -- have endian.h header we can include.
168+ * HAVE_LITTLE_ENDIAN -- we are little endian.
169+ * HAVE_BIG_ENDIAN -- we are big endian.
170+ */
171+#define HAVE_ENDIAN_H
172+#define HAVE_LITTLE_ENDIAN
173+
174+#define _FILE_OFFSET_BITS 64
175+/* #define _LARGEFILE_SOURCE 1 */
176+
177+/*
178+ * Define if platform has off64_t (and lseek64 and other xxx64 functions)
179+ */
180+#define HAVE_OFF64_T
181+
182+/*
183+ * Defined if we have the backtrace() call for retrieving a stack trace.
184+ * Needed for CallStack to operate; if not defined, CallStack is
185+ * non-functional.
186+ */
187+#define HAVE_BACKTRACE 0
188+
189+/*
190+ * Defined if we have the cxxabi.h header for demangling C++ symbols. If
191+ * not defined, stack crawls will be displayed with raw mangled symbols
192+ */
193+#define HAVE_CXXABI 0
194+
195+/*
196+ * Defined if we have the gettid() system call.
197+ */
198+#define HAVE_GETTID
199+
200+/*
201+ * Defined if we have the sched_setscheduler() call
202+ */
203+#define HAVE_SCHED_SETSCHEDULER
204+
205+/*
206+ * Add any extra platform-specific defines here.
207+ */
208+#ifndef __linux__
209+#define __linux__
210+#endif
211+
212+/*
213+ * Define if we have <malloc.h> header
214+ */
215+#define HAVE_MALLOC_H
216+
217+/*
218+ * Define if we're running on *our* linux on device or emulator.
219+ */
220+#define HAVE_ANDROID_OS 1
221+
222+/*
223+ * Define if we have Linux-style non-filesystem Unix Domain Sockets
224+ */
225+#define HAVE_LINUX_LOCAL_SOCKET_NAMESPACE 1
226+
227+/*
228+ * Define if we have Linux's inotify in <sys/inotify.h>.
229+ */
230+#define HAVE_INOTIFY 1
231+
232+/*
233+ * Define if we have madvise() in <sys/mman.h>
234+ */
235+#define HAVE_MADVISE 1
236+
237+/*
238+ * Define if tm struct has tm_gmtoff field
239+ */
240+#define HAVE_TM_GMTOFF 1
241+
242+/*
243+ * Define if dirent struct has d_type field
244+ */
245+#define HAVE_DIRENT_D_TYPE 1
246+
247+/*
248+ * Define if libc includes Android system properties implementation.
249+ */
250+#define HAVE_LIBC_SYSTEM_PROPERTIES 1
251+
252+/*
253+ * Define if system provides a system property server (should be
254+ * mutually exclusive with HAVE_LIBC_SYSTEM_PROPERTIES).
255+ */
256+/* #define HAVE_SYSTEM_PROPERTY_SERVER */
257+
258+/*
259+ * What CPU architecture does this platform use?
260+ */
261+#define ARCH_AARCH64
262+
263+/*
264+ * Define if the size of enums is as short as possible,
265+ */
266+/* #define HAVE_SHORT_ENUMS */
267+
268+/*
269+ * sprintf() format string for shared library naming.
270+ */
271+#define OS_SHARED_LIB_FORMAT_STR "lib%s.so"
272+
273+/*
274+ * type for the third argument to mincore().
275+ */
276+#define MINCORE_POINTER_TYPE unsigned char *
277+
278+/*
279+ * The default path separator for the platform
280+ */
281+#define OS_PATH_SEPARATOR '/'
282+
283+/*
284+ * Is the filesystem case sensitive?
285+ */
286+#define OS_CASE_SENSITIVE
287+
288+/*
289+ * Define if <sys/socket.h> exists.
290+ */
291+#define HAVE_SYS_SOCKET_H 1
292+
293+/*
294+ * Define if the strlcpy() function exists on the system.
295+ */
296+#define HAVE_STRLCPY 1
297+
298+/*
299+ * Define if the open_memstream() function exists on the system.
300+ */
301+/* #define HAVE_OPEN_MEMSTREAM 1 */
302+
303+/*
304+ * Define if the BSD funopen() function exists on the system.
305+ */
306+#define HAVE_FUNOPEN 1
307+
308+/*
309+ * Define if prctl() exists
310+ */
311+#define HAVE_PRCTL 1
312+
313+/*
314+ * Define if writev() exists
315+ */
316+#define HAVE_WRITEV 1
317+
318+/*
319+ * Define if <stdint.h> exists.
320+ */
321+#define HAVE_STDINT_H 1
322+
323+/*
324+ * Define if <stdbool.h> exists.
325+ */
326+#define HAVE_STDBOOL_H 1
327+
328+/*
329+ * Define if <sched.h> exists.
330+ */
331+#define HAVE_SCHED_H 1
332+
333+/*
334+ * Define if pread() exists
335+ */
336+#define HAVE_PREAD 1
337+
338+/*
339+ * Define if we have st_mtim in struct stat
340+ */
341+#define HAVE_STAT_ST_MTIM 1
342+
343+/*
344+ * Define if printf() supports %zd for size_t arguments
345+ */
346+#define HAVE_PRINTF_ZD 1
347+
348+/*
349+ * Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
350+ */
351+#define HAVE_BSD_QSORT_R 0
352+
353+/*
354+ * Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
355+ */
356+#define HAVE_GNU_QSORT_R 0
357+
358+#endif /* _ANDROID_CONFIG_H */
359--
3602.17.1
361
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0001-adb-remove-selinux-extensions.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0001-adb-remove-selinux-extensions.patch
deleted file mode 100644
index 7d20c50680..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0001-adb-remove-selinux-extensions.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From 7b7200727413ca4a9bb132221c543ec033dffafa Mon Sep 17 00:00:00 2001
2From: Sergio Schvezov <sergio.schvezov@canonical.com>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] adb: remove selinux extensions
5
6* drop useless includes of Android SELINUX extensions
7* avoids having to clone another module
8* this should be sent upstream
9
10Upstream-Status: Inappropriate
11
12Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
13---
14 adb/file_sync_service.c | 3 ---
15 1 file changed, 3 deletions(-)
16
17diff --git a/adb/file_sync_service.c b/adb/file_sync_service.c
18index 7933858516..3cbd0cd863 100644
19--- a/adb/file_sync_service.c
20+++ b/adb/file_sync_service.c
21@@ -26,7 +26,6 @@
22
23 #include <errno.h>
24 #include <private/android_filesystem_config.h>
25-#include <selinux/android.h>
26 #include "sysdeps.h"
27
28 #define TRACE_TAG TRACE_SYNC
29@@ -73,7 +72,6 @@ static int mkdirs(char *name)
30 *x = '/';
31 return ret;
32 }
33- selinux_android_restorecon(name, 0);
34 }
35 *x++ = '/';
36 }
37@@ -251,7 +249,6 @@ static int handle_send_file(int s, char *path, uid_t uid,
38 if(fd >= 0) {
39 struct utimbuf u;
40 adb_close(fd);
41- selinux_android_restorecon(path, 0);
42 u.actime = timestamp;
43 u.modtime = timestamp;
44 utime(path, &u);
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0001-memory.h-Always-define-strlcpy-for-glibc-based-syste.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0001-memory.h-Always-define-strlcpy-for-glibc-based-syste.patch
deleted file mode 100644
index 82e97152be..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0001-memory.h-Always-define-strlcpy-for-glibc-based-syste.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From db3a3714be07c8ab51b9ae7b035e4afe9f39c645 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 7 Sep 2022 13:20:22 -0700
4Subject: [PATCH] memory.h: Always define strlcpy for glibc based systems
5
6android-config.h file includes on compiler cmdline sets HAVE_STRLCPY
7unconditionally, since bionic supports it, its no big deal on android
8and also no problem when using musl since implementation exists for musl
9too, but glibc does not provide this. So either we include libbsd or use
10the implementation provided by android-tools here. We are currently
11using the in tree implementation for systems which do not provide it
12
13Upstream-Status: Pending
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 include/cutils/memory.h | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/include/cutils/memory.h b/include/cutils/memory.h
21index e725cdd032..9e99353c58 100644
22--- a/include/cutils/memory.h
23+++ b/include/cutils/memory.h
24@@ -30,7 +30,7 @@ void android_memset16(uint16_t* dst, uint16_t value, size_t size);
25 /* size is given in bytes and must be multiple of 4 */
26 void android_memset32(uint32_t* dst, uint32_t value, size_t size);
27
28-#if !HAVE_STRLCPY
29+#if !HAVE_STRLCPY || defined(__GLIBC__)
30 /* Declaration of strlcpy() for platforms that don't already have it. */
31 size_t strlcpy(char *dst, const char *src, size_t size);
32 #endif
33--
342.37.3
35
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0002-adb-Use-local-sockets-where-appropriate.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0002-adb-Use-local-sockets-where-appropriate.patch
deleted file mode 100644
index 3627110ad8..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0002-adb-Use-local-sockets-where-appropriate.patch
+++ /dev/null
@@ -1,70 +0,0 @@
1From d855f042ca09a358cebe2d3c1d29d512afd7ebb8 Mon Sep 17 00:00:00 2001
2From: Hilko Bengen <bengen@debian.org>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] adb: Use local sockets where appropriate
5
6Upstream-Status: Inappropriate
7---
8 adb/adb.c | 6 +++++-
9 adb/adb_client.c | 5 +++--
10 adb/transport_local.c | 3 ++-
11 3 files changed, 10 insertions(+), 4 deletions(-)
12
13diff --git a/adb/adb.c b/adb/adb.c
14index 10a1e0da26..027edd9359 100644
15--- a/adb/adb.c
16+++ b/adb/adb.c
17@@ -1230,7 +1230,11 @@ int launch_server(int server_port)
18 */
19 void build_local_name(char* target_str, size_t target_size, int server_port)
20 {
21- snprintf(target_str, target_size, "tcp:%d", server_port);
22+ if (gListenAll > 0) {
23+ snprintf(target_str, target_size, "tcp:%d", server_port);
24+ } else {
25+ snprintf(target_str, target_size, "local:%d", server_port);
26+ }
27 }
28
29 #if !ADB_HOST
30diff --git a/adb/adb_client.c b/adb/adb_client.c
31index eb1720d22c..a383faefe3 100644
32--- a/adb/adb_client.c
33+++ b/adb/adb_client.c
34@@ -185,12 +185,12 @@ int _adb_connect(const char *service)
35 strcpy(__adb_error, "service name too long");
36 return -1;
37 }
38- snprintf(tmp, sizeof tmp, "%04x", len);
39+ snprintf(tmp, sizeof tmp, "%d", __adb_server_port);
40
41 if (__adb_server_name)
42 fd = socket_network_client(__adb_server_name, __adb_server_port, SOCK_STREAM);
43 else
44- fd = socket_loopback_client(__adb_server_port, SOCK_STREAM);
45+ fd = socket_local_client(tmp, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
46
47 if(fd < 0) {
48 strcpy(__adb_error, "cannot connect to daemon");
49@@ -201,6 +201,7 @@ int _adb_connect(const char *service)
50 return -1;
51 }
52
53+ snprintf(tmp, sizeof tmp, "%04x", len);
54 if(writex(fd, tmp, 4) || writex(fd, service, len)) {
55 strcpy(__adb_error, "write failure during connection");
56 adb_close(fd);
57diff --git a/adb/transport_local.c b/adb/transport_local.c
58index 948cc15812..71582a8c88 100644
59--- a/adb/transport_local.c
60+++ b/adb/transport_local.c
61@@ -121,7 +121,8 @@ int local_connect_arbitrary_ports(int console_port, int adb_port)
62 }
63 #endif
64 if (fd < 0) {
65- fd = socket_loopback_client(adb_port, SOCK_STREAM);
66+ snprintf(buf, sizeof buf, "%d", adb_port);
67+ fd = socket_local_client(buf, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM);
68 }
69
70 if (fd >= 0) {
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0003-adb-define-shell-command.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0003-adb-define-shell-command.patch
deleted file mode 100644
index cf1d9cbc3d..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0003-adb-define-shell-command.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 4421c2e19946dcd651fd8ac022b96627fc526149 Mon Sep 17 00:00:00 2001
2From: Fathi Boudra <fabo@debian.org>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] adb: define shell command
5
6we intend to run on Linux system so the shell is always /bin/sh,
7for the host or the target.
8
9Upstream-Status: Inappropriate
10---
11 adb/services.c | 4 ----
12 1 file changed, 4 deletions(-)
13
14diff --git a/adb/services.c b/adb/services.c
15index 21b08dc201..d44b0c5068 100644
16--- a/adb/services.c
17+++ b/adb/services.c
18@@ -299,11 +299,7 @@ static int create_subproc_raw(const char *cmd, const char *arg0, const char *arg
19 }
20 #endif /* !ABD_HOST */
21
22-#if ADB_HOST
23 #define SHELL_COMMAND "/bin/sh"
24-#else
25-#define SHELL_COMMAND "/system/bin/sh"
26-#endif
27
28 #if !ADB_HOST
29 static void subproc_waiter_service(int fd, void *cookie)
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0004-adb-Fix-build-on-big-endian-systems.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0004-adb-Fix-build-on-big-endian-systems.patch
deleted file mode 100644
index 7f03cd2beb..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0004-adb-Fix-build-on-big-endian-systems.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From 548b8ca62c64a16305929e2eaf3d546d48de9c25 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Tue, 21 Feb 2017 19:46:24 +0100
4Subject: [PATCH] adb: Fix build on big endian systems
5
6The usb_linux_client.c file defines cpu_to_le16/32 by using the C
7library htole16/32 function calls. However, cpu_to_le16/32 are used
8when initializing structures, i.e in a context where a function call
9is not allowed.
10
11It works fine on little endian systems because htole16/32 are defined
12by the C library as no-ops. But on big-endian systems, they are
13actually doing something, which might involve calling a function,
14causing build failures.
15
16To solve this, we simply open-code cpu_to_le16/32 in a way that allows
17them to be used when initializing structures.
18
19Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
20---
21Upstream-Status: Pending
22
23 adb/usb_linux_client.c | 11 +++++++++--
24 1 file changed, 9 insertions(+), 2 deletions(-)
25
26diff --git a/adb/usb_linux_client.c b/adb/usb_linux_client.c
27index 8426e0ea14..6e8b5bbbd2 100644
28--- a/adb/usb_linux_client.c
29+++ b/adb/usb_linux_client.c
30@@ -34,8 +34,15 @@
31 #define MAX_PACKET_SIZE_FS 64
32 #define MAX_PACKET_SIZE_HS 512
33
34-#define cpu_to_le16(x) htole16(x)
35-#define cpu_to_le32(x) htole32(x)
36+#if __BYTE_ORDER == __LITTLE_ENDIAN
37+# define cpu_to_le16(x) (x)
38+# define cpu_to_le32(x) (x)
39+#else
40+# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8))
41+# define cpu_to_le32(x) \
42+ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \
43+ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
44+#endif
45
46 struct usb_handle
47 {
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0005-adb-add-base64-implementation.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0005-adb-add-base64-implementation.patch
deleted file mode 100644
index 4827ffe042..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0005-adb-add-base64-implementation.patch
+++ /dev/null
@@ -1,350 +0,0 @@
1From 753bcb5971401b82fb2e6197d31c9e386f6d0392 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 15 Sep 2017 15:46:38 -0700
4Subject: [PATCH] adb: add base64 implementation
5
6musl needs it
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11
12 adb/adb_auth_client.c | 2 +-
13 adb/base64.c | 315 ++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 316 insertions(+), 1 deletion(-)
15 create mode 100644 adb/base64.c
16
17diff --git a/adb/adb_auth_client.c b/adb/adb_auth_client.c
18index 55e9dcad19..104b413b8b 100644
19--- a/adb/adb_auth_client.c
20+++ b/adb/adb_auth_client.c
21@@ -75,7 +75,7 @@ static void read_keys(const char *file, struct listnode *list)
22 if (sep)
23 *sep = '\0';
24
25- ret = __b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4);
26+ ret = b64_pton(buf, (u_char *)&key->key, sizeof(key->key) + 4);
27 if (ret != sizeof(key->key)) {
28 D("%s: Invalid base64 data ret=%d\n", file, ret);
29 free(key);
30diff --git a/adb/base64.c b/adb/base64.c
31new file mode 100644
32index 0000000000..95da284d0d
33--- /dev/null
34+++ b/adb/base64.c
35@@ -0,0 +1,315 @@
36+/*
37+ * Copyright (c) 1996-1999 by Internet Software Consortium.
38+ *
39+ * Permission to use, copy, modify, and distribute this software for any
40+ * purpose with or without fee is hereby granted, provided that the above
41+ * copyright notice and this permission notice appear in all copies.
42+ *
43+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
44+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
45+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
46+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
47+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
48+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
49+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
50+ * SOFTWARE.
51+ */
52+
53+/*
54+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
55+ *
56+ * International Business Machines, Inc. (hereinafter called IBM) grants
57+ * permission under its copyrights to use, copy, modify, and distribute this
58+ * Software with or without fee, provided that the above copyright notice and
59+ * all paragraphs of this notice appear in all copies, and that the name of IBM
60+ * not be used in connection with the marketing of any product incorporating
61+ * the Software or modifications thereof, without specific, written prior
62+ * permission.
63+ *
64+ * To the extent it has a right to do so, IBM grants an immunity from suit
65+ * under its patents, if any, for the use, sale or manufacture of products to
66+ * the extent that such products are used for performing Domain Name System
67+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
68+ * granted for any product per se or for any other function of any product.
69+ *
70+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
71+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
72+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
73+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
74+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
75+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
76+ */
77+
78+#if !defined(LINT) && !defined(CODECENTER)
79+static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
80+#endif /* not lint */
81+
82+#include <sys/types.h>
83+#include <sys/param.h>
84+#include <sys/socket.h>
85+
86+#include <netinet/in.h>
87+#include <arpa/inet.h>
88+#include <arpa/nameser.h>
89+
90+#include <ctype.h>
91+#include <resolv.h>
92+#include <stdio.h>
93+#include <stdlib.h>
94+#include <stdint.h>
95+#include <string.h>
96+
97+#define Assert(Cond) if (!(Cond)) abort()
98+
99+static const char Base64[] =
100+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
101+static const char Pad64 = '=';
102+
103+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
104+ The following encoding technique is taken from RFC 1521 by Borenstein
105+ and Freed. It is reproduced here in a slightly edited form for
106+ convenience.
107+
108+ A 65-character subset of US-ASCII is used, enabling 6 bits to be
109+ represented per printable character. (The extra 65th character, "=",
110+ is used to signify a special processing function.)
111+
112+ The encoding process represents 24-bit groups of input bits as output
113+ strings of 4 encoded characters. Proceeding from left to right, a
114+ 24-bit input group is formed by concatenating 3 8-bit input groups.
115+ These 24 bits are then treated as 4 concatenated 6-bit groups, each
116+ of which is translated into a single digit in the base64 alphabet.
117+
118+ Each 6-bit group is used as an index into an array of 64 printable
119+ characters. The character referenced by the index is placed in the
120+ output string.
121+
122+ Table 1: The Base64 Alphabet
123+
124+ Value Encoding Value Encoding Value Encoding Value Encoding
125+ 0 A 17 R 34 i 51 z
126+ 1 B 18 S 35 j 52 0
127+ 2 C 19 T 36 k 53 1
128+ 3 D 20 U 37 l 54 2
129+ 4 E 21 V 38 m 55 3
130+ 5 F 22 W 39 n 56 4
131+ 6 G 23 X 40 o 57 5
132+ 7 H 24 Y 41 p 58 6
133+ 8 I 25 Z 42 q 59 7
134+ 9 J 26 a 43 r 60 8
135+ 10 K 27 b 44 s 61 9
136+ 11 L 28 c 45 t 62 +
137+ 12 M 29 d 46 u 63 /
138+ 13 N 30 e 47 v
139+ 14 O 31 f 48 w (pad) =
140+ 15 P 32 g 49 x
141+ 16 Q 33 h 50 y
142+
143+ Special processing is performed if fewer than 24 bits are available
144+ at the end of the data being encoded. A full encoding quantum is
145+ always completed at the end of a quantity. When fewer than 24 input
146+ bits are available in an input group, zero bits are added (on the
147+ right) to form an integral number of 6-bit groups. Padding at the
148+ end of the data is performed using the '=' character.
149+
150+ Since all base64 input is an integral number of octets, only the
151+ -------------------------------------------------
152+ following cases can arise:
153+
154+ (1) the final quantum of encoding input is an integral
155+ multiple of 24 bits; here, the final unit of encoded
156+ output will be an integral multiple of 4 characters
157+ with no "=" padding,
158+ (2) the final quantum of encoding input is exactly 8 bits;
159+ here, the final unit of encoded output will be two
160+ characters followed by two "=" padding characters, or
161+ (3) the final quantum of encoding input is exactly 16 bits;
162+ here, the final unit of encoded output will be three
163+ characters followed by one "=" padding character.
164+ */
165+
166+int
167+b64_ntop(const uint8_t* src, size_t srclength, char* target, size_t targsize)
168+{
169+ size_t datalength = 0;
170+ uint8_t input[3];
171+ uint8_t output[4];
172+ size_t i;
173+
174+ while (2 < srclength) {
175+ input[0] = *src++;
176+ input[1] = *src++;
177+ input[2] = *src++;
178+ srclength -= 3;
179+
180+ output[0] = input[0] >> 2;
181+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
182+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
183+ output[3] = input[2] & 0x3f;
184+ Assert(output[0] < 64);
185+ Assert(output[1] < 64);
186+ Assert(output[2] < 64);
187+ Assert(output[3] < 64);
188+
189+ if (datalength + 4 > targsize)
190+ return (-1);
191+ target[datalength++] = Base64[output[0]];
192+ target[datalength++] = Base64[output[1]];
193+ target[datalength++] = Base64[output[2]];
194+ target[datalength++] = Base64[output[3]];
195+ }
196+
197+ /* Now we worry about padding. */
198+ if (0 != srclength) {
199+ /* Get what's left. */
200+ input[0] = input[1] = input[2] = '\0';
201+ for (i = 0; i < srclength; i++)
202+ input[i] = *src++;
203+
204+ output[0] = input[0] >> 2;
205+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
206+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
207+ Assert(output[0] < 64);
208+ Assert(output[1] < 64);
209+ Assert(output[2] < 64);
210+
211+ if (datalength + 4 > targsize)
212+ return (-1);
213+ target[datalength++] = Base64[output[0]];
214+ target[datalength++] = Base64[output[1]];
215+ if (srclength == 1)
216+ target[datalength++] = Pad64;
217+ else
218+ target[datalength++] = Base64[output[2]];
219+ target[datalength++] = Pad64;
220+ }
221+ if (datalength >= targsize)
222+ return (-1);
223+ target[datalength] = '\0'; /* Returned value doesn't count \0. */
224+ return (datalength);
225+}
226+
227+/* skips all whitespace anywhere.
228+ converts characters, four at a time, starting at (or after)
229+ src from base - 64 numbers into three 8 bit bytes in the target area.
230+ it returns the number of data bytes stored at the target, or -1 on error.
231+ */
232+
233+int b64_pton(const char* src, uint8_t* target, size_t targsize)
234+{
235+ int tarindex, state, ch;
236+ char *pos;
237+
238+ state = 0;
239+ tarindex = 0;
240+
241+ while ((ch = *src++) != '\0') {
242+ if (isspace(ch)) /* Skip whitespace anywhere. */
243+ continue;
244+
245+ if (ch == Pad64)
246+ break;
247+
248+ pos = strchr(Base64, ch);
249+ if (pos == 0) /* A non-base64 character. */
250+ return (-1);
251+
252+ switch (state) {
253+ case 0:
254+ if (target) {
255+ if ((size_t)tarindex >= targsize)
256+ return (-1);
257+ target[tarindex] = (pos - Base64) << 2;
258+ }
259+ state = 1;
260+ break;
261+ case 1:
262+ if (target) {
263+ if ((size_t)tarindex + 1 >= targsize)
264+ return (-1);
265+ target[tarindex] |= (pos - Base64) >> 4;
266+ target[tarindex+1] = ((pos - Base64) & 0x0f)
267+ << 4 ;
268+ }
269+ tarindex++;
270+ state = 2;
271+ break;
272+ case 2:
273+ if (target) {
274+ if ((size_t)tarindex + 1 >= targsize)
275+ return (-1);
276+ target[tarindex] |= (pos - Base64) >> 2;
277+ target[tarindex+1] = ((pos - Base64) & 0x03)
278+ << 6;
279+ }
280+ tarindex++;
281+ state = 3;
282+ break;
283+ case 3:
284+ if (target) {
285+ if ((size_t)tarindex >= targsize)
286+ return (-1);
287+ target[tarindex] |= (pos - Base64);
288+ }
289+ tarindex++;
290+ state = 0;
291+ break;
292+ default:
293+ abort();
294+ }
295+ }
296+
297+ /*
298+ * We are done decoding Base-64 chars. Let's see if we ended
299+ * on a byte boundary, and/or with erroneous trailing characters.
300+ */
301+
302+ if (ch == Pad64) { /* We got a pad char. */
303+ ch = *src++; /* Skip it, get next. */
304+ switch (state) {
305+ case 0: /* Invalid = in first position */
306+ case 1: /* Invalid = in second position */
307+ return (-1);
308+
309+ case 2: /* Valid, means one byte of info */
310+ /* Skip any number of spaces. */
311+ for ((void)NULL; ch != '\0'; ch = *src++)
312+ if (!isspace(ch))
313+ break;
314+ /* Make sure there is another trailing = sign. */
315+ if (ch != Pad64)
316+ return (-1);
317+ ch = *src++; /* Skip the = */
318+ /* Fall through to "single trailing =" case. */
319+ /* FALLTHROUGH */
320+
321+ case 3: /* Valid, means two bytes of info */
322+ /*
323+ * We know this char is an =. Is there anything but
324+ * whitespace after it?
325+ */
326+ for ((void)NULL; ch != '\0'; ch = *src++)
327+ if (!isspace(ch))
328+ return (-1);
329+
330+ /*
331+ * Now make sure for cases 2 and 3 that the "extra"
332+ * bits that slopped past the last full byte were
333+ * zeros. If we don't check them, they become a
334+ * subliminal channel.
335+ */
336+ if (target && target[tarindex] != 0)
337+ return (-1);
338+ }
339+ } else {
340+ /*
341+ * We ended by seeing the end of the string. Make sure we
342+ * have no partial bytes lying around.
343+ */
344+ if (state != 0)
345+ return (-1);
346+ }
347+
348+ return (tarindex);
349+}
350+
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch
deleted file mode 100644
index 182b1eb29e..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0006-adb-Musl-fixes.patch
+++ /dev/null
@@ -1,130 +0,0 @@
1From 62d957a1271c88ec08d67984fbe31601f0bd41a9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 15 Sep 2017 15:50:57 -0700
4Subject: [PATCH] adb: Musl fixes
5
6__nonnull is gcc specific
7include sys/types.h for size_t
8Do not redefine close() and lseek()
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12Upstream-Status: Pending
13
14 adb/adb.h | 2 ++
15 adb/disable_verity_service.c | 13 ++++++++-----
16 adb/framebuffer_service.c | 7 ++++---
17 adb/sysdeps.h | 12 ++++++------
18 4 files changed, 20 insertions(+), 14 deletions(-)
19
20--- a/adb/adb.h
21+++ b/adb/adb.h
22@@ -18,7 +18,9 @@
23 #define __ADB_H
24
25 #include <limits.h>
26+#include <sys/types.h>
27
28+#include "fdevent.h"
29 #include "adb_trace.h"
30 #include "transport.h" /* readx(), writex() */
31
32--- a/adb/disable_verity_service.c
33+++ b/adb/disable_verity_service.c
34@@ -14,25 +14,32 @@
35 * limitations under the License.
36 */
37
38-#include "sysdeps.h"
39
40 #define TRACE_TAG TRACE_ADB
41 #include "adb.h"
42+#include "sysdeps.h"
43+#include "cutils/properties.h"
44+#include "ext4_sb.h"
45+#include <fs_mgr.h>
46
47 #include <stdio.h>
48 #include <stdarg.h>
49 #include <sys/stat.h>
50 #include <fcntl.h>
51 #include <inttypes.h>
52-
53-#include "cutils/properties.h"
54-#include "ext4_sb.h"
55-#include <fs_mgr.h>
56+#include <unistd.h>
57+#include <errno.h>
58+#include <stdbool.h>
59+
60+#if defined(__linux__) && !defined(__GLIBC__)
61+#define lseek64 lseek
62+#define off64_t off_t
63+#endif
64
65 #define FSTAB_PREFIX "/fstab."
66 struct fstab *fstab;
67
68-__attribute__((__format__(printf, 2, 3))) __nonnull((2))
69+__attribute__((__format__(printf, 2, 3))) __attribute__((nonnull((2))))
70 static void write_console(int fd, const char* format, ...)
71 {
72 char buffer[256];
73--- a/adb/framebuffer_service.c
74+++ b/adb/framebuffer_service.c
75@@ -14,6 +14,10 @@
76 * limitations under the License.
77 */
78
79+#include "fdevent.h"
80+#include "adb.h"
81+#include "sysdeps.h"
82+
83 #include <stdlib.h>
84 #include <stdio.h>
85 #include <unistd.h>
86@@ -23,9 +27,6 @@
87 #include <sys/types.h>
88 #include <sys/wait.h>
89
90-#include "fdevent.h"
91-#include "adb.h"
92-
93 #include <linux/fb.h>
94 #include <sys/ioctl.h>
95 #include <sys/mman.h>
96--- a/adb/sysdeps.h
97+++ b/adb/sysdeps.h
98@@ -123,8 +123,8 @@ static __inline__ int unix_close(int fd
99 {
100 return close(fd);
101 }
102-#undef close
103-#define close ____xxx_close
104+//#undef close
105+//#define close ____xxx_close
106
107 static __inline__ int unix_read(int fd, void* buf, size_t len)
108 {
109@@ -369,8 +369,8 @@ static __inline__ int adb_close(int fd)
110 {
111 return close(fd);
112 }
113-#undef close
114-#define close ____xxx_close
115+//#undef close
116+//#define close ____xxx_close
117
118
119 static __inline__ int adb_read(int fd, void* buf, size_t len)
120@@ -392,8 +392,8 @@ static __inline__ int adb_lseek(int f
121 {
122 return lseek(fd, pos, where);
123 }
124-#undef lseek
125-#define lseek ___xxx_lseek
126+//#undef lseek
127+//#define lseek ___xxx_lseek
128
129 static __inline__ int adb_unlink(const char* path)
130 {
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0007-adb-usb_linux.c-fix-build-with-glibc-2.28.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0007-adb-usb_linux.c-fix-build-with-glibc-2.28.patch
deleted file mode 100644
index 64fbce4cbe..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0007-adb-usb_linux.c-fix-build-with-glibc-2.28.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From de393bba41c8feff932c77d6c30233945f380d42 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Sat, 11 Aug 2018 13:23:37 +0000
4Subject: [PATCH] adb: usb_linux.c: fix build with glibc-2.28
5
6* include sysmacros for major, minor
7
8Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
9---
10Upstream-Status: Pending
11
12 adb/usb_linux.c | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/adb/usb_linux.c b/adb/usb_linux.c
16index f16bdd0361..c8a7732441 100644
17--- a/adb/usb_linux.c
18+++ b/adb/usb_linux.c
19@@ -22,6 +22,7 @@
20 #include <sys/ioctl.h>
21 #include <sys/types.h>
22 #include <sys/time.h>
23+#include <sys/sysmacros.h>
24 #include <dirent.h>
25 #include <fcntl.h>
26 #include <errno.h>
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0008-adb-Allow-adbd-to-be-ran-as-root.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0008-adb-Allow-adbd-to-be-ran-as-root.patch
deleted file mode 100644
index ad21b5aaa6..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0008-adb-Allow-adbd-to-be-ran-as-root.patch
+++ /dev/null
@@ -1,23 +0,0 @@
1From 3a788e9168c9b9eac66c4fa479413f4a95c61be4 Mon Sep 17 00:00:00 2001
2From: Florent Revest <revestflo@gmail.com>
3Date: Mon, 30 Oct 2017 21:05:46 +0100
4Subject: [PATCH] adb: Allow adbd to be ran as root
5
6---
7Upstream-Status: Pending
8
9 adb/adb.c | 1 +
10 1 file changed, 1 insertion(+)
11
12diff --git a/adb/adb.c b/adb/adb.c
13index 027edd9359..e0f7ecde45 100644
14--- a/adb/adb.c
15+++ b/adb/adb.c
16@@ -1271,6 +1271,7 @@ static int should_drop_privileges() {
17 int secure = 0;
18 char value[PROPERTY_VALUE_MAX];
19
20+ return 0;
21 /* run adbd in secure mode if ro.secure is set and
22 ** we are not in the emulator
23 */
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0009-mkbootimg-Add-dt-parameter-to-specify-DT-image.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0009-mkbootimg-Add-dt-parameter-to-specify-DT-image.patch
deleted file mode 100644
index a4dc6e1e35..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0009-mkbootimg-Add-dt-parameter-to-specify-DT-image.patch
+++ /dev/null
@@ -1,110 +0,0 @@
1From dd195778a9930b7967b21a3b8eb390b70253dbad Mon Sep 17 00:00:00 2001
2From: David Ng <dave@codeaurora.org>
3Date: Fri, 27 Jul 2012 17:15:03 -0700
4Subject: [PATCH] mkbootimg: Add --dt parameter to specify DT image
5
6New optional --dt parameter to specify a kernel device
7tree image.
8
9Upstream-Status: Inappropriate
10---
11 mkbootimg/bootimg.h | 7 +++++--
12 mkbootimg/mkbootimg.c | 21 +++++++++++++++++++++
13 2 files changed, 26 insertions(+), 2 deletions(-)
14
15diff --git a/mkbootimg/bootimg.h b/mkbootimg/bootimg.h
16index 9171d85a7b..308c537d6b 100644
17--- a/mkbootimg/bootimg.h
18+++ b/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)
44diff --git a/mkbootimg/mkbootimg.c b/mkbootimg/mkbootimg.c
45index fc92b4dc30..658052cdf2 100644
46--- a/mkbootimg/mkbootimg.c
47+++ b/mkbootimg/mkbootimg.c
48@@ -65,6 +65,7 @@ int usage(void)
49 " [ --board <boardname> ]\n"
50 " [ --base <address> ]\n"
51 " [ --pagesize <pagesize> ]\n"
52+ " [ --dt <filename> ]\n"
53 " -o|--output <filename>\n"
54 );
55 return 1;
56@@ -105,6 +106,8 @@ int main(int argc, char **argv)
57 char *cmdline = "";
58 char *bootimg = 0;
59 char *board = "";
60+ char *dt_fn = 0;
61+ void *dt_data = 0;
62 unsigned pagesize = 2048;
63 int fd;
64 SHA_CTX ctx;
65@@ -158,6 +161,8 @@ int main(int argc, char **argv)
66 fprintf(stderr,"error: unsupported page size %d\n", pagesize);
67 return -1;
68 }
69+ } else if(!strcmp(arg, "--dt")) {
70+ dt_fn = val;
71 } else {
72 return usage();
73 }
74@@ -232,6 +237,14 @@ int main(int argc, char **argv)
75 }
76 }
77
78+ if(dt_fn) {
79+ dt_data = load_file(dt_fn, &hdr.dt_size);
80+ if (dt_data == 0) {
81+ fprintf(stderr,"error: could not load device tree image '%s'\n", dt_fn);
82+ return 1;
83+ }
84+ }
85+
86 /* put a hash of the contents in the header so boot images can be
87 * differentiated based on their first 2k.
88 */
89@@ -242,6 +255,10 @@ int main(int argc, char **argv)
90 SHA_update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size));
91 SHA_update(&ctx, second_data, hdr.second_size);
92 SHA_update(&ctx, &hdr.second_size, sizeof(hdr.second_size));
93+ if(dt_data) {
94+ SHA_update(&ctx, dt_data, hdr.dt_size);
95+ SHA_update(&ctx, &hdr.dt_size, sizeof(hdr.dt_size));
96+ }
97 sha = SHA_final(&ctx);
98 memcpy(hdr.id, sha,
99 SHA_DIGEST_SIZE > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_SIZE);
100@@ -266,6 +283,10 @@ int main(int argc, char **argv)
101 if(write_padding(fd, pagesize, hdr.second_size)) goto fail;
102 }
103
104+ if(dt_data) {
105+ if(write(fd, dt_data, hdr.dt_size) != (ssize_t) hdr.dt_size) goto fail;
106+ if(write_padding(fd, pagesize, hdr.dt_size)) goto fail;
107+ }
108 return 0;
109
110 fail:
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0010-Use-linux-capability.h-on-linux-systems-too.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0010-Use-linux-capability.h-on-linux-systems-too.patch
deleted file mode 100644
index 2c607ff67c..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0010-Use-linux-capability.h-on-linux-systems-too.patch
+++ /dev/null
@@ -1,23 +0,0 @@
1From ef743c9c3c7452ae904a5c343ee2b759ab3a87cb Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Lo=C3=AFc=20Minier?= <loic.minier@ubuntu.com>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] Use linux/capability.h on linux systems too
5
6Upstream-Status: Inappropriate
7---
8 include/private/android_filesystem_config.h | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
12index 2f528b95c8..3e0b00928e 100644
13--- a/include/private/android_filesystem_config.h
14+++ b/include/private/android_filesystem_config.h
15@@ -27,7 +27,7 @@
16 #include <sys/types.h>
17 #include <stdint.h>
18
19-#ifdef HAVE_ANDROID_OS
20+#if defined(HAVE_ANDROID_OS) || defined(__linux__)
21 #include <linux/capability.h>
22 #else
23 #include "android_filesystem_capability.h"
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0011-Remove-bionic-specific-calls.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0011-Remove-bionic-specific-calls.patch
deleted file mode 100644
index 5b18f461a3..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0011-Remove-bionic-specific-calls.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From 9eff8799831961c0edf6e37e5d4cbf43baa7c748 Mon Sep 17 00:00:00 2001
2From: Fathi Boudra <fabo@debian.org>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] Remove bionic specific calls
5
6Upstream-Status: Inappropriate
7---
8 include/cutils/properties.h | 1 -
9 libcutils/properties.c | 2 +-
10 liblog/logd_write.c | 5 +++++
11 3 files changed, 6 insertions(+), 2 deletions(-)
12
13diff --git a/include/cutils/properties.h b/include/cutils/properties.h
14index 798db8b36f..7d01f28d6e 100644
15--- a/include/cutils/properties.h
16+++ b/include/cutils/properties.h
17@@ -19,7 +19,6 @@
18
19 #include <sys/cdefs.h>
20 #include <stddef.h>
21-#include <sys/system_properties.h>
22 #include <stdint.h>
23
24 #ifdef __cplusplus
25diff --git a/libcutils/properties.c b/libcutils/properties.c
26index b283658aa4..4151e7882c 100644
27--- a/libcutils/properties.c
28+++ b/libcutils/properties.c
29@@ -104,10 +104,10 @@ int32_t property_get_int32(const char *key, int32_t default_value) {
30 return (int32_t)property_get_imax(key, INT32_MIN, INT32_MAX, default_value);
31 }
32
33+#undef HAVE_LIBC_SYSTEM_PROPERTIES
34 #ifdef HAVE_LIBC_SYSTEM_PROPERTIES
35
36 #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
37-#include <sys/_system_properties.h>
38
39 int property_set(const char *key, const char *value)
40 {
41diff --git a/liblog/logd_write.c b/liblog/logd_write.c
42index b2668cedb7..f5a44fe901 100644
43--- a/liblog/logd_write.c
44+++ b/liblog/logd_write.c
45@@ -23,6 +23,7 @@
46 #include <stdlib.h>
47 #include <string.h>
48 #include <sys/stat.h>
49+#include <sys/syscall.h>
50 #include <sys/types.h>
51 #if (FAKE_LOG_DEVICE == 0)
52 #include <sys/socket.h>
53@@ -205,7 +206,11 @@ static int __write_to_log_kernel(log_id_t log_id, struct iovec *vec, size_t nr)
54 realtime_ts.tv_nsec = ts.tv_nsec;
55
56 log_id_buf = log_id;
57+#ifdef __BIONIC__
58 tid = gettid();
59+#else
60+ tid = (pid_t) syscall(__NR_gettid);
61+#endif
62
63 newVec[0].iov_base = (unsigned char *) &log_id_buf;
64 newVec[0].iov_len = sizeof_log_id_t;
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch
deleted file mode 100644
index b0feb65921..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From cd4525d760c6f88c9bf85f7bf488da79cd0d3264 Mon Sep 17 00:00:00 2001
2From: Fathi Boudra <fabo@debian.org>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] Fix implicit declaration of stlcat/strlcopy functions
5
6Upstream-Status: Inappropriate
7---
8 adb/adb.c | 1 +
9 fs_mgr/fs_mgr_fstab.c | 2 +-
10 include/cutils/sockets.h | 2 +-
11 3 files changed, 3 insertions(+), 2 deletions(-)
12
13diff --git a/adb/adb.c b/adb/adb.c
14index e0f7ecde45..aaefd9b401 100644
15--- a/adb/adb.c
16+++ b/adb/adb.c
17@@ -41,6 +41,7 @@
18 #include <sys/prctl.h>
19 #include <getopt.h>
20 #include <selinux/selinux.h>
21+#include <grp.h>
22 #else
23 #include "usb_vendors.h"
24 #endif
25diff --git a/fs_mgr/fs_mgr_fstab.c b/fs_mgr/fs_mgr_fstab.c
26index edd9591164..9ddb4643b5 100644
27--- a/fs_mgr/fs_mgr_fstab.c
28+++ b/fs_mgr/fs_mgr_fstab.c
29@@ -17,7 +17,7 @@
30 #include <ctype.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33-#include <string.h>
34+#include <bsd/string.h>
35 #include <sys/mount.h>
36
37 #include "fs_mgr_priv.h"
38diff --git a/include/cutils/sockets.h b/include/cutils/sockets.h
39index daf43ec944..d3270c69e7 100644
40--- a/include/cutils/sockets.h
41+++ b/include/cutils/sockets.h
42@@ -19,7 +19,7 @@
43
44 #include <errno.h>
45 #include <stdlib.h>
46-#include <string.h>
47+#include <bsd/string.h>
48 #include <stdbool.h>
49
50 #ifdef HAVE_WINSOCK
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch
deleted file mode 100644
index 5138556d63..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0013-adb-Support-riscv64.patch
+++ /dev/null
@@ -1,191 +0,0 @@
1From 48ddf4fb999931942c359350fb31cd557514e1c6 Mon Sep 17 00:00:00 2001
2From: Chenxi Mao <maochenxi@eswin.com>
3Date: Mon, 20 Apr 2020 15:27:22 +0800
4Subject: [PATCH 1/1] adb: Support riscv64
5
6---
7Upstream-Status: Pending
8
9 include/cutils/atomic-inline.h | 2 +
10 include/cutils/atomic-riscv64.h | 156 ++++++++++++++++++++++++++++++++
11 2 files changed, 158 insertions(+)
12 create mode 100644 include/cutils/atomic-riscv64.h
13
14diff --git a/include/cutils/atomic-inline.h b/include/cutils/atomic-inline.h
15index a31e913579..b5dc38209c 100644
16--- a/include/cutils/atomic-inline.h
17+++ b/include/cutils/atomic-inline.h
18@@ -55,6 +55,8 @@ extern "C" {
19 #include <cutils/atomic-mips64.h>
20 #elif defined(__mips__)
21 #include <cutils/atomic-mips.h>
22+#elif defined(__riscv) && __riscv_xlen == 64
23+#include <cutils/atomic-riscv64.h>
24 #else
25 #error atomic operations are unsupported
26 #endif
27diff --git a/include/cutils/atomic-riscv64.h b/include/cutils/atomic-riscv64.h
28new file mode 100644
29index 0000000000..2664db5a86
30--- /dev/null
31+++ b/include/cutils/atomic-riscv64.h
32@@ -0,0 +1,156 @@
33+/*
34+ * Copyright (C) 2014 The Android Open Source Project
35+ * All rights reserved.
36+ *
37+ * Redistribution and use in source and binary forms, with or without
38+ * modification, are permitted provided that the following conditions
39+ * are met:
40+ * * Redistributions of source code must retain the above copyright
41+ * notice, this list of conditions and the following disclaimer.
42+ * * Redistributions in binary form must reproduce the above copyright
43+ * notice, this list of conditions and the following disclaimer in
44+ * the documentation and/or other materials provided with the
45+ * distribution.
46+ *
47+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
48+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
49+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
50+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
51+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
52+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
53+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
54+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
55+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
57+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58+ * SUCH DAMAGE.
59+ */
60+
61+#ifndef ANDROID_CUTILS_ATOMIC_RISCV64_H
62+#define ANDROID_CUTILS_ATOMIC_RISCV64_H
63+
64+#include <stdint.h>
65+
66+#ifndef ANDROID_ATOMIC_INLINE
67+#define ANDROID_ATOMIC_INLINE inline __attribute__((always_inline))
68+#endif
69+
70+/*
71+ TODOAArch64: Revisit the below functions and check for potential
72+ optimizations using assembly code or otherwise.
73+*/
74+
75+extern ANDROID_ATOMIC_INLINE
76+void android_compiler_barrier(void)
77+{
78+ __asm__ __volatile__ ("" : : : "memory");
79+}
80+
81+extern ANDROID_ATOMIC_INLINE
82+void android_memory_barrier(void)
83+{
84+ __asm__ __volatile__ ("fence rw,rw" : : : "memory");
85+}
86+
87+extern ANDROID_ATOMIC_INLINE
88+int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
89+{
90+ int32_t value = *ptr;
91+ android_memory_barrier();
92+ return value;
93+}
94+
95+extern ANDROID_ATOMIC_INLINE
96+int32_t android_atomic_release_load(volatile const int32_t *ptr)
97+{
98+ android_memory_barrier();
99+ return *ptr;
100+}
101+
102+extern ANDROID_ATOMIC_INLINE
103+void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
104+{
105+ *ptr = value;
106+ android_memory_barrier();
107+}
108+
109+extern ANDROID_ATOMIC_INLINE
110+void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
111+{
112+ android_memory_barrier();
113+ *ptr = value;
114+}
115+
116+extern ANDROID_ATOMIC_INLINE
117+int android_atomic_cas(int32_t old_value, int32_t new_value,
118+ volatile int32_t *ptr)
119+{
120+ return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value;
121+}
122+
123+extern ANDROID_ATOMIC_INLINE
124+int android_atomic_acquire_cas(int32_t old_value, int32_t new_value,
125+ volatile int32_t *ptr)
126+{
127+ int status = android_atomic_cas(old_value, new_value, ptr);
128+ android_memory_barrier();
129+ return status;
130+}
131+
132+extern ANDROID_ATOMIC_INLINE
133+int android_atomic_release_cas(int32_t old_value, int32_t new_value,
134+ volatile int32_t *ptr)
135+{
136+ android_memory_barrier();
137+ return android_atomic_cas(old_value, new_value, ptr);
138+}
139+
140+extern ANDROID_ATOMIC_INLINE
141+int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr)
142+{
143+ int32_t prev, status;
144+ android_memory_barrier();
145+ do {
146+ prev = *ptr;
147+ status = android_atomic_cas(prev, prev + increment, ptr);
148+ } while (__builtin_expect(status != 0, 0));
149+ return prev;
150+}
151+
152+extern ANDROID_ATOMIC_INLINE
153+int32_t android_atomic_inc(volatile int32_t *addr)
154+{
155+ return android_atomic_add(1, addr);
156+}
157+
158+extern ANDROID_ATOMIC_INLINE
159+int32_t android_atomic_dec(volatile int32_t *addr)
160+{
161+ return android_atomic_add(-1, addr);
162+}
163+
164+extern ANDROID_ATOMIC_INLINE
165+int32_t android_atomic_and(int32_t value, volatile int32_t *ptr)
166+{
167+ int32_t prev, status;
168+ android_memory_barrier();
169+ do {
170+ prev = *ptr;
171+ status = android_atomic_cas(prev, prev & value, ptr);
172+ } while (__builtin_expect(status != 0, 0));
173+ return prev;
174+}
175+
176+extern ANDROID_ATOMIC_INLINE
177+int32_t android_atomic_or(int32_t value, volatile int32_t *ptr)
178+{
179+ int32_t prev, status;
180+ android_memory_barrier();
181+ do {
182+ prev = *ptr;
183+ status = android_atomic_cas(prev, prev | value, ptr);
184+ } while (__builtin_expect(status != 0, 0));
185+ return prev;
186+}
187+
188+#endif /* ANDROID_CUTILS_ATOMIC_RISCV_H */
189--
1902.17.1
191
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0014-add-u3-ss-descriptor-support-for-adb.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0014-add-u3-ss-descriptor-support-for-adb.patch
deleted file mode 100644
index cf23f3c251..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0014-add-u3-ss-descriptor-support-for-adb.patch
+++ /dev/null
@@ -1,344 +0,0 @@
1From dae9a11f3a158357966399aef97c48b5f16934d9 Mon Sep 17 00:00:00 2001
2From: Jiacheng Liu <jiacheng.liu@mediatek.com>
3Date: Sat, 24 Jul 2021 11:01:18 +0800
4Subject: [PATCH] android-tools: adb: add u3 ss descriptor support
5
6Porting u3 Superspeed descriptor support to open-embedded android-tools package.
7This patch origins from the the patch in android project [1], but has been
8modified for backporting to android-tools_5.1.1.r37.
9
10[1] https://android.googlesource.com/platform/system/core/+/d6ee9f26a5163af4121f4380264fcbd4e6851a17%5E%21
11
12Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
13Signed-off-by: Jiacheng Liu <jiacheng.liu@mediatek.com>
14---
15Upstream-Status: Pending
16
17 adb/usb_linux_client.c | 275 +++++++++++++++++++++++++++++++----------
18 1 file changed, 207 insertions(+), 68 deletions(-)
19
20diff --git a/adb/usb_linux_client.c b/adb/usb_linux_client.c
21index 6e8b5bb..884e85e 100644
22--- a/adb/usb_linux_client.c
23+++ b/adb/usb_linux_client.c
24@@ -31,8 +31,10 @@
25 #define TRACE_TAG TRACE_USB
26 #include "adb.h"
27
28+#define USB_EXT_PROP_UNICODE 1
29 #define MAX_PACKET_SIZE_FS 64
30 #define MAX_PACKET_SIZE_HS 512
31+#define MAX_PACKET_SIZE_SS 1024
32
33 #if __BYTE_ORDER == __LITTLE_ENDIAN
34 # define cpu_to_le16(x) (x)
35@@ -62,74 +64,185 @@ struct usb_handle
36 int bulk_in; /* "in" from the host's perspective => sink for adbd */
37 };
38
39-static const struct {
40- struct usb_functionfs_descs_head header;
41- struct {
42- struct usb_interface_descriptor intf;
43- struct usb_endpoint_descriptor_no_audio source;
44- struct usb_endpoint_descriptor_no_audio sink;
45- } __attribute__((packed)) fs_descs, hs_descs;
46-} __attribute__((packed)) descriptors = {
47- .header = {
48- .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC),
49- .length = cpu_to_le32(sizeof(descriptors)),
50- .fs_count = 3,
51- .hs_count = 3,
52+struct func_desc {
53+ struct usb_interface_descriptor intf;
54+ struct usb_endpoint_descriptor_no_audio source;
55+ struct usb_endpoint_descriptor_no_audio sink;
56+} __attribute__((packed));
57+
58+struct ss_func_desc {
59+ struct usb_interface_descriptor intf;
60+ struct usb_endpoint_descriptor_no_audio source;
61+ struct usb_ss_ep_comp_descriptor source_comp;
62+ struct usb_endpoint_descriptor_no_audio sink;
63+ struct usb_ss_ep_comp_descriptor sink_comp;
64+} __attribute__((packed));
65+
66+struct desc_v1 {
67+ struct usb_functionfs_descs_head_v1 {
68+ __le32 magic;
69+ __le32 length;
70+ __le32 fs_count;
71+ __le32 hs_count;
72+ } __attribute__((packed)) header;
73+ struct func_desc fs_descs, hs_descs;
74+} __attribute__((packed));
75+
76+struct usb_os_desc_ext_prop {
77+ uint32_t dwSize;
78+ uint32_t dwPropertyDataType;
79+
80+ // Property name and value are transmitted as UTF-16, but the kernel only
81+ // accepts ASCII values and performs the conversion for us.
82+ uint16_t wPropertyNameLength;
83+ char bPropertyName[20];
84+
85+ uint32_t dwPropertyDataLength;
86+ char bProperty[39];
87+} __attribute__((packed)) os_desc_guid = {
88+ .dwSize = sizeof(struct usb_os_desc_ext_prop),
89+ .dwPropertyDataType = cpu_to_le32(USB_EXT_PROP_UNICODE),
90+ .wPropertyNameLength = cpu_to_le16(20),
91+ .bPropertyName = "DeviceInterfaceGUID",
92+ .dwPropertyDataLength = cpu_to_le32(39),
93+ .bProperty = "{F72FE0D4-CBCB-407D-8814-9ED673D0DD6B}",
94+};
95+
96+struct usb_ext_prop_values {
97+ struct usb_os_desc_ext_prop guid;
98+} __attribute__((packed));
99+
100+struct desc_v2 {
101+ struct usb_functionfs_descs_head_v2 header;
102+ // The rest of the structure depends on the flags in the header.
103+ __le32 fs_count;
104+ __le32 hs_count;
105+ __le32 ss_count;
106+ __le32 os_count;
107+ struct func_desc fs_descs, hs_descs;
108+ struct ss_func_desc ss_descs;
109+ struct usb_os_desc_header os_header;
110+ struct usb_ext_compat_desc os_desc;
111+ struct usb_os_desc_header os_prop_header;
112+ struct usb_ext_prop_values os_prop_values;
113+} __attribute__((packed));
114+
115+static struct func_desc fs_descriptors = {
116+ .intf = {
117+ .bLength = sizeof(fs_descriptors.intf),
118+ .bDescriptorType = USB_DT_INTERFACE,
119+ .bInterfaceNumber = 0,
120+ .bNumEndpoints = 2,
121+ .bInterfaceClass = ADB_CLASS,
122+ .bInterfaceSubClass = ADB_SUBCLASS,
123+ .bInterfaceProtocol = ADB_PROTOCOL,
124+ .iInterface = 1, /* first string from the provided table */
125+ },
126+ .source = {
127+ .bLength = sizeof(fs_descriptors.source),
128+ .bDescriptorType = USB_DT_ENDPOINT,
129+ .bEndpointAddress = 1 | USB_DIR_OUT,
130+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
131+ .wMaxPacketSize = MAX_PACKET_SIZE_FS,
132+ },
133+ .sink = {
134+ .bLength = sizeof(fs_descriptors.sink),
135+ .bDescriptorType = USB_DT_ENDPOINT,
136+ .bEndpointAddress = 2 | USB_DIR_IN,
137+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
138+ .wMaxPacketSize = MAX_PACKET_SIZE_FS,
139+ },
140+};
141+
142+static struct func_desc hs_descriptors = {
143+ .intf = {
144+ .bLength = sizeof(hs_descriptors.intf),
145+ .bDescriptorType = USB_DT_INTERFACE,
146+ .bInterfaceNumber = 0,
147+ .bNumEndpoints = 2,
148+ .bInterfaceClass = ADB_CLASS,
149+ .bInterfaceSubClass = ADB_SUBCLASS,
150+ .bInterfaceProtocol = ADB_PROTOCOL,
151+ .iInterface = 1, /* first string from the provided table */
152+ },
153+ .source = {
154+ .bLength = sizeof(hs_descriptors.source),
155+ .bDescriptorType = USB_DT_ENDPOINT,
156+ .bEndpointAddress = 1 | USB_DIR_OUT,
157+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
158+ .wMaxPacketSize = MAX_PACKET_SIZE_HS,
159+ },
160+ .sink = {
161+ .bLength = sizeof(hs_descriptors.sink),
162+ .bDescriptorType = USB_DT_ENDPOINT,
163+ .bEndpointAddress = 2 | USB_DIR_IN,
164+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
165+ .wMaxPacketSize = MAX_PACKET_SIZE_HS,
166+ },
167+};
168+
169+static struct ss_func_desc ss_descriptors = {
170+ .intf = {
171+ .bLength = sizeof(ss_descriptors.intf),
172+ .bDescriptorType = USB_DT_INTERFACE,
173+ .bInterfaceNumber = 0,
174+ .bNumEndpoints = 2,
175+ .bInterfaceClass = ADB_CLASS,
176+ .bInterfaceSubClass = ADB_SUBCLASS,
177+ .bInterfaceProtocol = ADB_PROTOCOL,
178+ .iInterface = 1, /* first string from the provided table */
179+ },
180+ .source = {
181+ .bLength = sizeof(ss_descriptors.source),
182+ .bDescriptorType = USB_DT_ENDPOINT,
183+ .bEndpointAddress = 1 | USB_DIR_OUT,
184+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
185+ .wMaxPacketSize = MAX_PACKET_SIZE_SS,
186+ },
187+ .source_comp = {
188+ .bLength = sizeof(ss_descriptors.source_comp),
189+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
190+ .bMaxBurst = 4,
191 },
192- .fs_descs = {
193- .intf = {
194- .bLength = sizeof(descriptors.fs_descs.intf),
195- .bDescriptorType = USB_DT_INTERFACE,
196- .bInterfaceNumber = 0,
197- .bNumEndpoints = 2,
198- .bInterfaceClass = ADB_CLASS,
199- .bInterfaceSubClass = ADB_SUBCLASS,
200- .bInterfaceProtocol = ADB_PROTOCOL,
201- .iInterface = 1, /* first string from the provided table */
202- },
203- .source = {
204- .bLength = sizeof(descriptors.fs_descs.source),
205- .bDescriptorType = USB_DT_ENDPOINT,
206- .bEndpointAddress = 1 | USB_DIR_OUT,
207- .bmAttributes = USB_ENDPOINT_XFER_BULK,
208- .wMaxPacketSize = MAX_PACKET_SIZE_FS,
209- },
210- .sink = {
211- .bLength = sizeof(descriptors.fs_descs.sink),
212- .bDescriptorType = USB_DT_ENDPOINT,
213- .bEndpointAddress = 2 | USB_DIR_IN,
214- .bmAttributes = USB_ENDPOINT_XFER_BULK,
215- .wMaxPacketSize = MAX_PACKET_SIZE_FS,
216- },
217+ .sink = {
218+ .bLength = sizeof(ss_descriptors.sink),
219+ .bDescriptorType = USB_DT_ENDPOINT,
220+ .bEndpointAddress = 2 | USB_DIR_IN,
221+ .bmAttributes = USB_ENDPOINT_XFER_BULK,
222+ .wMaxPacketSize = MAX_PACKET_SIZE_SS,
223 },
224- .hs_descs = {
225- .intf = {
226- .bLength = sizeof(descriptors.hs_descs.intf),
227- .bDescriptorType = USB_DT_INTERFACE,
228- .bInterfaceNumber = 0,
229- .bNumEndpoints = 2,
230- .bInterfaceClass = ADB_CLASS,
231- .bInterfaceSubClass = ADB_SUBCLASS,
232- .bInterfaceProtocol = ADB_PROTOCOL,
233- .iInterface = 1, /* first string from the provided table */
234- },
235- .source = {
236- .bLength = sizeof(descriptors.hs_descs.source),
237- .bDescriptorType = USB_DT_ENDPOINT,
238- .bEndpointAddress = 1 | USB_DIR_OUT,
239- .bmAttributes = USB_ENDPOINT_XFER_BULK,
240- .wMaxPacketSize = MAX_PACKET_SIZE_HS,
241- },
242- .sink = {
243- .bLength = sizeof(descriptors.hs_descs.sink),
244- .bDescriptorType = USB_DT_ENDPOINT,
245- .bEndpointAddress = 2 | USB_DIR_IN,
246- .bmAttributes = USB_ENDPOINT_XFER_BULK,
247- .wMaxPacketSize = MAX_PACKET_SIZE_HS,
248- },
249+ .sink_comp = {
250+ .bLength = sizeof(ss_descriptors.sink_comp),
251+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
252+ .bMaxBurst = 4,
253 },
254 };
255
256+struct usb_ext_compat_desc os_desc_compat = {
257+ .bFirstInterfaceNumber = 0,
258+ .Reserved1 = cpu_to_le32(1),
259+ .CompatibleID = { 'W', 'I', 'N', 'U', 'S', 'B', '\0', '\0'},
260+ .SubCompatibleID = {0},
261+ .Reserved2 = {0},
262+};
263+
264+static struct usb_os_desc_header os_desc_header = {
265+ .interface = cpu_to_le32(0),
266+ .dwLength = cpu_to_le32(sizeof(os_desc_header) + sizeof(os_desc_compat)),
267+ .bcdVersion = cpu_to_le32(1),
268+ .wIndex = cpu_to_le32(4),
269+ .bCount = cpu_to_le32(1),
270+ .Reserved = cpu_to_le32(0),
271+};
272+
273+static struct usb_os_desc_header os_prop_header = {
274+ .interface = cpu_to_le32(0),
275+ .dwLength = cpu_to_le32(sizeof(os_desc_header) + sizeof(struct usb_ext_prop_values)),
276+ .bcdVersion = cpu_to_le32(1),
277+ .wIndex = cpu_to_le32(5),
278+ .wCount = cpu_to_le16(1),
279+};
280+
281 #define STR_INTERFACE_ "ADB Interface"
282
283 static const struct {
284@@ -151,8 +264,6 @@ static const struct {
285 },
286 };
287
288-
289-
290 static void *usb_adb_open_thread(void *x)
291 {
292 struct usb_handle *usb = (struct usb_handle *)x;
293@@ -270,6 +381,24 @@ static void usb_adb_init()
294 static void init_functionfs(struct usb_handle *h)
295 {
296 ssize_t ret;
297+ struct desc_v1 v1_descriptor = {};
298+ struct desc_v2 v2_descriptor = {};
299+
300+ v2_descriptor.header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2);
301+ v2_descriptor.header.length = cpu_to_le32(sizeof(v2_descriptor));
302+ v2_descriptor.header.flags = FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC |
303+ FUNCTIONFS_HAS_SS_DESC | FUNCTIONFS_HAS_MS_OS_DESC;
304+ v2_descriptor.fs_count = 3;
305+ v2_descriptor.hs_count = 3;
306+ v2_descriptor.ss_count = 5;
307+ v2_descriptor.os_count = 2;
308+ v2_descriptor.fs_descs = fs_descriptors;
309+ v2_descriptor.hs_descs = hs_descriptors;
310+ v2_descriptor.ss_descs = ss_descriptors;
311+ v2_descriptor.os_header = os_desc_header;
312+ v2_descriptor.os_desc = os_desc_compat;
313+ v2_descriptor.os_prop_header = os_prop_header;
314+ v2_descriptor.os_prop_values.guid = os_desc_guid;
315
316 if (h->control < 0) { // might have already done this before
317 D("OPENING %s\n", USB_FFS_ADB_EP0);
318@@ -279,10 +408,20 @@ static void init_functionfs(struct usb_handle *h)
319 goto err;
320 }
321
322- ret = adb_write(h->control, &descriptors, sizeof(descriptors));
323+ ret = adb_write(h->control, &v2_descriptor, sizeof(v2_descriptor));
324 if (ret < 0) {
325- D("[ %s: write descriptors failed: errno=%d ]\n", USB_FFS_ADB_EP0, errno);
326- goto err;
327+ D("[ %s: write v2_descriptor failed: errno=%d ]\n", USB_FFS_ADB_EP0, errno);
328+ v1_descriptor.header.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC);
329+ v1_descriptor.header.length = cpu_to_le32(sizeof(v1_descriptor));
330+ v1_descriptor.header.fs_count = 3;
331+ v1_descriptor.header.hs_count = 3;
332+ v1_descriptor.fs_descs = fs_descriptors;
333+ v1_descriptor.hs_descs = hs_descriptors;
334+ ret = adb_write(h->control, &v1_descriptor, sizeof(v1_descriptor));
335+ if (ret < 0) {
336+ D("[ %s: failed to write USB descriptors]\n", USB_FFS_ADB_EP0);
337+ goto err;
338+ }
339 }
340
341 ret = adb_write(h->control, &strings, sizeof(strings));
342--
3432.18.0
344
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0015-libsparse-Split-off-most-of-sparse_file_read_normal-.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0015-libsparse-Split-off-most-of-sparse_file_read_normal-.patch
deleted file mode 100644
index 5009c73a05..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0015-libsparse-Split-off-most-of-sparse_file_read_normal-.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1From 7b74d23ed955206a789a96bdc3288593e702afac Mon Sep 17 00:00:00 2001
2From: Sean Anderson <sean.anderson@seco.com>
3Date: Thu, 30 Dec 2021 15:16:08 -0500
4Subject: [PATCH] libsparse: Split off most of sparse_file_read_normal into a
5 helper function
6
7This carves out the core of sparse_file_read_normal and splits it off so
8it can be reused in the next patch. No functional change intended.
9
10Change-Id: Id00491fd7e5bb6fa28c517a0bb32b8b506539d4d
11Upstream-Status: Backport [95657f3e5976d96073f7bbfe3a49192509999d1d]
12Signed-off-by: Sean Anderson <sean.anderson@seco.com>
13---
14 libsparse/sparse_read.c | 21 ++++++++++++++++-----
15 1 file changed, 16 insertions(+), 5 deletions(-)
16
17diff --git a/libsparse/sparse_read.c b/libsparse/sparse_read.c
18index 8e188e9a4..ee4abd86a 100644
19--- a/libsparse/sparse_read.c
20+++ b/libsparse/sparse_read.c
21@@ -353,13 +353,11 @@ static int sparse_file_read_sparse(struct sparse_file *s, int fd, bool crc)
22 return 0;
23 }
24
25-static int sparse_file_read_normal(struct sparse_file *s, int fd)
26+static int do_sparse_file_read_normal(struct sparse_file *s, int fd, uint32_t* buf, int64_t offset,
27+ int64_t remain)
28 {
29 int ret;
30- uint32_t *buf = malloc(s->block_size);
31- unsigned int block = 0;
32- int64_t remain = s->len;
33- int64_t offset = 0;
34+ unsigned int block = offset / s->block_size;
35 unsigned int to_read;
36 unsigned int i;
37 bool sparse_block;
38@@ -403,6 +401,19 @@ static int sparse_file_read_normal(struct sparse_file *s, int fd)
39 return 0;
40 }
41
42+static int sparse_file_read_normal(struct sparse_file* s, int fd)
43+{
44+ int ret;
45+ uint32_t* buf = (uint32_t*)malloc(s->block_size);
46+
47+ if (!buf)
48+ return -ENOMEM;
49+
50+ ret = do_sparse_file_read_normal(s, fd, buf, 0, s->len);
51+ free(buf);
52+ return ret;
53+}
54+
55 int sparse_file_read(struct sparse_file *s, int fd, bool sparse, bool crc)
56 {
57 if (crc && !sparse) {
58--
592.35.1.1320.gc452695387.dirty
60
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0016-libsparse-Add-hole-mode-to-sparse_file_read.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0016-libsparse-Add-hole-mode-to-sparse_file_read.patch
deleted file mode 100644
index e5221d2b4c..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0016-libsparse-Add-hole-mode-to-sparse_file_read.patch
+++ /dev/null
@@ -1,188 +0,0 @@
1From 41574b628ec4229c24dfe289af7b6978edcca4ed Mon Sep 17 00:00:00 2001
2From: Sean Anderson <sean.anderson@seco.com>
3Date: Thu, 30 Dec 2021 15:19:41 -0500
4Subject: [PATCH] libsparse: Add "hole" mode to sparse_file_read
5
6This adds support for filesystem-level sparse files. These files have
7holes which are not stored in the filesystem and when read are full of
8zeros. While these zeros may be significant in some types of files,
9other types of files may not care about the contents of holes. For
10example, most filesystem creation tools write to all the blocks they
11care about. Those blocks not written to will remain holes, and can be
12safely represented by "don't care" chunks. Using "don't care" chunks
13instead of fill chunks can result in a substantial reduction of the time
14it takes to program a sparse image.
15
16To accomplish this, we extend the existing "sparse" boolean parameter to
17be an enum of mode types. This enum represents the strategy we take when
18reading in a file. For the most part the implementation is
19straightforward. We use lseek to determine where the holes in the file
20are, and then use do_sparse_file_read_normal to create chunks for the
21data section. Note that every file has an implicit hole at its end.
22
23Change-Id: I0cfbf08886fca9a91cb753ec8734c84fcbe52c9f
24Upstream-Status: Backport [f96466b05543b984ef7315d830bab4a409228d35]
25Signed-off-by: Sean Anderson <sean.anderson@seco.com>
26---
27 libsparse/img2simg.c | 2 +-
28 libsparse/include/sparse/sparse.h | 32 +++++++++++---
29 libsparse/sparse_read.c | 71 +++++++++++++++++++++++++++++--
30 3 files changed, 93 insertions(+), 12 deletions(-)
31
32diff --git a/libsparse/img2simg.c b/libsparse/img2simg.c
33index a0db36f45..2e171b613 100644
34--- a/libsparse/img2simg.c
35+++ b/libsparse/img2simg.c
36@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
37 }
38
39 sparse_file_verbose(s);
40- ret = sparse_file_read(s, in, false, false);
41+ ret = sparse_file_read(s, in, SPARSE_READ_MODE_NORMAL, false);
42 if (ret) {
43 fprintf(stderr, "Failed to read file\n");
44 exit(-1);
45diff --git a/libsparse/include/sparse/sparse.h b/libsparse/include/sparse/sparse.h
46index 8b757d22a..b68aa21a8 100644
47--- a/libsparse/include/sparse/sparse.h
48+++ b/libsparse/include/sparse/sparse.h
49@@ -196,23 +196,41 @@ int64_t sparse_file_len(struct sparse_file *s, bool sparse, bool crc);
50 int sparse_file_callback(struct sparse_file *s, bool sparse, bool crc,
51 int (*write)(void *priv, const void *data, int len), void *priv);
52
53+/**
54+ * enum sparse_read_mode - The method to use when reading in files
55+ * @SPARSE_READ_MODE_NORMAL: The input is a regular file. Constant chunks of
56+ * data (including holes) will be be converted to
57+ * fill chunks.
58+ * @SPARSE_READ_MODE_SPARSE: The input is an Android sparse file.
59+ * @SPARSE_READ_MODE_HOLE: The input is a regular file. Holes will be converted
60+ * to "don't care" chunks. Other constant chunks will
61+ * be converted to fill chunks.
62+ */
63+enum sparse_read_mode {
64+ SPARSE_READ_MODE_NORMAL = false,
65+ SPARSE_READ_MODE_SPARSE = true,
66+ SPARSE_READ_MODE_HOLE,
67+};
68+
69 /**
70 * sparse_file_read - read a file into a sparse file cookie
71 *
72 * @s - sparse file cookie
73 * @fd - file descriptor to read from
74- * @sparse - read a file in the Android sparse file format
75+ * @mode - mode to use when reading the input file
76 * @crc - verify the crc of a file in the Android sparse file format
77 *
78- * Reads a file into a sparse file cookie. If sparse is true, the file is
79- * assumed to be in the Android sparse file format. If sparse is false, the
80- * file will be sparsed by looking for block aligned chunks of all zeros or
81- * another 32 bit value. If crc is true, the crc of the sparse file will be
82- * verified.
83+ * Reads a file into a sparse file cookie. If @mode is
84+ * %SPARSE_READ_MODE_SPARSE, the file is assumed to be in the Android sparse
85+ * file format. If @mode is %SPARSE_READ_MODE_NORMAL, the file will be sparsed
86+ * by looking for block aligned chunks of all zeros or another 32 bit value. If
87+ * @mode is %SPARSE_READ_MODE_HOLE, the file will be sparsed like
88+ * %SPARSE_READ_MODE_NORMAL, but holes in the file will be converted to "don't
89+ * care" chunks. If crc is true, the crc of the sparse file will be verified.
90 *
91 * Returns 0 on success, negative errno on error.
92 */
93-int sparse_file_read(struct sparse_file *s, int fd, bool sparse, bool crc);
94+int sparse_file_read(struct sparse_file *s, int fd, enum sparse_read_mode mode, bool crc);
95
96 /**
97 * sparse_file_import - import an existing sparse file
98diff --git a/libsparse/sparse_read.c b/libsparse/sparse_read.c
99index ee4abd86a..81f48cc13 100644
100--- a/libsparse/sparse_read.c
101+++ b/libsparse/sparse_read.c
102@@ -414,16 +414,79 @@ static int sparse_file_read_normal(struct sparse_file* s, int fd)
103 return ret;
104 }
105
106-int sparse_file_read(struct sparse_file *s, int fd, bool sparse, bool crc)
107+#ifdef __linux__
108+static int sparse_file_read_hole(struct sparse_file* s, int fd)
109 {
110- if (crc && !sparse) {
111+ int ret;
112+ uint32_t* buf = (uint32_t*)malloc(s->block_size);
113+ int64_t end = 0;
114+ int64_t start = 0;
115+
116+ if (!buf) {
117+ return -ENOMEM;
118+ }
119+
120+ do {
121+ start = lseek(fd, end, SEEK_DATA);
122+ if (start < 0) {
123+ if (errno == ENXIO)
124+ /* The rest of the file is a hole */
125+ break;
126+
127+ error("could not seek to data");
128+ free(buf);
129+ return -errno;
130+ } else if (start > s->len) {
131+ break;
132+ }
133+
134+ end = lseek(fd, start, SEEK_HOLE);
135+ if (end < 0) {
136+ error("could not seek to end");
137+ free(buf);
138+ return -errno;
139+ }
140+ end = min(end, s->len);
141+
142+ start = ALIGN_DOWN(start, s->block_size);
143+ end = ALIGN(end, s->block_size);
144+ if (lseek(fd, start, SEEK_SET) < 0) {
145+ free(buf);
146+ return -errno;
147+ }
148+
149+ ret = do_sparse_file_read_normal(s, fd, buf, start, end - start);
150+ if (ret) {
151+ free(buf);
152+ return ret;
153+ }
154+ } while (end < s->len);
155+
156+ free(buf);
157+ return 0;
158+}
159+#else
160+static int sparse_file_read_hole(struct sparse_file* s __unused, int fd __unused)
161+{
162+ return -ENOTSUP;
163+}
164+#endif
165+
166+int sparse_file_read(struct sparse_file *s, int fd, enum sparse_read_mode mode, bool crc)
167+{
168+ if (crc && mode != SPARSE_READ_MODE_SPARSE) {
169 return -EINVAL;
170 }
171
172- if (sparse) {
173+ switch (mode) {
174+ case SPARSE_READ_MODE_SPARSE:
175 return sparse_file_read_sparse(s, fd, crc);
176- } else {
177+ case SPARSE_READ_MODE_NORMAL:
178 return sparse_file_read_normal(s, fd);
179+ case SPARSE_READ_MODE_HOLE:
180+ return sparse_file_read_hole(s, fd);
181+ default:
182+ return -EINVAL;
183 }
184 }
185
186--
1872.35.1.1320.gc452695387.dirty
188
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/0017-img2simg-Add-support-for-converting-holes-to-don-t-c.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/0017-img2simg-Add-support-for-converting-holes-to-don-t-c.patch
deleted file mode 100644
index 9d19f58095..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/0017-img2simg-Add-support-for-converting-holes-to-don-t-c.patch
+++ /dev/null
@@ -1,114 +0,0 @@
1From 00cce57eff1a0de3b93efa5da225e9eb33d19659 Mon Sep 17 00:00:00 2001
2From: Sean Anderson <sean.anderson@seco.com>
3Date: Thu, 30 Dec 2021 15:34:28 -0500
4Subject: [PATCH] img2simg: Add support for converting holes to "don't care"
5 chunks
6
7This adds support for converting files with holes to "don't care"
8chunks. This can result in a substantial reduction in the time it takes
9to program an image if it has many holes.
10
11Generally, constants compared to argc have been reduced by one, since we
12no longer have the program name as the first argument.
13
14Change-Id: I00750edc07d6415dcc07ae0351e9397b0222b7ba
15Upstream-Status: Backport [6150b00b6025918da8c28e5c2f929ecdf480a9d6]
16Signed-off-by: Sean Anderson <sean.anderson@seco.com>
17---
18 libsparse/img2simg.c | 41 ++++++++++++++++++++++++++++++-----------
19 1 file changed, 30 insertions(+), 11 deletions(-)
20
21diff --git a/libsparse/img2simg.c b/libsparse/img2simg.c
22index 2e171b613..c985d5449 100644
23--- a/libsparse/img2simg.c
24+++ b/libsparse/img2simg.c
25@@ -40,25 +40,42 @@
26
27 void usage()
28 {
29- fprintf(stderr, "Usage: img2simg <raw_image_file> <sparse_image_file> [<block_size>]\n");
30+ fprintf(stderr, "Usage: img2simg [-s] <raw_image_file> <sparse_image_file> [<block_size>]\n");
31 }
32
33 int main(int argc, char *argv[])
34 {
35+ char *arg_in;
36+ char *arg_out;
37+ enum sparse_read_mode mode = SPARSE_READ_MODE_NORMAL;
38+ int extra;
39 int in;
40+ int opt;
41 int out;
42 int ret;
43 struct sparse_file *s;
44 unsigned int block_size = 4096;
45 off64_t len;
46
47- if (argc < 3 || argc > 4) {
48+ while ((opt = getopt(argc, argv, "s")) != -1) {
49+ switch (opt) {
50+ case 's':
51+ mode = SPARSE_READ_MODE_HOLE;
52+ break;
53+ default:
54+ usage();
55+ exit(-1);
56+ }
57+ }
58+
59+ extra = argc - optind;
60+ if (extra < 2 || extra > 3) {
61 usage();
62 exit(-1);
63 }
64
65- if (argc == 4) {
66- block_size = atoi(argv[3]);
67+ if (extra == 3) {
68+ block_size = atoi(argv[optind + 2]);
69 }
70
71 if (block_size < 1024 || block_size % 4 != 0) {
72@@ -66,22 +83,24 @@ int main(int argc, char *argv[])
73 exit(-1);
74 }
75
76- if (strcmp(argv[1], "-") == 0) {
77+ arg_in = argv[optind];
78+ if (strcmp(arg_in, "-") == 0) {
79 in = STDIN_FILENO;
80 } else {
81- in = open(argv[1], O_RDONLY | O_BINARY);
82+ in = open(arg_in, O_RDONLY | O_BINARY);
83 if (in < 0) {
84- fprintf(stderr, "Cannot open input file %s\n", argv[1]);
85+ fprintf(stderr, "Cannot open input file %s\n", arg_in);
86 exit(-1);
87 }
88 }
89
90- if (strcmp(argv[2], "-") == 0) {
91+ arg_out = argv[optind + 1];
92+ if (strcmp(arg_out, "-") == 0) {
93 out = STDOUT_FILENO;
94 } else {
95- out = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0664);
96+ out = open(arg_out, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0664);
97 if (out < 0) {
98- fprintf(stderr, "Cannot open output file %s\n", argv[2]);
99+ fprintf(stderr, "Cannot open output file %s\n", arg_out);
100 exit(-1);
101 }
102 }
103@@ -96,7 +115,7 @@ int main(int argc, char *argv[])
104 }
105
106 sparse_file_verbose(s);
107- ret = sparse_file_read(s, in, SPARSE_READ_MODE_NORMAL, false);
108+ ret = sparse_file_read(s, in, mode, false);
109 if (ret) {
110 fprintf(stderr, "Failed to read file\n");
111 exit(-1);
112--
1132.35.1.1320.gc452695387.dirty
114
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff b/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff
deleted file mode 100644
index ddb41ea4b0..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/adb_libssl_11.diff
+++ /dev/null
@@ -1,48 +0,0 @@
1Description: adb: Make compatible with openssl 1.1
2 OpenSSL version 1.1 brought some API changes which broke the build here,
3 fix that by accessing rsa->n (and e) directly, using RSA_get0_key instead.
4Author: Chirayu Desai <chirayudesai1@gmail.com
5Last-Update: 2016-11-10
6---
7Upstream-Status: Pending
8
9This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
10---
11Upstream-Status: Pending
12
13 system/core/adb/adb_auth_host.c | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16--- a/adb/adb_auth_host.c
17+++ b/adb/adb_auth_host.c
18@@ -75,6 +75,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
19 BIGNUM* rem = BN_new();
20- BIGNUM* n = BN_new();
21+ const BIGNUM* n;
22 BIGNUM* n0inv = BN_new();
23+ const BIGNUM* e;
24
25 if (RSA_size(rsa) != RSANUMBYTES) {
26 ret = 0;
27@@ -82,7 +83,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
28 }
29
30 BN_set_bit(r32, 32);
31- BN_copy(n, rsa->n);
32+ RSA_get0_key(rsa, &n, &e, NULL);
33 BN_set_bit(r, RSANUMWORDS * 32);
34 BN_mod_sqr(rr, r, n, ctx);
35 BN_div(NULL, rem, n, r32, ctx);
36@@ -96,11 +97,10 @@ static int RSA_to_RSAPublicKey(RSA *rsa,
37 BN_div(n, rem, n, r32, ctx);
38 pkey->n[i] = BN_get_word(rem);
39 }
40- pkey->exponent = BN_get_word(rsa->e);
41+ pkey->exponent = BN_get_word(e);
42
43 out:
44 BN_free(n0inv);
45- BN_free(n);
46 BN_free(rem);
47 BN_free(r);
48 BN_free(rr);
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/core/b64_pton_function_decl.patch b/meta-oe/recipes-devtools/android-tools/android-tools/core/b64_pton_function_decl.patch
deleted file mode 100644
index 80410f1d2b..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/core/b64_pton_function_decl.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1Add protoype declaration for b64_pton
2
3Upstream-Status: Pending
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5--- a/adb/adb_auth_client.c
6+++ b/adb/adb_auth_client.c
7@@ -29,6 +29,7 @@
8
9 #define TRACE_TAG TRACE_AUTH
10
11+extern int b64_pton(const char* src, uint8_t* target, size_t targsize);
12
13 struct adb_public_key {
14 struct listnode node;
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
deleted file mode 100644
index c18aa9c4d2..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/ext4_utils.mk
+++ /dev/null
@@ -1,103 +0,0 @@
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/extras/0001-ext4_utils-remove-selinux-extensions.patch b/meta-oe/recipes-devtools/android-tools/android-tools/extras/0001-ext4_utils-remove-selinux-extensions.patch
deleted file mode 100644
index 4a19a5d65a..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/extras/0001-ext4_utils-remove-selinux-extensions.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 354604da9d152f1931e91991d3f34197fc8fc759 Mon Sep 17 00:00:00 2001
2From: Sergio Schvezov <sergio.schvezov@canonical.com>
3Date: Tue, 2 Oct 2018 16:36:54 +0000
4Subject: [PATCH] ext4_utils: remove selinux extensions
5
6* drop useless includes of Android SELINUX extensions
7* avoids having to clone another module
8* this should be sent upstream
9
10Upstream-Status: Inappropriate
11---
12 ext4_utils/make_ext4fs.c | 1 -
13 ext4_utils/make_ext4fs_main.c | 1 -
14 2 files changed, 2 deletions(-)
15
16diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
17index 2f89ae8a0..732afbed7 100644
18--- a/ext4_utils/make_ext4fs.c
19+++ b/ext4_utils/make_ext4fs.c
20@@ -62,7 +62,6 @@
21
22 #include <selinux/selinux.h>
23 #include <selinux/label.h>
24-#include <selinux/android.h>
25
26 #define O_BINARY 0
27
28diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
29index a6c5f6160..f8e7b9da9 100644
30--- a/ext4_utils/make_ext4fs_main.c
31+++ b/ext4_utils/make_ext4fs_main.c
32@@ -32,7 +32,6 @@
33 #ifndef USE_MINGW
34 #include <selinux/selinux.h>
35 #include <selinux/label.h>
36-#include <selinux/android.h>
37 #else
38 struct selabel_handle;
39 #endif
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch b/meta-oe/recipes-devtools/android-tools/android-tools/extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch
deleted file mode 100644
index 3b50ffbf36..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch
+++ /dev/null
@@ -1,78 +0,0 @@
1From b9254539811ce912bfd16dd1d185eba7a10cceff Mon Sep 17 00:00:00 2001
2From: Markus Mayer <mmayer@mmayer.net>
3Date: Wed, 7 Sep 2016 12:58:47 +0300
4Subject: [PATCH] ext4_utils: add -o argument to preserve ownership
5
6See also https://android-review.googlesource.com/#/c/100312/
7
8Upstream-Status: Inappropriate
9---
10 ext4_utils/make_ext4fs.c | 6 ++++++
11 ext4_utils/make_ext4fs_main.c | 10 ++++++++--
12 2 files changed, 14 insertions(+), 2 deletions(-)
13
14diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
15index 732afbed7..2cbf04399 100644
16--- a/ext4_utils/make_ext4fs.c
17+++ b/ext4_utils/make_ext4fs.c
18@@ -67,6 +67,8 @@
19
20 #endif
21
22+int preserve_owner = 0;
23+
24 /* TODO: Not implemented:
25 Allocating blocks in the same block group as the file inode
26 Hash or binary tree directories
27@@ -185,6 +187,10 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
28 } else {
29 dentries[i].mtime = fixed_time;
30 }
31+ if (preserve_owner) {
32+ dentries[i].uid = stat.st_uid;
33+ dentries[i].gid = stat.st_gid;
34+ }
35 uint64_t capabilities;
36 if (fs_config_func != NULL) {
37 #ifdef ANDROID
38diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
39index f8e7b9da9..e82d43277 100644
40--- a/ext4_utils/make_ext4fs_main.c
41+++ b/ext4_utils/make_ext4fs_main.c
42@@ -47,13 +47,15 @@ struct selabel_handle;
43 extern struct fs_info info;
44
45
46+extern int preserve_owner;
47+
48 static void usage(char *path)
49 {
50 fprintf(stderr, "%s [ -l <len> ] [ -j <journal size> ] [ -b <block_size> ]\n", basename(path));
51 fprintf(stderr, " [ -g <blocks per group> ] [ -i <inodes> ] [ -I <inode size> ]\n");
52 fprintf(stderr, " [ -L <label> ] [ -f ] [ -a <android mountpoint> ]\n");
53 fprintf(stderr, " [ -S file_contexts ] [ -C fs_config ] [ -T timestamp ]\n");
54- fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -v ] [ -B <block_list_file> ]\n");
55+ fprintf(stderr, " [ -z | -s ] [ -w ] [ -c ] [ -J ] [ -o ] [ -v ] [ -B <block_list_file> ]\n");
56 fprintf(stderr, " <filename> [<directory>]\n");
57 }
58
59@@ -79,7 +81,7 @@ int main(int argc, char **argv)
60 struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } };
61 #endif
62
63- while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctv")) != -1) {
64+ while ((opt = getopt(argc, argv, "l:j:b:g:i:I:L:a:S:T:C:B:fwzJsctov")) != -1) {
65 switch (opt) {
66 case 'l':
67 info.len = parse_num(optarg);
68@@ -142,6 +144,10 @@ int main(int argc, char **argv)
69 }
70 #endif
71 break;
72+ case 'o':
73+ preserve_owner = 1;
74+ printf("Warning: Enabling 'preserve ownership', this is an unofficial feature!\n");
75+ break;
76 case 'v':
77 verbose = 1;
78 break;
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/extras/0003-ext4_utils-drop-unused-parameter-from-allocate_inode.patch b/meta-oe/recipes-devtools/android-tools/android-tools/extras/0003-ext4_utils-drop-unused-parameter-from-allocate_inode.patch
deleted file mode 100644
index b77c0ebc13..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/extras/0003-ext4_utils-drop-unused-parameter-from-allocate_inode.patch
+++ /dev/null
@@ -1,69 +0,0 @@
1From c9f8cb184a7218c97ff966db44da6dd814c0e273 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@gmail.com>
3Date: Fri, 21 Mar 2025 09:49:32 +0000
4Subject: [PATCH] ext4_utils: drop unused parameter from allocate_inode()
5
6* fixes build with gcc-15:
7 http://errors.yoctoproject.org/Errors/Details/848455/
8
9TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c: In function 'make_directory':
10TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c:115:29: error: too many arguments to function 'allocate_inode'; expected 0, have 1
11 115 | inode_num = allocate_inode(info);
12 | ^~~~~~~~~~~~~~ ~~~~
13In file included from TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c:32:
14TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/allocate.h:61:5: note: declared here
15 61 | u32 allocate_inode();
16 | ^~~~~~~~~~~~~~
17TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c: In function 'make_file':
18TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c:183:21: error: too many arguments to function 'allocate_inode'; expected 0, have 1
19 183 | inode_num = allocate_inode(info);
20 | ^~~~~~~~~~~~~~ ~~~~
21TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/allocate.h:61:5: note: declared here
22 61 | u32 allocate_inode();
23 | ^~~~~~~~~~~~~~
24TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c: In function 'make_link':
25TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/contents.c:218:21: error: too many arguments to function 'allocate_inode'; expected 0, have 1
26 218 | inode_num = allocate_inode(info);
27 | ^~~~~~~~~~~~~~ ~~~~
28TOPDIR/tmp/work/core2-64-oe-linux/android-tools/5.1.1.r37/git/system/extras/ext4_utils/allocate.h:61:5: note: declared here
29 61 | u32 allocate_inode();
30 | ^~~~~~~~~~~~~~
31make: *** [<builtin>: contents.o] Error 1
32
33Upstream-Status: Pending [this whole code was removed in newer version android-9.0.0_r1 https://android.googlesource.com/platform/system/extras/+/7a837fcd6e9c0e0219f743052c78cc1c5988dfaf]
34Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
35---
36 ext4_utils/contents.c | 6 +++---
37 1 file changed, 3 insertions(+), 3 deletions(-)
38
39diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
40index 3144de93f..ac1b71706 100644
41--- a/ext4_utils/contents.c
42+++ b/ext4_utils/contents.c
43@@ -112,7 +112,7 @@ u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
44 len = blocks * info.block_size;
45
46 if (dir_inode_num) {
47- inode_num = allocate_inode(info);
48+ inode_num = allocate_inode();
49 } else {
50 dir_inode_num = EXT4_ROOT_INO;
51 inode_num = EXT4_ROOT_INO;
52@@ -180,7 +180,7 @@ u32 make_file(const char *filename, u64 len)
53 struct ext4_inode *inode;
54 u32 inode_num;
55
56- inode_num = allocate_inode(info);
57+ inode_num = allocate_inode();
58 if (inode_num == EXT4_ALLOCATE_FAILED) {
59 error("failed to allocate inode\n");
60 return EXT4_ALLOCATE_FAILED;
61@@ -215,7 +215,7 @@ u32 make_link(const char *link)
62 u32 inode_num;
63 u32 len = strlen(link);
64
65- inode_num = allocate_inode(info);
66+ inode_num = allocate_inode();
67 if (inode_num == EXT4_ALLOCATE_FAILED) {
68 error("failed to allocate inode\n");
69 return EXT4_ALLOCATE_FAILED;
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk b/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk
deleted file mode 100644
index b9ba95f38a..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/fastboot.mk
+++ /dev/null
@@ -1,89 +0,0 @@
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/gitignore b/meta-oe/recipes-devtools/android-tools/android-tools/gitignore
deleted file mode 100644
index b034c10a1e..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/gitignore
+++ /dev/null
@@ -1,59 +0,0 @@
1*
2!.gitignore
3!*.indirectionsymlink
4!*.[ch]
5!*.mk
6!*.patch
7!*.service
8!NOTICE
9!MODULE_LICENSE_*
10!/system/
11!/system/core/
12!/system/core/adb/
13!/system/core/fastboot/
14!/system/core/fs_mgr/
15!/system/core/fs_mgr/include/
16!/system/core/include/
17!/system/core/include/android/
18!/system/core/include/cutils/
19!/system/core/include/log/
20!/system/core/include/mincrypt/
21!/system/core/include/private/
22!/system/core/include/utils/
23!/system/core/include/zipfile/
24!/system/core/liblog/
25!/system/core/liblog/tests/
26!/system/core/libcutils/
27!/system/core/libmincrypt/
28!/system/core/libzipfile/
29!/system/core/libsparse/
30!/system/core/libsparse/include/
31!/system/core/libsparse/include/sparse/
32!/system/core/libsparse/simg_dump.py
33!/system/core/mkbootimg/
34!/system/extras/
35!/system/extras/ext4_utils/
36!/system/extras/ext4_utils/mkuserimg.sh
37!/system/extras/ext4_utils/test_ext4fixup
38!/system/extras/f2fs_utils/
39!/hardware/
40!/hardware/libhardware/
41!/hardware/libhardware/include/
42!/hardware/libhardware/include/hardware/
43!/external/
44!/external/libselinux/
45!/external/libselinux/include/
46!/external/libselinux/include/selinux/
47!/external/libselinux/src/
48!/external/f2fs-tools/
49!/external/f2fs-tools/include/
50!/external/f2fs-tools/lib/
51!/external/f2fs-tools/mkfs/
52!/build/
53!/build/core/
54!/build/core/version_defaults.mk
55!/build/core/combo/
56!/build/core/combo/include/
57!/build/core/combo/include/arch/
58!/build/core/combo/include/arch/linux-*/
59!/build/core/combo/include/arch/linux-*/AndroidConfig.h
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-Remove-bionic-specific-calls.patch b/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-Remove-bionic-specific-calls.patch
deleted file mode 100644
index 9de2593df8..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-Remove-bionic-specific-calls.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 36654a4484117e5f4d63a810c0d94bc9c7ee3a83 Mon Sep 17 00:00:00 2001
2From: Fathi Boudra <fabo@debian.org>
3Date: Tue, 2 Oct 2018 16:36:54 +0000
4Subject: [PATCH] Remove bionic specific calls
5
6Upstream-Status: Inappropriate
7
8Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
9---
10 src/procattr.c | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/src/procattr.c b/src/procattr.c
14index f350808..761cf8e 100644
15--- a/src/procattr.c
16+++ b/src/procattr.c
17@@ -8,7 +8,7 @@
18 #include "selinux_internal.h"
19 #include "policy.h"
20
21-#ifdef HOST
22+#ifndef __BIONIC__
23 static pid_t gettid(void)
24 {
25 return syscall(__NR_gettid);
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch b/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch
deleted file mode 100644
index 8b5e4cf999..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From f4f9d24860e1b5cd4f6a014f3fda7cd33ebe5be7 Mon Sep 17 00:00:00 2001
2From: Petr Lautrbach <plautrba@redhat.com>
3Date: Sat, 27 Jul 2019 08:20:20 -0700
4Subject: [PATCH] libselinux: Do not define gettid() if glibc >= 2.30 is used
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Since version 2.30 glibc implements gettid() system call wrapper, see
10https://sourceware.org/bugzilla/show_bug.cgi?id=6399
11
12Fixes:
13cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I../include -D_GNU_SOURCE -DNO_ANDROID_BACKEND -c -o procattr.o procattr.c
14procattr.c:28:14: error: static declaration of ‘gettid’ follows non-static declaration
15 28 | static pid_t gettid(void)
16 | ^~~~~~
17In file included from /usr/include/unistd.h:1170,
18 from procattr.c:2:
19/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
20 34 | extern __pid_t gettid (void) __THROW;
21 | ^~~~~~
22
23Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
24Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
26---
27Upstream-Status: Pending
28
29 src/procattr.c | 14 +++++++++++++-
30 1 file changed, 13 insertions(+), 1 deletion(-)
31
32--- a/src/procattr.c
33+++ b/src/procattr.c
34@@ -8,12 +8,16 @@
35 #include "selinux_internal.h"
36 #include "policy.h"
37
38-#ifndef __BIONIC__
39+/* Bionic and glibc >= 2.30 declare gettid() system call wrapper in unistd.h and
40+ * has a definition for it */
41+#if defined(__GLIBC_)
42+#if !__GLIBC_PREREQ(2,30)
43 static pid_t gettid(void)
44 {
45 return syscall(__NR_gettid);
46 }
47 #endif
48+#endif
49
50 static int getprocattrcon(char ** context,
51 pid_t pid, const char *attr)
diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk b/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk
deleted file mode 100644
index 519f609fd2..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools/mkbootimg.mk
+++ /dev/null
@@ -1,29 +0,0 @@
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_5.1.1.r37.bb b/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
deleted file mode 100644
index c04a1ef8c4..0000000000
--- a/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
+++ /dev/null
@@ -1,189 +0,0 @@
1DESCRIPTION = "Different utilities from Android"
2SECTION = "console/utils"
3LICENSE = "Apache-2.0 & GPL-2.0-only & 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-only;md5=801f80980d171dd6425610833a22dbe6 \
7 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \
8 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \
9"
10DEPENDS = "libbsd libpcre zlib libcap"
11DEPENDS:append:class-target = " openssl"
12
13ANDROID_MIRROR = "android.googlesource.com"
14
15# matches with android-5.1.1_r37
16SRCREV_core = "2314b110bdebdbfd2d94c502282f9e57c849897e"
17SRCREV_extras = "3ecbe8d841df96127d7855661293e5ab6ba6c205"
18SRCREV_libhardware = "be55eb1f4d840c82ffaf7c47460df17ff5bc4d9b"
19SRCREV_libselinux = "07e9e1339ad1ba608acfba9dce2d0f474b252feb"
20SRCREV_build = "16e987def3d7d8f7d30805eb95cef69e52a87dbc"
21
22SRCREV_FORMAT = "core_extras_libhardware_libselinux_build"
23SRC_URI = " \
24 git://${ANDROID_MIRROR}/platform/system/core;name=core;protocol=https;nobranch=1;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/system/core \
25 git://${ANDROID_MIRROR}/platform/system/extras;name=extras;protocol=https;nobranch=1;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/system/extras \
26 git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/hardware/libhardware \
27 git://${ANDROID_MIRROR}/platform/external/libselinux;name=libselinux;protocol=https;nobranch=1;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/external/libselinux \
28 git://${ANDROID_MIRROR}/platform/build;name=build;protocol=https;nobranch=1;destsuffix=${BB_GIT_DEFAULT_DESTSUFFIX}/build \
29 file://core/0001-adb-remove-selinux-extensions.patch;patchdir=system/core \
30 file://core/0002-adb-Use-local-sockets-where-appropriate.patch;patchdir=system/core \
31 file://core/0003-adb-define-shell-command.patch;patchdir=system/core \
32 file://core/0004-adb-Fix-build-on-big-endian-systems.patch;patchdir=system/core \
33 file://core/0005-adb-add-base64-implementation.patch;patchdir=system/core \
34 file://core/0006-adb-Musl-fixes.patch;patchdir=system/core \
35 file://core/0007-adb-usb_linux.c-fix-build-with-glibc-2.28.patch;patchdir=system/core \
36 file://core/0008-adb-Allow-adbd-to-be-ran-as-root.patch;patchdir=system/core \
37 file://core/0009-mkbootimg-Add-dt-parameter-to-specify-DT-image.patch;patchdir=system/core \
38 file://core/0010-Use-linux-capability.h-on-linux-systems-too.patch;patchdir=system/core \
39 file://core/0011-Remove-bionic-specific-calls.patch;patchdir=system/core \
40 file://core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch;patchdir=system/core \
41 file://core/adb_libssl_11.diff;patchdir=system/core \
42 file://core/b64_pton_function_decl.patch;patchdir=system/core \
43 file://core/0013-adb-Support-riscv64.patch;patchdir=system/core \
44 file://core/0014-add-u3-ss-descriptor-support-for-adb.patch;patchdir=system/core \
45 file://core/0015-libsparse-Split-off-most-of-sparse_file_read_normal-.patch;patchdir=system/core \
46 file://core/0016-libsparse-Add-hole-mode-to-sparse_file_read.patch;patchdir=system/core \
47 file://core/0017-img2simg-Add-support-for-converting-holes-to-don-t-c.patch;patchdir=system/core \
48 file://core/0001-memory.h-Always-define-strlcpy-for-glibc-based-syste.patch;patchdir=system/core \
49 file://extras/0001-ext4_utils-remove-selinux-extensions.patch;patchdir=system/extras \
50 file://extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch;patchdir=system/extras \
51 file://extras/0003-ext4_utils-drop-unused-parameter-from-allocate_inode.patch;patchdir=system/extras \
52 file://libselinux/0001-Remove-bionic-specific-calls.patch;patchdir=external/libselinux \
53 file://libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch;patchdir=external/libselinux \
54 file://android-tools-adbd.service \
55 file://build/0001-Riscv-Add-risc-v-Android-config-header.patch;patchdir=build \
56 file://gitignore \
57 file://adb.mk;subdir=${BPN} \
58 file://adbd.mk;subdir=${BPN} \
59 file://ext4_utils.mk;subdir=${BPN} \
60 file://fastboot.mk;subdir=${BPN} \
61 file://mkbootimg.mk;subdir=${BPN} \
62"
63
64
65B = "${WORKDIR}/${BPN}"
66
67# http://errors.yoctoproject.org/Errors/Details/133881/
68ARM_INSTRUCTION_SET:armv4 = "arm"
69ARM_INSTRUCTION_SET:armv5 = "arm"
70
71COMPATIBLE_HOST:powerpc = "(null)"
72COMPATIBLE_HOST:powerpc64 = "(null)"
73COMPATIBLE_HOST:powerpc64le = "(null)"
74
75inherit systemd
76
77SYSTEMD_PACKAGES = "${PN}-adbd"
78SYSTEMD_SERVICE:${PN}-adbd = "android-tools-adbd.service"
79
80# Find libbsd headers during native builds
81CC:append:class-native = " -I${STAGING_INCDIR}"
82CC:append:class-nativesdk = " -I${STAGING_INCDIR}"
83
84TOOLS = "adb fastboot ext4_utils mkbootimg adbd"
85
86# Adb needs sys/capability.h, which is not available for native*
87TOOLS:class-native = "fastboot ext4_utils mkbootimg"
88TOOLS:class-nativesdk = "fastboot ext4_utils mkbootimg"
89
90do_compile() {
91 cp ${UNPACKDIR}/gitignore ${S}/.gitignore
92
93 # Setting both variables below causing our makefiles to not work with
94 # implicit make rules
95 CFLAGS="-ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR}"
96 unset CPPFLAGS
97
98 export SRCDIR=${S}
99
100 case "${HOST_ARCH}" in
101 arm)
102 export android_arch=linux-arm
103 ;;
104 aarch64)
105 export android_arch=linux-arm64
106 ;;
107 riscv64)
108 export android_arch=linux-riscv64
109 ;;
110 mips|mipsel)
111 export android_arch=linux-mips
112 ;;
113 mips64|mips64el)
114 export android_arch=linux-mips64
115 ;;
116 powerpc|powerpc64)
117 export android_arch=linux-ppc
118 ;;
119 i586|i686|x86_64)
120 export android_arch=linux-x86
121 ;;
122 esac
123
124 for tool in ${TOOLS}; do
125 mkdir -p ${B}/${tool}
126 oe_runmake -f ${UNPACKDIR}/${BPN}/${tool}.mk -C ${B}/${tool}
127 done
128}
129
130do_install() {
131 if echo ${TOOLS} | grep -q "ext4_utils" ; then
132 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
133 install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg
134
135 install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir}
136 install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir}
137 install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir}
138 install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir}
139 install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir}
140 install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}
141 fi
142
143 if echo ${TOOLS} | grep -q "adb\>" ; then
144 install -d ${D}${bindir}
145 install -m0755 ${B}/adb/adb ${D}${bindir}
146 fi
147
148 if echo ${TOOLS} | grep -q "adbd" ; then
149 install -d ${D}${bindir}
150 install -m0755 ${B}/adbd/adbd ${D}${bindir}
151 fi
152
153 # Outside the if statement to avoid errors during do_package
154 install -D -p -m0644 ${UNPACKDIR}/android-tools-adbd.service \
155 ${D}${systemd_unitdir}/system/android-tools-adbd.service
156
157 if echo ${TOOLS} | grep -q "fastboot" ; then
158 install -d ${D}${bindir}
159 install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
160 fi
161
162 if echo ${TOOLS} | grep -q "mkbootimg" ; then
163 install -d ${D}${bindir}
164 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
165 fi
166}
167
168PACKAGES =+ "${PN}-fstools ${PN}-adbd"
169
170RDEPENDS:${PN}-adbd = "${PN}-conf"
171RDEPENDS:${PN}-fstools = "bash"
172
173FILES:${PN}-adbd = "\
174 ${bindir}/adbd \
175 ${systemd_unitdir}/system/android-tools-adbd.service \
176"
177
178FILES:${PN}-fstools = "\
179 ${bindir}/ext2simg \
180 ${bindir}/ext4fixup \
181 ${bindir}/img2simg \
182 ${bindir}/make_ext4fs \
183 ${bindir}/simg2img \
184 ${bindir}/simg2simg \
185 ${bindir}/simg_dump \
186 ${bindir}/mkuserimg \
187"
188
189BBCLASSEXTEND = "native"