summaryrefslogtreecommitdiffstats
path: root/dynamic-layers
diff options
context:
space:
mode:
authorEtienne Cordonnier <ecordonnier@snap.com>2023-03-15 17:40:37 +0100
committerKhem Raj <raj.khem@gmail.com>2023-03-15 15:25:12 -0700
commit0c7dbd7eefd775303e1a29b5466fb9aa3ed4d838 (patch)
tree22a291b1e4ee7fa4ebd1186f8fd31e0fe1227f37 /dynamic-layers
parent204dadaf378e44d6c53d3bee1c2a54aaf38d666c (diff)
downloadmeta-clang-0c7dbd7eefd775303e1a29b5466fb9aa3ed4d838.tar.gz
android-tools: remove recipe and dynamic-layer
The recipe has been patched to remove the clang dependency and moved to meta-openembedded at https://github.com/openembedded/meta-openembedded/tree/master/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Diffstat (limited to 'dynamic-layers')
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf4
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-cleanup24
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-setup35
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-start7
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf-configfs_1.0.bb35
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf/android-gadget-setup37
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools-conf_1.0.bb18
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch41
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch54
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch58
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch49
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/adbd.mk72
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/android-tools-adbd.service13
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch94
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch20
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch14
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch20
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch17
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch24
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch22
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch22
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch150
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch43
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch16
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch18
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch62
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch74
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch15
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch18
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch31
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch62
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch56
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch61
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch63
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch54
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch45
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch51
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch41
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch53
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch53
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch53
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch58
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch59
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch69
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch32
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch161
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch39
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch14
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch25
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/series3
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/user_pt_regs.patch23
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/rules_yocto.mk4
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools_10.0.0.r36.bb229
53 files changed, 0 insertions, 2415 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf b/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/10-adbd-configfs.conf
deleted file mode 100644
index ddf155a..0000000
--- a/dynamic-layers/selinux/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/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-cleanup b/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-cleanup
deleted file mode 100644
index 517227d..0000000
--- a/dynamic-layers/selinux/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 "" > 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/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-setup b/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-setup
deleted file mode 100644
index e44d1ba..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-setup
+++ /dev/null
@@ -1,35 +0,0 @@
1#!/bin/sh
2
3set -e
4
5manufacturer=RPB
6model="Android device"
7serial=0123456789ABCDEF
8
9if [ -r /etc/android-gadget-setup.machine ] ; then
10 . /etc/android-gadget-setup.machine
11fi
12
13[ -d /sys/kernel/config/usb_gadget ] || modprobe libcomposite
14
15cd /sys/kernel/config/usb_gadget
16
17[ -d adb ] && /usr/bin/android-gadget-cleanup || true
18
19mkdir adb
20cd adb
21
22mkdir configs/c.1
23mkdir functions/ffs.usb0
24mkdir strings/0x409
25mkdir configs/c.1/strings/0x409
26echo 0x18d1 > idVendor
27echo 0xd002 > idProduct
28echo "$serial" > strings/0x409/serialnumber
29echo "$manufacturer" > strings/0x409/manufacturer
30echo "$model" > strings/0x409/product
31echo "Conf 1" > configs/c.1/strings/0x409/configuration
32ln -s functions/ffs.usb0 configs/c.1
33
34mkdir -p /dev/usb-ffs/adb
35mount -t functionfs usb0 /dev/usb-ffs/adb
diff --git a/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-start b/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-start
deleted file mode 100644
index ca6c3df..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools-conf-configfs/android-gadget-start
+++ /dev/null
@@ -1,7 +0,0 @@
1#!/bin/sh
2
3set -e
4
5sleep 3
6
7ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/adb/UDC
diff --git a/dynamic-layers/selinux/android-tools/android-tools-conf-configfs_1.0.bb b/dynamic-layers/selinux/android-tools/android-tools-conf-configfs_1.0.bb
deleted file mode 100644
index 3f9d49a..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools-conf-configfs_1.0.bb
+++ /dev/null
@@ -1,35 +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
6SRC_URI = " \
7 file://android-gadget-setup \
8 file://android-gadget-start \
9 file://android-gadget-cleanup \
10 file://10-adbd-configfs.conf \
11"
12
13PACKAGE_ARCH = "${MACHINE_ARCH}"
14
15do_install() {
16 install -d ${D}${bindir}
17 install -m 0755 ${WORKDIR}/android-gadget-setup ${D}${bindir}
18 install -m 0755 ${WORKDIR}/android-gadget-start ${D}${bindir}
19 install -m 0755 ${WORKDIR}/android-gadget-cleanup ${D}${bindir}
20
21 if [ -r ${WORKDIR}/android-gadget-setup.machine ] ; then
22 install -d ${D}${sysconfdir}
23 install -m 0644 ${WORKDIR}/android-gadget-setup.machine ${D}${sysconfdir}
24 fi
25
26 install -d ${D}${systemd_unitdir}/system/android-tools-adbd.service.d
27 install -m 0644 ${WORKDIR}/10-adbd-configfs.conf ${D}${systemd_unitdir}/system/android-tools-adbd.service.d
28}
29
30FILES:${PN} += " \
31 ${systemd_unitdir}/system/ \
32"
33
34PROVIDES += "android-tools-conf"
35RPROVIDES:${PN} = "android-tools-conf"
diff --git a/dynamic-layers/selinux/android-tools/android-tools-conf/android-gadget-setup b/dynamic-layers/selinux/android-tools/android-tools-conf/android-gadget-setup
deleted file mode 100644
index 26cf30e..0000000
--- a/dynamic-layers/selinux/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/dynamic-layers/selinux/android-tools/android-tools-conf_1.0.bb b/dynamic-layers/selinux/android-tools/android-tools-conf_1.0.bb
deleted file mode 100644
index b63ccbb..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools-conf_1.0.bb
+++ /dev/null
@@ -1,18 +0,0 @@
1DESCRIPTION = "Different utilities from Android - corresponding 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
8do_install() {
9 install -d ${D}${bindir}
10 install -m 0755 ${WORKDIR}/android-gadget-setup ${D}${bindir}
11}
12
13python () {
14 pn = d.getVar('PN')
15 profprov = d.getVar("PREFERRED_PROVIDER_" + pn)
16 if profprov and pn != profprov:
17 raise bb.parse.SkipRecipe("PREFERRED_PROVIDER_%s set to %s, not %s" % (pn, profprov, pn))
18}
diff --git a/dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch b/dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch
deleted file mode 100644
index 7d6d588..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 30193c177138551a9aa269ae249ed2800811b223 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:24:11 +0100
4Subject: [PATCH] libcrypto.mk: modifications to make it build in yocto
5 environment
6
7Adding an include file that is setting the common flags.
8
9Modified the build rule so that it outputs the binary and include
10to the OUT_DIR
11
12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
13---
14 debian/libcrypto.mk | 9 ++++++---
15 1 file changed, 6 insertions(+), 3 deletions(-)
16
17diff --git a/debian/libcrypto.mk b/debian/libcrypto.mk
18index 4c0268e..8b41056 100644
19--- a/debian/libcrypto.mk
20+++ b/debian/libcrypto.mk
21@@ -1,3 +1,4 @@
22+include ../../rules_yocto.mk
23 include sources.mk
24
25 NAME = libcrypto
26@@ -26,6 +27,8 @@ CPPFLAGS += -Isrc/include -Isrc/crypto
27 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread
28
29 build: $(SOURCES)
30- mkdir --parents debian/out
31- $(CC) $^ -o debian/out/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
32- ln -s $(NAME).so.0 debian/out/$(NAME).so
33\ No newline at end of file
34+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/
35+ mkdir --parents $(OUT_DIR)/usr/include
36+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DOPENSSL_NO_ASM
37+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
38+ cp -r include/openssl $(OUT_DIR)/usr/include
39--
402.36.1.vfs.0.0
41
diff --git a/dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch b/dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch
deleted file mode 100644
index 04592da..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From e284ceac2b10133ca916bbae8055f040607b506c Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:21:49 +0100
4Subject: [PATCH 1/2] libext4_utils.mk: modifications to make it build in yocto
5 environment
6
7Adding an include file that is setting the common flags.
8Changed the cppflag to include the headers from other components
9of android-tools
10
11Modified LDflags so that the libraries that are coming from other android-tools
12are searched in the output folder.
13
14Modified the build rule so that it outputs the binary and header to the OUT_DIR
15
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libext4_utils.mk | 13 ++++++++-----
19 1 file changed, 8 insertions(+), 5 deletions(-)
20
21diff --git a/debian/libext4_utils.mk b/debian/libext4_utils.mk
22index 868e790..2e93158 100644
23--- a/debian/libext4_utils.mk
24+++ b/debian/libext4_utils.mk
25@@ -1,3 +1,4 @@
26+include ../../rules_yocto.mk
27 NAME = libext4_utils
28
29 ext4_utils_SOURCES := \
30@@ -17,14 +18,16 @@ CPPFLAGS += \
31 -Iext4_utils/include \
32 -Ilibfec/include \
33 -Isquashfs_utils \
34- -I/usr/include/android \
35+ -I/usr/include/android -I$(OUT_DIR)/usr/include \
36 -D_GNU_SOURCE -DFEC_NO_KLOG -DSQUASHFS_NO_KLOG -D_LARGEFILE64_SOURCE
37 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
38 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
39- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
40+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
41 -lbase -lsparse -lselinux
42
43 build: $(SOURCES)
44- mkdir --parents $(OUT_DIR)
45- $(CC) $^ -o $(OUT_DIR)/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
46- ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so
47+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/
48+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
49+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
50+ cp -r ext4_utils/include/* $(OUT_DIR)/usr/include/
51+
52--
532.36.1.vfs.0.0
54
diff --git a/dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch
deleted file mode 100644
index f6bea17..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,58 +0,0 @@
1From d5fb34aef65b5c5472544e4f42ad777d8fa16ba9 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:41:52 +0100
4Subject: [PATCH] patching libundwind to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Passing the architecture details($CPU)from the recipe.
20
21Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
22
23Upstream-Status: Pending
24---
25 debian/libunwind.mk | 14 ++++++++------
26 1 file changed, 8 insertions(+), 6 deletions(-)
27
28diff --git a/debian/libunwind.mk b/debian/libunwind.mk
29index 738b205..ada4ef9 100644
30--- a/debian/libunwind.mk
31+++ b/debian/libunwind.mk
32@@ -1,4 +1,4 @@
33-include debian/detect_arch.mk
34+include ../../rules_yocto.mk
35
36 ARCH_SOURCES = is_fpreg.c \
37 regname.c \
38@@ -131,10 +131,12 @@ CFLAGS += -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -Werror -Wno-unused-parameter -
39 CPPFLAGS += -Iinclude -Isrc $($(CPU)_INCLUDES) -Idebian/include
40 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
41 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
42- -lpthread -nostdlib -lc -lgcc -Ldebian/out -l7z
43+ -lpthread -nostdlib -lc -lgcc -l7z -Wno-error=unused-command-line-argument
44
45 build: $(SOURCES)
46- mkdir --parents debian/out
47- ln -s /usr/lib/p7zip/7z.so debian/out/lib7z.so
48- $(CC) $^ -o debian/out/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
49- ln -s $(NAME).so.0 debian/out/$(NAME).so
50+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/
51+ mkdir --parents $(OUT_DIR)/usr/include/android/libunwind
52+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -Wno-header-guard -Wno-absolute-value
53+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
54+ cp -r include/* debian/include/* $(OUT_DIR)/usr/include/android/libunwind/
55+
56--
572.36.1.vfs.0.0
58
diff --git a/dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch b/dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch
deleted file mode 100644
index 25f8efe..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 3be070a1fe2efa2877684f95c6a5643f76ee8bbc Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:32:11 +0100
4Subject: [PATCH 2/2] libfec: change out_dir in makefile
5
6---
7 debian/libfec.mk | 14 ++++++++------
8 1 file changed, 8 insertions(+), 6 deletions(-)
9
10diff --git a/debian/libfec.mk b/debian/libfec.mk
11index 1d48392..dea9316 100644
12--- a/debian/libfec.mk
13+++ b/debian/libfec.mk
14@@ -1,3 +1,4 @@
15+include ../../rules_yocto.mk
16 NAME = libfec
17
18 # copied from libfec/Android.bp
19@@ -12,20 +13,21 @@ CXXSOURCES := $(foreach source, $(filter %.cpp, $(SOURCES)), libfec/$(source))
20 CXXFLAGS += -fno-strict-aliasing -std=g++17
21 CPPFLAGS += \
22 -Iext4_utils/include \
23- -Ilibfec/include \
24+ -Ilibfec/include -I $(OUT_DIR)/usr/include \
25 -D_GNU_SOURCE -DFEC_NO_KLOG -D_LARGEFILE64_SOURCE
26 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
27 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
28- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
29+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
30 -lbase -lsparse -lselinux
31
32 build: $(COBJECTS) $(CXXOBJECTS)
33- mkdir -p $(OUT_DIR)
34- $(CXX) $^ -o $(OUT_DIR)/$(NAME).so.0 $(LDFLAGS)
35- ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so
36+ mkdir -p $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android
37+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS)
38+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
39+ cp -r libfec/include/* $(OUT_DIR)/usr/include/
40
41 clean:
42- $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so*
43+ $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
44
45 $(COBJECTS): %.o: %.c
46 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
47--
482.36.1.vfs.0.0
49
diff --git a/dynamic-layers/selinux/android-tools/android-tools/adbd.mk b/dynamic-layers/selinux/android-tools/android-tools/adbd.mk
deleted file mode 100644
index cb82683..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/adbd.mk
+++ /dev/null
@@ -1,72 +0,0 @@
1include ../../rules_yocto.mk
2NAME = adbd
3
4SOURCES = \
5 adb/daemon/main.cpp \
6 adb/daemon/auth.cpp \
7 adb/daemon/jdwp_service.cpp \
8 adb/daemon/file_sync_service.cpp \
9 adb/daemon/services.cpp \
10 adb/daemon/shell_service.cpp \
11 adb/daemon/remount_service.cpp \
12 adb/daemon/restart_service.cpp \
13 adb/daemon/reboot_service.cpp \
14 adb/daemon/framebuffer_service.cpp \
15 adb/daemon/set_verity_enable_state_service.cpp \
16 adb/shell_service_protocol.cpp \
17 adb/adb.cpp \
18 adb/adb_io.cpp \
19 adb/adb_listeners.cpp \
20 adb/adb_trace.cpp \
21 adb/adb_unique_fd.cpp \
22 adb/adb_utils.cpp \
23 adb/fdevent.cpp \
24 adb/services.cpp \
25 adb/sockets.cpp \
26 adb/socket_spec.cpp \
27 adb/sysdeps/errno.cpp \
28 adb/transport.cpp \
29 adb/transport_fd.cpp \
30 adb/transport_local.cpp \
31 adb/transport_usb.cpp \
32 adb/sysdeps_unix.cpp \
33 adb/sysdeps/posix/network.cpp \
34 adb/daemon/usb_legacy.cpp \
35 adb/daemon/usb_ffs.cpp \
36 adb/daemon/usb.cpp \
37 diagnose_usb/diagnose_usb.cpp \
38 libasyncio/AsyncIO.cpp \
39
40CXXFLAGS += -std=gnu++20
41CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ -Imkbootimg/include/bootimg -Ifs_mgr/include \
42 -Ifs_mgr/include_fstab \
43 -DADB_VERSION='"$(DEB_VERSION)"' -D_GNU_SOURCE
44LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
45 -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lbase -lcrypto_utils -lcrypto -lcutils -llog -lresolv
46
47PAGE_SIZE ?= 4096
48
49CXXFLAGS += -UADB_HOST
50CXXFLAGS += -DADB_HOST=0
51CXXFLAGS += -DALLOW_ADBD_DISABLE_VERITY
52CXXFLAGS += -DALLOW_ADBD_NO_AUTH
53CXXFLAGS += -DPLATFORM_TOOLS_VERSION='"28.0.2"'
54CXXFLAGS += -Idiagnose_usb/include
55CXXFLAGS += -Iadb/daemon/include
56CXXFLAGS += -Ilibasyncio/include
57CXXFLAGS += -Wno-c++11-narrowing
58CXXFLAGS += -DPAGE_SIZE=$(PAGE_SIZE)
59
60
61# -latomic should be the last library specified
62# https://github.com/android/ndk/issues/589
63ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
64 LDFLAGS += -latomic
65endif
66
67build: $(SOURCES)
68 mkdir --parents ../../../android-tools/adbd
69 $(CXX) $^ -o ../../../android-tools/adbd/adbd $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
70
71clean:
72 $(RM) $(OUT_DIR)/usr/bin/$(NAME)
diff --git a/dynamic-layers/selinux/android-tools/android-tools/android-tools-adbd.service b/dynamic-layers/selinux/android-tools/android-tools/android-tools-adbd.service
deleted file mode 100644
index ddf8d7f..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/android-tools-adbd.service
+++ /dev/null
@@ -1,13 +0,0 @@
1[Unit]
2Description=Android Debug Bridge
3ConditionPathExists=/var/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/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch
deleted file mode 100644
index 2820e79..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch
+++ /dev/null
@@ -1,94 +0,0 @@
1Description: Added missing headers causing compile errors
2Author: Umang Parmar <umangjparmar@gmail.com>
3Forwarded: not-needed
4
5--- a/adb/sysdeps/posix/network.cpp
6+++ b/adb/sysdeps/posix/network.cpp
7@@ -22,6 +22,7 @@
8 #include <sys/socket.h>
9
10 #include <string>
11+#include <cstring>
12
13 #include <android-base/logging.h>
14 #include <android-base/stringprintf.h>
15--- a/base/errors_unix.cpp
16+++ b/base/errors_unix.cpp
17@@ -17,6 +17,7 @@
18 #include "android-base/errors.h"
19
20 #include <errno.h>
21+#include <cstring>
22
23 namespace android {
24 namespace base {
25--- a/base/file.cpp
26+++ b/base/file.cpp
27@@ -26,6 +26,7 @@
28 #include <sys/stat.h>
29 #include <sys/types.h>
30 #include <unistd.h>
31+#include <cstring>
32
33 #include <memory>
34 #include <mutex>
35--- a/base/logging.cpp
36+++ b/base/logging.cpp
37@@ -24,6 +24,7 @@
38 #include <inttypes.h>
39 #include <libgen.h>
40 #include <time.h>
41+#include <cstring>
42
43 // For getprogname(3) or program_invocation_short_name.
44 #if defined(__ANDROID__) || defined(__APPLE__)
45--- a/libcutils/include/cutils/jstring.h
46+++ b/libcutils/include/cutils/jstring.h
47@@ -19,6 +19,7 @@
48
49 #include <stdint.h>
50 #include <stddef.h>
51+#include <uchar.h>
52
53 #ifdef __cplusplus
54 extern "C" {
55--- a/libbacktrace/BacktraceMap.cpp
56+++ b/libbacktrace/BacktraceMap.cpp
57@@ -21,6 +21,7 @@
58 #include <stdint.h>
59 #include <sys/types.h>
60 #include <unistd.h>
61+#include <algorithm>
62
63 #include <log/log.h>
64
65--- a/demangle/Demangler.cpp
66+++ b/demangle/Demangler.cpp
67@@ -20,6 +20,7 @@
68 #include <stack>
69 #include <string>
70 #include <vector>
71+#include <cstring>
72
73 #include "Demangler.h"
74
75--- a/libbacktrace/UnwindStackMap.cpp
76+++ b/libbacktrace/UnwindStackMap.cpp
77@@ -20,6 +20,7 @@
78
79 #include <string>
80 #include <vector>
81+#include <algorithm>
82
83 #include <backtrace/BacktraceMap.h>
84 #include <unwindstack/Elf.h>
85--- a/adb/types.h
86+++ b/adb/types.h
87@@ -17,6 +17,7 @@
88 #pragma once
89
90 #include <algorithm>
91+#include <cstring>
92 #include <deque>
93 #include <memory>
94 #include <type_traits>
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch
deleted file mode 100644
index a7e0fa8..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1Description: Bring Clang's _Nonnull keyword to GCC
2Author: Kai-Chung Yan
3Forwarded: not-needed
4--- a/adb/sysdeps.h
5+++ b/adb/sysdeps.h
6@@ -40,11 +40,12 @@
7 #include "sysdeps/network.h"
8 #include "sysdeps/stat.h"
9
10+#define _Nonnull
11+#define _Nullable
12+
13 #ifdef _WIN32
14
15 // Clang-only nullability specifiers
16-#define _Nonnull
17-#define _Nullable
18
19 #include <ctype.h>
20 #include <direct.h>
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch
deleted file mode 100644
index dd39d1e..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1Description: Fix the wired error by GCC7 that fails to match the correct parent method.
2Author: Kai-Chung Yan
3Forwarded: not-needed
4--- a/libutils/include/utils/Vector.h
5+++ b/libutils/include/utils/Vector.h
6@@ -256,7 +256,7 @@
7
8 template<class TYPE> inline
9 const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const {
10- VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
11+ VectorImpl::operator = (rhs);
12 return *this;
13 }
14
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch
deleted file mode 100644
index 62a8ba2..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1--- a/fs_mgr/liblp/reader.cpp
2+++ b/fs_mgr/liblp/reader.cpp
3@@ -21,6 +21,7 @@
4 #include <unistd.h>
5
6 #include <functional>
7+#include <cstring>
8
9 #include <android-base/file.h>
10 #include <android-base/unique_fd.h>
11--- a/fs_mgr/liblp/writer.cpp
12+++ b/fs_mgr/liblp/writer.cpp
13@@ -20,6 +20,7 @@
14 #include <unistd.h>
15
16 #include <string>
17+#include <cstring>
18
19 #include <android-base/file.h>
20 #include <android-base/unique_fd.h>
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch
deleted file mode 100644
index 771f0e7..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Description: remove clang-ism
2Forwarded: not-needed
3
4--- a/base/include/android-base/logging.h
5+++ b/base/include/android-base/logging.h
6@@ -484,10 +484,7 @@
7 // -Wno-user-defined-warnings to CPPFLAGS.
8 #pragma clang diagnostic push
9 #pragma clang diagnostic ignored "-Wgcc-compat"
10-#define OSTREAM_STRING_POINTER_USAGE_WARNING \
11- __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning")))
12-inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer)
13- OSTREAM_STRING_POINTER_USAGE_WARNING {
14+inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) {
15 return stream << static_cast<const void*>(string_pointer);
16 }
17 #pragma clang diagnostic pop
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch
deleted file mode 100644
index 66d1ddd..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1Description: non-x86 arches do not have PAGE_SIZE
2Forwarded: not-needed
3--- a/base/cmsg.cpp
4+++ b/base/cmsg.cpp
5@@ -33,7 +33,8 @@
6 const std::vector<int>& fds) {
7 size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size());
8 size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size());
9- if (cmsg_space >= PAGE_SIZE) {
10+ size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE));
11+ if (cmsg_space >= pagesize) {
12 errno = ENOMEM;
13 return -1;
14 }
15@@ -75,7 +76,8 @@
16 fds->clear();
17
18 size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds);
19- if (cmsg_space >= PAGE_SIZE) {
20+ size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE));
21+ if (cmsg_space >= pagesize) {
22 errno = ENOMEM;
23 return -1;
24 }
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch
deleted file mode 100644
index 8a21054..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1Index: android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h
2===================================================================
3--- android-platform-system-core.orig/libunwindstack/include/unwindstack/DwarfMemory.h
4+++ android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h
5@@ -29,7 +29,7 @@ class DwarfMemory {
6 DwarfMemory(Memory* memory) : memory_(memory) {}
7 virtual ~DwarfMemory() = default;
8
9- bool ReadBytes(void* dst, size_t num_bytes);
10+ bool ReadBytes(void* dst, std::size_t num_bytes);
11
12 template <typename SignedType>
13 bool ReadSigned(uint64_t* value);
14@@ -39,7 +39,7 @@ class DwarfMemory {
15 bool ReadSLEB128(int64_t* value);
16
17 template <typename AddressType>
18- size_t GetEncodedSize(uint8_t encoding);
19+ std::size_t GetEncodedSize(uint8_t encoding);
20
21 bool AdjustEncodedValue(uint8_t encoding, uint64_t* value);
22
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch
deleted file mode 100644
index 3622d7e..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch
+++ /dev/null
@@ -1,22 +0,0 @@
1--- a/libcutils/include/cutils/threads.h
2+++ b/libcutils/include/cutils/threads.h
3@@ -33,7 +33,7 @@
4 // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows.
5 //
6
7-extern pid_t gettid();
8+extern pid_t gettid(void) __THROW;
9
10 //
11 // Deprecated: use `_Thread_local` in C or `thread_local` in C++.
12--- a/libcutils/threads.cpp
13+++ b/libcutils/threads.cpp
14@@ -33,7 +33,7 @@
15
16 // No definition needed for Android because we'll just pick up bionic's copy.
17 #ifndef __ANDROID__
18-pid_t gettid() {
19+pid_t gettid(void) __THROW {
20 #if defined(__APPLE__)
21 uint64_t tid;
22 pthread_threadid_np(NULL, &tid);
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch
deleted file mode 100644
index 6c21022..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch
+++ /dev/null
@@ -1,150 +0,0 @@
1From: Roger Shimizu <rosh@debian.org>
2Date: Sun, 10 Jan 2021 19:03:17 +0900
3Subject: Fix GNU/Hurd
4
5Reference:
6- https://www.gnu.org/software/hurd/hurd/porting/guidelines.html
7
8Closes: #915762
9---
10 base/cmsg.cpp | 2 ++
11 base/threads.cpp | 2 +-
12 libcutils/ashmem-host.cpp | 20 +++++++++++++++++---
13 libcutils/canned_fs_config.cpp | 2 +-
14 libcutils/fs.cpp | 20 ++++++++++++++++----
15 5 files changed, 37 insertions(+), 9 deletions(-)
16
17diff --git a/base/cmsg.cpp b/base/cmsg.cpp
18index ae5bb16..e5ec321 100644
19--- a/base/cmsg.cpp
20+++ b/base/cmsg.cpp
21@@ -20,7 +20,9 @@
22 #include <fcntl.h>
23 #include <stdlib.h>
24 #include <sys/socket.h>
25+#ifndef __GNU__
26 #include <sys/user.h>
27+#endif
28
29 #include <memory>
30
31diff --git a/base/threads.cpp b/base/threads.cpp
32index 48f6197..19cc293 100644
33--- a/base/threads.cpp
34+++ b/base/threads.cpp
35@@ -47,7 +47,7 @@ uint64_t GetThreadId() {
36 } // namespace base
37 } // namespace android
38
39-#if defined(__GLIBC__)
40+#if defined(__GLIBC__) && !defined(__GNU__)
41 int tgkill(int tgid, int tid, int sig) {
42 return syscall(__NR_tgkill, tgid, tid, sig);
43 }
44diff --git a/libcutils/ashmem-host.cpp b/libcutils/ashmem-host.cpp
45index 32446d4..83dd622 100644
46--- a/libcutils/ashmem-host.cpp
47+++ b/libcutils/ashmem-host.cpp
48@@ -31,16 +31,30 @@
49 #include <sys/types.h>
50 #include <time.h>
51 #include <unistd.h>
52+#include <stdint.h>
53
54 #include <utils/Compat.h>
55
56 int ashmem_create_region(const char* /*ignored*/, size_t size) {
57- char pattern[PATH_MAX];
58- snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid());
59+ char *pattern;
60+ size_t pattern_size = 128;
61+ while(1) {
62+ pattern = (char*) malloc(pattern_size);
63+ if(snprintf(pattern, strlen(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()) < pattern_size)
64+ break;
65+ free(pattern);
66+ pattern_size *= 2;
67+ if(pattern_size >= INT_LEAST16_MAX)
68+ return -1;
69+ }
70 int fd = mkstemp(pattern);
71- if (fd == -1) return -1;
72+ if (fd == -1) {
73+ free(pattern);
74+ return -1;
75+ }
76
77 unlink(pattern);
78+ free(pattern);
79
80 if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) {
81 close(fd);
82diff --git a/libcutils/canned_fs_config.cpp b/libcutils/canned_fs_config.cpp
83index 2772ef0..1e41f37 100644
84--- a/libcutils/canned_fs_config.cpp
85+++ b/libcutils/canned_fs_config.cpp
86@@ -42,7 +42,7 @@ static int path_compare(const void* a, const void* b) {
87 }
88
89 int load_canned_fs_config(const char* fn) {
90- char buf[PATH_MAX + 200];
91+ char buf[1024];
92 FILE* f;
93
94 f = fopen(fn, "r");
95diff --git a/libcutils/fs.cpp b/libcutils/fs.cpp
96index ef85acc..2884835 100644
97--- a/libcutils/fs.cpp
98+++ b/libcutils/fs.cpp
99@@ -33,6 +33,7 @@
100 #include <sys/stat.h>
101 #include <sys/types.h>
102 #include <unistd.h>
103+#include <stdint.h>
104
105 #include <log/log.h>
106
107@@ -150,15 +151,24 @@ fail:
108 }
109
110 int fs_write_atomic_int(const char* path, int value) {
111- char temp[PATH_MAX];
112- if (snprintf(temp, PATH_MAX, "%s.XXXXXX", path) >= PATH_MAX) {
113- ALOGE("Path too long");
114- return -1;
115+ char *temp;
116+ size_t temp_size = 128;
117+ while(1) {
118+ temp = (char*) malloc(temp_size);
119+ if(snprintf(temp, strlen(temp), "%s.XXXXXX", path) < temp_size)
120+ break;
121+ free(temp);
122+ temp_size *= 2;
123+ if(temp_size >= INT_LEAST16_MAX) {
124+ ALOGE("Path too long");
125+ return -1;
126+ }
127 }
128
129 int fd = TEMP_FAILURE_RETRY(mkstemp(temp));
130 if (fd == -1) {
131 ALOGE("Failed to open %s: %s", temp, strerror(errno));
132+ free(temp);
133 return -1;
134 }
135
136@@ -182,12 +192,14 @@ int fs_write_atomic_int(const char* path, int value) {
137 goto fail_closed;
138 }
139
140+ free(temp);
141 return 0;
142
143 fail:
144 close(fd);
145 fail_closed:
146 unlink(temp);
147+ free(temp);
148 return -1;
149 }
150
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch
deleted file mode 100644
index ccc7655..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1Description: just hard code rather than deal with circular deps
2Forwarded: not-needed
3--- a/adb/adb.cpp
4+++ b/adb/adb.cpp
5@@ -44,8 +44,6 @@
6 #include <android-base/parsenetaddress.h>
7 #include <android-base/stringprintf.h>
8 #include <android-base/strings.h>
9-#include <build/version.h>
10-#include <platform_tools_version.h>
11
12 #include "adb_auth.h"
13 #include "adb_io.h"
14@@ -69,7 +67,7 @@
15 "Version %s-%s\n"
16 "Installed as %s\n",
17 ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION,
18- PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(),
19+ PLATFORM_TOOLS_VERSION, "debian",
20 android::base::GetExecutablePath().c_str());
21 }
22
23--- a/fastboot/fastboot.cpp
24+++ b/fastboot/fastboot.cpp
25@@ -58,9 +58,7 @@
26 #include <android-base/stringprintf.h>
27 #include <android-base/strings.h>
28 #include <android-base/unique_fd.h>
29-#include <build/version.h>
30 #include <liblp/liblp.h>
31-#include <platform_tools_version.h>
32 #include <sparse/sparse.h>
33 #include <ziparchive/zip_archive.h>
34
35@@ -1680,7 +1678,7 @@
36 setvbuf(stdout, nullptr, _IONBF, 0);
37 setvbuf(stderr, nullptr, _IONBF, 0);
38 } else if (name == "version") {
39- fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str());
40+ fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, "debian");
41 fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str());
42 return 0;
43 #if !defined(_WIN32)
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch
deleted file mode 100644
index d507eab..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch
+++ /dev/null
@@ -1,16 +0,0 @@
1Description: libusb.h comes from different location
2Author: Umang Parmar <umangjparmar@gmail.com>
3Forwarded: not-needed
4Last-Update: 2018-05-26
5
6--- a/adb/client/usb_libusb.cpp
7+++ b/adb/client/usb_libusb.cpp
8@@ -30,7 +30,7 @@
9 #include <thread>
10 #include <unordered_map>
11
12-#include <libusb/libusb.h>
13+#include <libusb-1.0/libusb.h>
14
15 #include <android-base/file.h>
16 #include <android-base/logging.h>
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch
deleted file mode 100644
index e71af86..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch
+++ /dev/null
@@ -1,18 +0,0 @@
1Description: Update log file directory.
2Author: Umang Parmar <umangjparmar@gmail.com>
3Last Updated: 2018-05-17
4
5--- a/adb/adb_utils.cpp
6+++ b/adb/adb_utils.cpp
7@@ -339,6 +339,11 @@
8
9 return temp_path_utf8 + log_name;
10 #else
11+ std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid());
12+ struct stat st = {0};
13+ if (stat(log_dir.c_str(), &st) == 0) {
14+ return log_dir;
15+ }
16 const char* tmp_dir = getenv("TMPDIR");
17 if (tmp_dir == nullptr) tmp_dir = "/tmp";
18 return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid());
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch
deleted file mode 100644
index 947b526..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1Description: Port simg_dump to Python 3.
2Author: Antonio Russo <antonio.e.russo@gmail.com>
3Forwarded: no
4Last-Update: 2019-01-05
5Origin: https://bugs.debian.org/945646
6
7---
8Index: android-platform-system-core/libsparse/simg_dump.py
9===================================================================
10--- android-platform-system-core.orig/libsparse/simg_dump.py
11+++ android-platform-system-core/libsparse/simg_dump.py
12@@ -1,4 +1,4 @@
13-#! /usr/bin/env python
14+#! /usr/bin/env python3
15
16 # Copyright (C) 2012 The Android Open Source Project
17 #
18@@ -14,7 +14,7 @@
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21
22-from __future__ import print_function
23+
24 import csv
25 import getopt
26 import hashlib
27@@ -47,7 +47,7 @@ def main():
28 opts, args = getopt.getopt(sys.argv[1:],
29 "vsc:",
30 ["verbose", "showhash", "csvfile"])
31- except getopt.GetoptError, e:
32+ except getopt.GetoptError as e:
33 print(e)
34 usage(me)
35 for o, a in opts:
36@@ -66,7 +66,7 @@ def main():
37 usage(me)
38
39 if csvfilename:
40- csvfile = open(csvfilename, "wb")
41+ csvfile = open(csvfilename, "w", newline='')
42 csvwriter = csv.writer(csvfile)
43
44 output = verbose or csvfilename or showhash
45@@ -121,7 +121,7 @@ def main():
46 "output offset", "output blocks", "type", "hash"])
47
48 offset = 0
49- for i in xrange(1, total_chunks + 1):
50+ for i in range(1, total_chunks + 1):
51 header_bin = FH.read(12)
52 header = struct.unpack("<2H2I", header_bin)
53 chunk_type = header[0]
54@@ -160,7 +160,7 @@ def main():
55 if showhash:
56 h = hashlib.sha1()
57 data = fill_bin * (blk_sz / 4);
58- for block in xrange(chunk_sz):
59+ for block in range(chunk_sz):
60 h.update(data)
61 curhash = h.hexdigest()
62 elif chunk_type == 0xCAC3:
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch
deleted file mode 100644
index 8de0035..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch
+++ /dev/null
@@ -1,74 +0,0 @@
1Description: Fix incompatibility between <stdatomic.h> and <atomic>
2 This 2 headers combined will cause errors for both GCC and Clang. This patch
3 makes sure only one of them is present at any time.
4Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932
5Bug: https://reviews.llvm.org/D45470
6--- a/libcutils/include/cutils/trace.h
7+++ b/libcutils/include/cutils/trace.h
8@@ -18,7 +18,14 @@
9 #define _LIBS_CUTILS_TRACE_H
10
11 #include <inttypes.h>
12+#ifdef __cplusplus
13+#include <atomic>
14+using std::atomic_bool;
15+using std::atomic_load_explicit;
16+using std::memory_order_acquire;
17+#else
18 #include <stdatomic.h>
19+#endif
20 #include <stdbool.h>
21 #include <stdint.h>
22 #include <stdio.h>
23--- a/libcutils/include/cutils/atomic.h
24+++ b/libcutils/include/cutils/atomic.h
25@@ -19,7 +19,23 @@
26
27 #include <stdint.h>
28 #include <sys/types.h>
29+#ifdef __cplusplus
30+#include <atomic>
31+using std::atomic_compare_exchange_strong_explicit;
32+using std::atomic_fetch_add_explicit;
33+using std::atomic_fetch_or_explicit;
34+using std::atomic_fetch_sub_explicit;
35+using std::atomic_int_least32_t;
36+using std::atomic_load_explicit;
37+using std::atomic_store_explicit;
38+using std::atomic_thread_fence;
39+using std::memory_order::memory_order_acquire;
40+using std::memory_order::memory_order_relaxed;
41+using std::memory_order::memory_order_release;
42+using std::memory_order::memory_order_seq_cst;
43+#else
44 #include <stdatomic.h>
45+#endif
46
47 #ifndef ANDROID_ATOMIC_INLINE
48 #define ANDROID_ATOMIC_INLINE static inline
49--- a/liblog/logger.h
50+++ b/liblog/logger.h
51@@ -16,7 +16,13 @@
52
53 #pragma once
54
55+#ifdef __cplusplus
56+#include <atomic>
57+using std::atomic_int;
58+using std::atomic_uintptr_t;
59+#else
60 #include <stdatomic.h>
61+#endif
62 #include <stdbool.h>
63
64 #include <cutils/list.h>
65--- a/liblog/logger_write.cpp
66+++ b/liblog/logger_write.cpp
67@@ -15,7 +15,6 @@
68 */
69
70 #include <errno.h>
71-#include <stdatomic.h>
72 #include <stdlib.h>
73 #include <string.h>
74 #include <sys/time.h>
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch
deleted file mode 100644
index 5e239b7..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1Description: Turn #error into exceptions
2 So the library can be built on non-Linux platforms too, although can't
3 guarauntee its functionality regarding that piece of code.
4--- a/base/file.cpp
5+++ b/base/file.cpp
6@@ -422,7 +422,8 @@
7 path[PATH_MAX - 1] = 0;
8 return path;
9 #else
10-#error unknown OS
11+#include <stdexcept>
12+ throw std::runtime_error(std::string("Unknown OS!"));
13 #endif
14 }
15
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch
deleted file mode 100644
index a14261a..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch
+++ /dev/null
@@ -1,18 +0,0 @@
1Description: Use Python 3 for `mkbootimg`
2Bug: https://android.googlesource.com/platform/system/core/+/c434cf82d526f07cd3dcebf53582eeddf12b0a74
3--- a/mkbootimg/mkbootimg.py
4+++ b/mkbootimg/mkbootimg.py
5@@ -1,4 +1,4 @@
6-#!/usr/bin/env python
7+#!/usr/bin/python3
8 # Copyright 2015, The Android Open Source Project
9 #
10 # Licensed under the Apache License, Version 2.0 (the "License");
11--- a/mkbootimg/unpack_bootimg.py
12+++ b/mkbootimg/unpack_bootimg.py
13@@ -1,4 +1,4 @@
14-#!/usr/bin/env python
15+#!/usr/bin/python3
16 # Copyright 2018, The Android Open Source Project
17 #
18 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch
deleted file mode 100644
index 5e153b0..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1Description: code uses C99/C++20 constructs that g++ does not support
2 $ g++ liblog/fake_writer.cpp -o liblog/fake_writer.o -c -std=c++17 -fPIC -Iliblog/include -Iinclude -DLIBLOG_LOG_TAG=1006 -DFAKE_LOG_DEVICE=1 -DSNET_EVENT_LOG_TAG=1397638484
3liblog/fake_writer.cpp:36:5: error: expected primary-expression before ‘.’ token
4 .context.priv = &logFds,
5 ^
6 This is an ugly hack. The actual fix is probably to compile using
7 clang. Otherwise, these .context.priv elements shuld be initialized
8 in a different way.
9
10Forwarded: not-needed
11
12--- a/liblog/fake_writer.cpp
13+++ b/liblog/fake_writer.cpp
14@@ -33,7 +33,6 @@
15
16 struct android_log_transport_write fakeLoggerWrite = {
17 .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node},
18- .context.priv = &logFds,
19 .name = "fake",
20 .available = NULL,
21 .open = fakeOpen,
22--- a/liblog/stderr_write.cpp
23+++ b/liblog/stderr_write.cpp
24@@ -56,7 +56,6 @@
25
26 struct android_log_transport_write stderrLoggerWrite = {
27 .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node},
28- .context.priv = NULL,
29 .name = "stderr",
30 .available = stderrAvailable,
31 .open = stderrOpen,
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch
deleted file mode 100644
index d2ba525..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1From d133fc2c71fb6b0358af453b03bcb6d1874e902a Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 12:25:40 +0100
4Subject: [PATCH 01/15] patching adb.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/adb.mk | 12 +++++++-----
24 1 file changed, 7 insertions(+), 5 deletions(-)
25
26diff --git a/debian/adb.mk b/debian/adb.mk
27index 8dbacf9a..97c9d6ca 100644
28--- a/debian/adb.mk
29+++ b/debian/adb.mk
30@@ -1,3 +1,4 @@
31+include ../../rules_yocto.mk
32 NAME = adb
33
34 SOURCES = client/adb_client.cpp \
35@@ -12,10 +13,10 @@ SOURCES = client/adb_client.cpp \
36
37 SOURCES := $(foreach source, $(SOURCES), adb/$(source))
38 CXXFLAGS += -std=gnu++2a
39-CPPFLAGS += -Iinclude -Iadb -Ibase/include \
40+CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ \
41 -DADB_VERSION='"$(DEB_VERSION)"' -DADB_HOST=1 -D_GNU_SOURCE
42-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=. \
43- -lpthread -L. -ladb -lbase
44+LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
45+ -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -ladb -lbase
46
47 # -latomic should be the last library specified
48 # https://github.com/android/ndk/issues/589
49@@ -24,7 +25,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
50 endif
51
52 build: $(SOURCES)
53- $(CXX) $^ -o adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
54+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb
55+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
56
57 clean:
58- $(RM) adb/$(NAME)
59+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME)
60--
612.36.1.vfs.0.0
62
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch
deleted file mode 100644
index 1281caa..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From f802e7685cfbdd66d74da2975b3a1c6d77f1a2de Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 12:28:10 +0100
4Subject: [PATCH 02/15] libadb.mk: modifications to make it build in yocto
5 environment
6
7Adding an include file that is setting the common flags.
8Changed the cppflag to include the headers from other components
9of android-tools
10
11Modified LDflags so that the libraries that are coming from other android-tools
12are searched in the output folder.
13
14Modified the build rule so that it outputs the binary to the OUT_DIR
15
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libadb.mk | 11 ++++++-----
19 1 file changed, 6 insertions(+), 5 deletions(-)
20
21diff --git a/debian/libadb.mk b/debian/libadb.mk
22index ae240c98..db5da353 100644
23--- a/debian/libadb.mk
24+++ b/debian/libadb.mk
25@@ -1,3 +1,4 @@
26+include ../../rules_yocto.mk
27 NAME := libadb
28
29 LIBADB_SRC_FILES := \
30@@ -43,18 +44,18 @@ CPPFLAGS += \
31 -Ibase/include \
32 -Idiagnose_usb/include \
33 -Ilibcrypto_utils/include \
34- -Iinclude \
35+ -Iinclude -I$(OUT_DIR)/usr/include \
36 -DPLATFORM_TOOLS_VERSION='"$(PLATFORM_TOOLS_VERSION)"' \
37 -DADB_HOST=1 -DADB_VERSION='"$(DEB_VERSION)"'
38
39 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
40 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
41- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android -lcrypto \
42- -lpthread -L. -lbase -lcutils -lcrypto_utils -lusb-1.0
43+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lcrypto \
44+ -lpthread -lbase -lcutils -lcrypto_utils -lusb-1.0
45
46 $(NAME).so: $(SOURCES)
47- $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
48- ln -s $(NAME).so.0 $(NAME).so
49+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
50+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
51
52 transport_mdns_unsupported.cpp:
53 echo 'void init_mdns_transport_discovery(void) {}' > transport_mdns_unsupported.cpp
54--
552.36.1.vfs.0.0
56
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch
deleted file mode 100644
index 56c25ea..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch
+++ /dev/null
@@ -1,61 +0,0 @@
1From 4fdd086c2e9c85bc5a367a861696191e190cebc9 Mon Sep 17 00:00:00 2001
2From: Nisha Parrakat <Nisha.Parrakat@kpit.com>
3Date: Thu, 2 Mar 2023 17:20:48 +0100
4Subject: [PATCH 03/15] socket.h: removing dependency of gtest
5
6Removed the dependency of gtest on the build of fastboot binary.
7Fixes below error
8
9In file included from fastboot/fastboot.cpp:70:
10| In file included from fastboot/tcp.h:36:
11| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found
12| #include <gtest/gtest_prod.h>
13| ^~~~~~~~~~~~~~~~~~~~
14| 1 error generated.
15| In file included from fastboot/socket.cpp:29:
16| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found
17| #include <gtest/gtest_prod.h>
18| ^~~~~~~~~~~~~~~~~~~~
19| 1 error generated.
20| In file included from fastboot/tcp.cpp:29:
21| In file included from fastboot/tcp.h:36:
22| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found
23| #include <gtest/gtest_prod.h>
24| ^~~~~~~~~~~~~~~~~~~~
25| 1 error generated.
26| In file included from fastboot/udp.cpp:31:
27| In file included from fastboot/udp.h:34:
28| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found
29| #include <gtest/gtest_prod.h>
30| ^~~~~~~~~~~~~~~~~~~~
31| 1 error generated.
32
33Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
34---
35 fastboot/socket.h | 3 ---
36 1 file changed, 3 deletions(-)
37
38diff --git a/fastboot/socket.h b/fastboot/socket.h
39index e791f2c8..671fc115 100644
40--- a/fastboot/socket.h
41+++ b/fastboot/socket.h
42@@ -40,7 +40,6 @@
43
44 #include <android-base/macros.h>
45 #include <cutils/sockets.h>
46-#include <gtest/gtest_prod.h>
47
48 // Socket interface to be implemented for each platform.
49 class Socket {
50@@ -119,8 +118,6 @@ class Socket {
51 socket_send_buffers_function_ = &socket_send_buffers;
52
53 private:
54- FRIEND_TEST(SocketTest, TestTcpSendBuffers);
55- FRIEND_TEST(SocketTest, TestUdpSendBuffers);
56
57 DISALLOW_COPY_AND_ASSIGN(Socket);
58 };
59--
602.36.1.vfs.0.0
61
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch
deleted file mode 100644
index 82ec560..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1From e826f68c68e05b0f5cc3b3c10d7d9e4deb135114 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:14:15 +0100
4Subject: [PATCH 04/15] patching fastboot.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/fastboot.mk | 12 +++++++-----
24 1 file changed, 7 insertions(+), 5 deletions(-)
25
26diff --git a/debian/fastboot.mk b/debian/fastboot.mk
27index d1aba626..e75fa87c 100644
28--- a/debian/fastboot.mk
29+++ b/debian/fastboot.mk
30@@ -1,3 +1,4 @@
31+include ../../rules_yocto.mk
32 NAME = fastboot
33 fastboot_SOURCES = \
34 bootimg_utils.cpp \
35@@ -38,11 +39,11 @@ CPPFLAGS += \
36 -Ifs_mgr/liblp/include \
37 -I/usr/include/android/openssl \
38 -Ilibsparse/include \
39- -Ilibziparchive/include
40+ -Ilibziparchive/include -I$(OUT_DIR)/usr/include/
41 LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
42 -fuse-ld=gold \
43- -Wl,-rpath-link=. \
44- -L. -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \
45+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
46+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \
47 -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
48 -l7z \
49
50@@ -53,7 +54,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
51 endif
52
53 build: $(SOURCES)
54- $(CXX) $^ -o fastboot/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
55+ mkdir --parents $(OUT_DIR)/usr/bin/fastboot
56+ $(CXX) $^ -o $(OUT_DIR)/usr/bin/fastboot/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
57
58 clean:
59- $(RM) fastboot/$(NAME)
60+ $(RM) $(OUT_DIR)/usr/bin/fastboot/$(NAME)
61--
622.36.1.vfs.0.0
63
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
deleted file mode 100644
index d465ad6..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From a4839f29e1286b0c53208a45b9c237d81021f829 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:15:47 +0100
4Subject: [PATCH 05/15] fastboot: don't use sparse_file_import_auto() in
5 load_buf_fd()
6
7upstream commit taken as below Original Issue link https://android-review.googlesource.com/c/platform/system/core/+/1123485
8
9Commit taken below:
10
11fastboot: don't use sparse_file_import_auto() in load_buf_fd()
12
13load_buf_fd() attempts to find the size of the file that it is about
14to load by first calling sparse_file_import_auto() then using
15sparse_file_len() upon success or falling back to the file size on the
16filesystem on failure.
17
18This is problematic however as sparse_file_import_auto() creates a
19sparse_file out of the normal file, but does not resparse it, so an
20assertion fails during the sparse_file_len() call.
21
22This is fixed by using sparse_file_import() instead. This will fail
23in the case that the file is not sparse and the call to
24sparse_file_len() will be properly skipped.
25
26Bug: 140538105
27Test: flash blueline factory image with assertions enabled in
28 libsparse/sparse.cpp
29
30Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
31
32https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec
33Upstream-Status: Backport [commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec]
34Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
35---
36 fastboot/fastboot.cpp | 2 +-
37 1 file changed, 1 insertion(+), 1 deletion(-)
38
39diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
40index 3b7b5571..0ae9402e 100644
41--- a/fastboot/fastboot.cpp
42+++ b/fastboot/fastboot.cpp
43@@ -869,7 +869,7 @@ static bool load_buf_fd(int fd, struct fastboot_buffer* buf) {
44 return false;
45 }
46
47- if (sparse_file* s = sparse_file_import_auto(fd, false, false)) {
48+ if (sparse_file* s = sparse_file_import(fd, false, false)) {
49 buf->image_size = sparse_file_len(s, false, false);
50 sparse_file_destroy(s);
51 } else {
52--
532.36.1.vfs.0.0
54
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch
deleted file mode 100644
index 6211f04..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From 22c7140dc170ecb26bde33fed4c9249b164f8d3c Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:19:08 +0100
4Subject: [PATCH 06/15] libbase.mk: modifications to make it build in yocto
5 environment
6
7Adding an include file that is setting the common flags.
8Changed the cppflag to include the headers from other components
9of android-tools
10
11Modified LDflags so that the libraries that are coming from other android-tools
12are searched in the output folder.
13
14Modified the build rule so that it outputs the binary to the OUT_DIR
15
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libbase.mk | 8 +++++---
19 1 file changed, 5 insertions(+), 3 deletions(-)
20
21diff --git a/debian/libbase.mk b/debian/libbase.mk
22index 80da48f3..e6c3e365 100644
23--- a/debian/libbase.mk
24+++ b/debian/libbase.mk
25@@ -1,3 +1,4 @@
26+include ../../rules_yocto.mk
27 NAME = libbase
28 SOURCES = \
29 chrono_utils.cpp \
30@@ -20,8 +21,9 @@ CPPFLAGS += -Iinclude -Ibase/include
31 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0
32
33 build: $(SOURCES)
34- $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
35- ln -s $(NAME).so.0 $(NAME).so
36+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
37+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
38+ cp -r base/include/* $(OUT_DIR)/usr/include/
39
40 clean:
41- $(RM) $(NAME).so*
42+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
43--
442.36.1.vfs.0.0
45
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch
deleted file mode 100644
index af92726..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From cae154ec12a864ada8372b393fceb1d682c78c60 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 14:38:05 +0100
4Subject: [PATCH 07/15] libcrypto_utils.mk: modifications to make it build in
5 yocto environment
6
7Adding an include file that is setting the common flags.
8Changed the cppflag to include the headers from other components
9of android-tools
10
11Modified LDflags so that the libraries that are coming from other android-tools
12are searched in the output folder.
13
14Modified the build rule so that it outputs the binary and header to the OUT_DIR
15
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libcrypto_utils.mk | 14 ++++++++------
19 1 file changed, 8 insertions(+), 6 deletions(-)
20
21diff --git a/debian/libcrypto_utils.mk b/debian/libcrypto_utils.mk
22index 3afd4124..80c52f30 100644
23--- a/debian/libcrypto_utils.mk
24+++ b/debian/libcrypto_utils.mk
25@@ -1,15 +1,17 @@
26+include ../../rules_yocto.mk
27 NAME:= libcrypto_utils
28 SOURCES := android_pubkey.c
29 SOURCES := $(foreach source, $(SOURCES), libcrypto_utils/$(source))
30-CPPFLAGS += -Ilibcrypto_utils/include -Iinclude
31+CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -I$(OUT_DIR)/usr/include
32 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
33 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
34- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
35- -lcrypto -Wl,-z,defs
36+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
37+ -l:libcrypto.so.0 -Wl,-z,defs
38
39 build: $(SOURCES)
40- $(CC) $^ -o $(NAME).so.0 $(CPPFLAGS) $(LDFLAGS)
41- ln -s $(NAME).so.0 $(NAME).so
42+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CPPFLAGS) $(LDFLAGS)
43+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
44+ cp -r libcrypto_utils/include/* $(OUT_DIR)/usr/include/
45
46 clean:
47- $(RM) $(NAME).so*
48+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
49--
502.36.1.vfs.0.0
51
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch
deleted file mode 100644
index b876229..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 4af9cc9e93e5cb09583c0fedeccae3fa195dbe7b Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:26:08 +0100
4Subject: [PATCH 08/15] libcutils: modifications to make it build in yocto
5 environment
6---
7 debian/libcutils.mk | 10 ++++++----
8 1 file changed, 6 insertions(+), 4 deletions(-)
9
10diff --git a/debian/libcutils.mk b/debian/libcutils.mk
11index 7cd18d87..bb45fb57 100644
12--- a/debian/libcutils.mk
13+++ b/debian/libcutils.mk
14@@ -1,3 +1,4 @@
15+include ../../rules_yocto.mk
16 NAME = libcutils
17
18 # copied from libcutils/Android.bp
19@@ -50,14 +51,15 @@ CPPFLAGS += \
20 -Iinclude \
21
22 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
23- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -lpthread -L. -llog -lbase
24+ -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -llog -lbase
25
26 build: $(COBJECTS) $(CXXOBJECTS)
27- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS)
28- ln -s $(NAME).so.0 $(NAME).so
29+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS)
30+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
31+ cp -r libcutils/include/cutils $(OUT_DIR)/usr/include/
32
33 clean:
34- $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so*
35+ $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
36
37 $(COBJECTS): %.o: %.c
38 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
39--
402.36.1.vfs.0.0
41
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
deleted file mode 100644
index ad9b8dd..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From bea40821d787ca31b38d5879fbf751be1dbea622 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:33:30 +0100
4Subject: [PATCH 09/15] patching img2simg.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/img2simg.mk | 11 ++++++-----
24 1 file changed, 6 insertions(+), 5 deletions(-)
25
26diff --git a/debian/img2simg.mk b/debian/img2simg.mk
27index f1036cef..94772381 100644
28--- a/debian/img2simg.mk
29+++ b/debian/img2simg.mk
30@@ -1,13 +1,15 @@
31+include ../../rules_yocto.mk
32 NAME = img2simg
33 SOURCES = img2simg.cpp
34 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source))
35 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17
36-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
37- -Wl,-rpath-link=. \
38- -L. -lsparse
39+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
40+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
41+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lsparse
42
43 build: $(SOURCES)
44- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS)
45+ mkdir --parents $(OUT_DIR)/usr/bin
46+ $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS)
47
48 clean:
49- $(RM) libsparse/$(NAME)
50+ $(RM) $(OUT_DIR)/usr/bin/$(NAME)
51--
522.36.1.vfs.0.0
53
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
deleted file mode 100644
index b7a72b8..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 08441cf4334b911dba8c493dca3b1e2166c7d322 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:34:34 +0100
4Subject: [PATCH 10/15] patching simg2img.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/simg2img.mk | 11 ++++++-----
24 1 file changed, 6 insertions(+), 5 deletions(-)
25
26diff --git a/debian/simg2img.mk b/debian/simg2img.mk
27index 07fb56b4..d319c87e 100644
28--- a/debian/simg2img.mk
29+++ b/debian/simg2img.mk
30@@ -1,13 +1,15 @@
31+include ../../rules_yocto.mk
32 NAME = simg2img
33 SOURCES = simg2img.cpp sparse_crc32.cpp
34 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source))
35 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17
36-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
37- -Wl,-rpath-link=. \
38- -L. -lsparse
39+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
40+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
41+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lsparse
42
43 build: $(SOURCES)
44- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS)
45+ mkdir --parents $(OUT_DIR)/usr/bin
46+ $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS)
47
48 clean:
49- $(RM) libsparse/$(NAME)
50+ $(RM) $(OUT_DIR)/usr/bin/$(NAME)
51--
522.36.1.vfs.0.0
53
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch
deleted file mode 100644
index 7a37757..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 99e46ec157e6fb912258ac6506896196e53d790b Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:35:44 +0100
4Subject: [PATCH 11/15] patching liblog.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/liblog.mk | 8 +++++---
24 1 file changed, 5 insertions(+), 3 deletions(-)
25
26diff --git a/debian/liblog.mk b/debian/liblog.mk
27index eb1909b9..3b40d710 100644
28--- a/debian/liblog.mk
29+++ b/debian/liblog.mk
30@@ -1,3 +1,4 @@
31+include ../../rules_yocto.mk
32 NAME = liblog
33
34 # copied from liblog/Android.bp
35@@ -39,11 +40,12 @@ CPPFLAGS += \
36 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread
37
38 build: $(COBJECTS) $(CXXOBJECTS)
39- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS)
40- ln -s $(NAME).so.0 $(NAME).so
41+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS)
42+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
43+ cp -r liblog/include/* $(OUT_DIR)/usr/include/
44
45 clean:
46- $(RM) $(COBJECTS) $(CXXOBJECTS) $(NAME).so*
47+ $(RM) $(COBJECTS) $(CXXOBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
48
49 $(COBJECTS): %.o: %.c
50 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
51--
522.36.1.vfs.0.0
53
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch
deleted file mode 100644
index 029cc1c..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch
+++ /dev/null
@@ -1,58 +0,0 @@
1From 65ddf7ea7daae721b2d331164155542820ed3e33 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:36:58 +0100
4Subject: [PATCH 12/15] patching libsparse.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/libsparse.mk | 9 +++++----
24 1 file changed, 5 insertions(+), 4 deletions(-)
25
26diff --git a/debian/libsparse.mk b/debian/libsparse.mk
27index de280def..64caa45f 100644
28--- a/debian/libsparse.mk
29+++ b/debian/libsparse.mk
30@@ -1,3 +1,4 @@
31+include ../../rules_yocto.mk
32 NAME = libsparse
33 SOURCES = \
34 backed_block.cpp \
35@@ -18,16 +19,16 @@ LDFLAGS += \
36 -shared -Wl,-soname,$(NAME).so.0 \
37 -lz \
38 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
39- -L. \
40+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
41 -lbase
42
43
44 build: $(COBJECTS) $(CXXOBJECTS)
45- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS)
46- ln -s $(NAME).so.0 $(NAME).so
47+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS)
48+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
49
50 clean:
51- $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so*
52+ $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
53
54 $(COBJECTS): %.o: %.c
55 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
56--
572.36.1.vfs.0.0
58
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch
deleted file mode 100644
index b49ec3b..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From ae2bf1925fe02ea040005df27842c77c6d02b051 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:39:24 +0100
4Subject: [PATCH 13/15] patching libziparchive.mk to build in yocto
5 environment.
6
7Changes include:
8Introduced an output folder which will keep all the outputs from the
9android-tools.
10
11Adding an include file that is setting the common flags.
12Changed the cppflag to include the headers from other components
13of android-tools
14
15Modified LDflags so that the libraries that are coming from other android-tools
16are searched in the output folder.
17
18Modified the build rule so that it outputs the binary to the OUT_DIR
19
20Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
21
22Upstream-Status: Pending
23---
24 debian/libziparchive.mk | 12 +++++++-----
25 1 file changed, 7 insertions(+), 5 deletions(-)
26
27diff --git a/debian/libziparchive.mk b/debian/libziparchive.mk
28index 803ea58e..6a697059 100644
29--- a/debian/libziparchive.mk
30+++ b/debian/libziparchive.mk
31@@ -1,3 +1,4 @@
32+include ../../rules_yocto.mk
33 NAME = libziparchive
34 SOURCES = zip_archive.cc \
35 zip_archive_stream_entry.cc\
36@@ -5,14 +6,15 @@ SOURCES = zip_archive.cc \
37 SOURCES := $(foreach source, $(SOURCES), libziparchive/$(source))
38 CXXFLAGS += -std=gnu++17
39 CPPFLAGS += -DZLIB_CONST -D_FILE_OFFSET_BITS=64 \
40- -Iinclude -Ibase/include -Ilibziparchive/include
41+ -Iinclude -Ibase/include -Ilibziparchive/include -I$(OUT_DIR)/usr/include/
42 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
43 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
44- -lz -L. -llog -lbase
45+ -lz -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -llog -lbase
46
47 build: $(SOURCES)
48- $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
49- ln -s $(NAME).so.0 $(NAME).so
50+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
51+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
52+ cp -r libziparchive/include/* $(OUT_DIR)/usr/include/
53
54 clean:
55- $(RM) $(NAME).so*
56+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
57--
582.36.1.vfs.0.0
59
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch
deleted file mode 100644
index 433caf2..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch
+++ /dev/null
@@ -1,69 +0,0 @@
1From a99b74f25c7f786e26b5400218090d86596d4541 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:40:32 +0100
4Subject: [PATCH 14/15] patching libbacktrace.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/libbacktrace.mk | 14 +++++++-------
24 1 file changed, 7 insertions(+), 7 deletions(-)
25
26diff --git a/debian/libbacktrace.mk b/debian/libbacktrace.mk
27index 330d211c..229b39d9 100644
28--- a/debian/libbacktrace.mk
29+++ b/debian/libbacktrace.mk
30@@ -1,5 +1,5 @@
31
32-include /usr/share/dpkg/architecture.mk
33+include ../../rules_yocto.mk
34
35 NAME = libbacktrace
36
37@@ -88,11 +88,11 @@ CPPFLAGS += \
38 -Ilibprocinfo/include \
39 -Ilibunwindstack/include \
40 -I/usr/include/android/lzma \
41- -I/usr/include/android/unwind
42+ -I$(OUT_DIR)/usr/include/android/libunwind
43 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
44 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
45- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android -lunwind \
46- -L. -lbase -llog -lpthread -l7z
47+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lunwind \
48+ -lbase -llog -lpthread -l7z
49
50 # -latomic should be the last library specified
51 # https://github.com/android/ndk/issues/589
52@@ -104,11 +104,11 @@ ifeq ($(DEB_HOST_ARCH), mipsel)
53 endif
54
55 build: $(COBJECTS) $(CXXOBJECTS) $(OBJECTS_ASSEMBLY)
56- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS)
57- ln -s $(NAME).so.0 $(NAME).so
58+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS)
59+ ln -sf $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(NAME).so
60
61 clean:
62- $(RM) $(COBJECTS) $(CXXOBJECTS) $(NAME).so*
63+ $(RM) $(COBJECTS) $(CXXOBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
64
65 $(CXXOBJECTS): %.o: %.cpp
66 $(CXX) $< -o $@ $(CXXFLAGS) $(CPPFLAGS)
67--
682.36.1.vfs.0.0
69
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch
deleted file mode 100644
index d8fee66..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 19a16829ef7b7ffd6466b9b90585d667a1663969 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:43:50 +0100
4Subject: [PATCH 15/15] Use namespace std to compile libbacktrace
5
6To Fix the below error
7
8 In file included from libunwindstack/DwarfSection.cpp:21:
9| libunwindstack/include/unwindstack/DwarfMemory.h:32:29: error: unknown type name 'size_t'; did you mean 'std::size_t'?
10| bool ReadBytes(void* dst, size_t num_bytes);
11| ^~~~~~
12| std::size_t
13---
14 libunwindstack/include/unwindstack/DwarfMemory.h | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/libunwindstack/include/unwindstack/DwarfMemory.h b/libunwindstack/include/unwindstack/DwarfMemory.h
18index 244c0e12..0a3fefeb 100644
19--- a/libunwindstack/include/unwindstack/DwarfMemory.h
20+++ b/libunwindstack/include/unwindstack/DwarfMemory.h
21@@ -23,7 +23,7 @@ namespace unwindstack {
22
23 // Forward declarations.
24 class Memory;
25-
26+using namespace std;
27 class DwarfMemory {
28 public:
29 DwarfMemory(Memory* memory) : memory_(memory) {}
30--
312.36.1.vfs.0.0
32
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch
deleted file mode 100644
index 8819431..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch
+++ /dev/null
@@ -1,161 +0,0 @@
1From 1c836e4402ae170b3e0bf31da9012b7a3b1c40a1 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Wed, 8 Mar 2023 15:21:49 +0100
4Subject: [PATCH] Adapt adbd to work with yocto
5
6Co-authored-by: JJ Robertson <jrobertson@snap.com>
7Co-authored-by: Wejdene Smida <wsmida@snap.com>
8Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
9---
10 adb/daemon/file_sync_service.cpp | 4 ++--
11 adb/daemon/main.cpp | 4 ++--
12 adb/daemon/reboot_service.cpp | 5 ++++-
13 adb/daemon/set_verity_enable_state_service.cpp | 6 +++++-
14 adb/daemon/shell_service.cpp | 4 ++++
15 adb/types.h | 1 +
16 6 files changed, 18 insertions(+), 6 deletions(-)
17
18diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp
19index e82a51f2..ba112cbe 100644
20--- a/adb/daemon/file_sync_service.cpp
21+++ b/adb/daemon/file_sync_service.cpp
22@@ -111,7 +111,7 @@ static bool secure_mkdirs(const std::string& path) {
23 partial_path += path_component;
24
25 if (should_use_fs_config(partial_path)) {
26- fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
27+ // fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
28 }
29 if (adb_mkdir(partial_path.c_str(), mode) == -1) {
30 if (errno != EEXIST) {
31@@ -434,7 +434,7 @@ static bool do_send(int s, const std::string& spec, std::vector<char>& buffer) {
32 uint64_t capabilities = 0;
33 if (should_use_fs_config(path)) {
34 unsigned int broken_api_hack = mode;
35- fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities);
36+ // fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities);
37 mode = broken_api_hack;
38 }
39
40diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp
41index e5a49171..c75263c4 100644
42--- a/adb/daemon/main.cpp
43+++ b/adb/daemon/main.cpp
44@@ -191,6 +191,8 @@ int adbd_main(int server_port) {
45 umask(0);
46
47 signal(SIGPIPE, SIG_IGN);
48+ signal(SIGINT, SIG_DFL);
49+ signal(SIGQUIT, SIG_DFL);
50
51 #if defined(__BIONIC__)
52 auto fdsan_level = android_fdsan_get_error_level();
53@@ -232,13 +234,11 @@ int adbd_main(int server_port) {
54
55 bool is_usb = false;
56
57-#if defined(__ANDROID__)
58 if (access(USB_FFS_ADB_EP0, F_OK) == 0) {
59 // Listen on USB.
60 usb_init();
61 is_usb = true;
62 }
63-#endif
64
65 // If one of these properties is set, also listen on that port.
66 // If one of the properties isn't set and we couldn't listen on usb, listen
67diff --git a/adb/daemon/reboot_service.cpp b/adb/daemon/reboot_service.cpp
68index a5a11b86..6bd069d4 100644
69--- a/adb/daemon/reboot_service.cpp
70+++ b/adb/daemon/reboot_service.cpp
71@@ -28,7 +28,9 @@
72 #include <android-base/logging.h>
73 #include <android-base/properties.h>
74 #include <android-base/stringprintf.h>
75-#include <bootloader_message/bootloader_message.h>
76+// #include <bootloader_message/bootloader_message.h>
77+#include <linux/reboot.h>
78+#include <sys/signal.h>
79 #include <cutils/android_reboot.h>
80
81 #include "adb_io.h"
82@@ -76,6 +78,7 @@ void reboot_service(unique_fd fd, const std::string& arg) {
83 return;
84 }
85 }
86+ syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_arg.c_str());
87 // Don't return early. Give the reboot command time to take effect
88 // to avoid messing up scripts which do "adb reboot && adb wait-for-device"
89 while (true) {
90diff --git a/adb/daemon/set_verity_enable_state_service.cpp b/adb/daemon/set_verity_enable_state_service.cpp
91index 889229fe..51e9be93 100644
92--- a/adb/daemon/set_verity_enable_state_service.cpp
93+++ b/adb/daemon/set_verity_enable_state_service.cpp
94@@ -22,7 +22,7 @@
95 #include <errno.h>
96 #include <fcntl.h>
97 #include <inttypes.h>
98-#include <libavb_user/libavb_user.h>
99+// #include <libavb_user/libavb_user.h>
100 #include <stdarg.h>
101 #include <stdio.h>
102 #include <sys/mount.h>
103@@ -65,6 +65,7 @@ static bool make_block_device_writable(const std::string& dev) {
104 /* Turn verity on/off */
105 static bool set_verity_enabled_state(int fd, const char* block_device, const char* mount_point,
106 bool enable) {
107+#if defined(__ANDROID__)
108 if (!make_block_device_writable(block_device)) {
109 WriteFdFmt(fd, "Could not make block device %s writable (%s).\n",
110 block_device, strerror(errno));
111@@ -115,6 +116,7 @@ static bool set_verity_enabled_state(int fd, const char* block_device, const cha
112 mount_point, strerror(errno));
113 }
114 WriteFdFmt(fd, "Verity %s on %s\n", enable ? "enabled" : "disabled", mount_point);
115+#endif
116 return true;
117 }
118
119@@ -126,6 +128,7 @@ static std::string get_ab_suffix() {
120 return android::base::GetProperty("ro.boot.slot_suffix", "");
121 }
122
123+#if defined(__ANDROID__)
124 static bool is_avb_device_locked() {
125 return android::base::GetProperty("ro.boot.vbmeta.device_state", "") == "locked";
126 }
127@@ -245,3 +248,4 @@ void set_verity_enabled_state_service(unique_fd fd, bool enable) {
128 WriteFdExactly(fd.get(), "Now reboot your device for settings to take effect\n");
129 }
130 }
131+#endif
132diff --git a/adb/daemon/shell_service.cpp b/adb/daemon/shell_service.cpp
133index 3c8f3939..84f4f54d 100644
134--- a/adb/daemon/shell_service.cpp
135+++ b/adb/daemon/shell_service.cpp
136@@ -264,6 +264,10 @@ bool Subprocess::ForkAndExec(std::string* error) {
137 env["TMPDIR"] = "/data/local/tmp";
138 env["USER"] = pw->pw_name;
139 }
140+ if (env.find("PS1") == env.end()) {
141+ env["PS1"] = "\\h:\\w\\$ ";
142+ }
143+
144
145 if (!terminal_type_.empty()) {
146 env["TERM"] = terminal_type_;
147diff --git a/adb/types.h b/adb/types.h
148index 6af4a150..9efe223b 100644
149--- a/adb/types.h
150+++ b/adb/types.h
151@@ -20,6 +20,7 @@
152 #include <cstring>
153 #include <deque>
154 #include <memory>
155+#include <string>
156 #include <type_traits>
157 #include <utility>
158 #include <vector>
159--
1602.36.1.vfs.0.0
161
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch
deleted file mode 100644
index 668338d..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1libcrypto_utils.mk: modifications to make it build in yocto environment
2
3Adding an include file that is setting the common flags.
4Changed the cppflag to include the headers from other components
5of android-tools
6
7Modified LDflags so that the libraries that are coming from other android-tools
8are searched in the output folder.
9
10Modified the build rule so that it outputs the binary and header to the OUT_DIR
11
12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
13
14--- git/debian/libcrypto_utils.mk 2021-04-30 14:18:54.071379767 +0200
15+++ git/debian/libcrypto_utils.mk 2021-04-30 14:22:46.179047308 +0200
16@@ -1,15 +1,17 @@
17+include ../../rules_yocto.mk
18 NAME:= libcrypto_utils
19 SOURCES := android_pubkey.c
20 SOURCES := $(foreach source, $(SOURCES), libcrypto_utils/$(source))
21-CPPFLAGS += -Ilibcrypto_utils/include -Iinclude
22+CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -I$(OUT_DIR)/usr/include
23 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
24 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
25- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
26- -lcrypto -Wl,-z,defs
27+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
28+ -l:libcrypto.so.0 -Wl,-z,defs
29
30 build: $(SOURCES)
31- $(CC) $^ -o $(NAME).so.0 $(CPPFLAGS) $(LDFLAGS)
32- ln -s $(NAME).so.0 $(NAME).so
33+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CPPFLAGS) $(LDFLAGS)
34+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
35+ cp -r libcrypto_utils/include/* $(OUT_DIR)/usr/include/
36
37 clean:
38- $(RM) $(NAME).so*
39+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch
deleted file mode 100644
index cc1a8cb..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1Description: Fixes "20150704-CVE-2015-3239"
2Index: pkg-libunwind/include/dwarf_i.h
3===================================================================
4--- pkg-libunwind.orig/include/dwarf_i.h 2015-07-04 10:57:29.000000000 +0900
5+++ pkg-libunwind/include/dwarf_i.h 2015-07-04 11:06:08.675616821 +0900
6@@ -20,7 +20,7 @@
7 extern const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH];
8 /* REG is evaluated multiple times; it better be side-effects free! */
9 # define dwarf_to_unw_regnum(reg) \
10- (((reg) <= DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0)
11+ (((reg) < DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0)
12 #endif
13
14 #ifdef UNW_LOCAL_ONLY
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch
deleted file mode 100644
index 8d78faa..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1Description: Replace the legacy __sync built-in functions with __atomic ones
2 libunwind uses the built-in __sync_* functions which are deprecated by GCC and
3 should be replaced by __atomic_* ones. See the official manuals [1].
4 .
5 The legacy __sync functions do not require to specify the memory order but
6 __atomic ones do, so we choose the strongest one: __ATOMIC_SEQ_CST.
7 .
8 We do this because __sync_fetch_and_add() is not supported on armel.
9 .
10 [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
11Author: Kai-Chung Yan ()
12Last-Update: 2016-10-04
13--- a/include/libunwind_i.h
14+++ b/include/libunwind_i.h
15@@ -155,8 +155,8 @@
16 u.vp = addr;
17 return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new);
18 }
19-# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1)
20-# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value)
21+# define fetch_and_add1(_ptr) __atomic_fetch_add(_ptr, 1, __ATOMIC_SEQ_CST)
22+# define fetch_and_add(_ptr, value) __atomic_fetch_add(_ptr, value, __ATOMIC_SEQ_CST)
23 # define HAVE_CMPXCHG
24 # define HAVE_FETCH_AND_ADD
25 #endif
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/series b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/series
deleted file mode 100644
index 9cac341..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/series
+++ /dev/null
@@ -1,3 +0,0 @@
1user_pt_regs.patch
2legacy_built-in_sync_functions.patch
320150704-CVE-2015-3239_dwarf_i.h.patch
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/user_pt_regs.patch b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/user_pt_regs.patch
deleted file mode 100644
index 8051b6d..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/user_pt_regs.patch
+++ /dev/null
@@ -1,23 +0,0 @@
1Author: Kai-Chung Yan <seamlikok@gmail.com>
2Last-Update: 2016-08-24
3Description: Manual definition of struct user_pt_regs
4 On ARM64, libunwind uses struct user_pt_regs which is not defined in
5 anywhere, which causes FTBFS.
6--- a/src/ptrace/_UPT_access_reg.c
7+++ b/src/ptrace/_UPT_access_reg.c
8@@ -26,6 +26,15 @@
9
10 #include "_UPT_internal.h"
11
12+#if defined(__aarch64__)
13+ struct user_pt_regs {
14+ __u64 regs[31];
15+ __u64 sp;
16+ __u64 pc;
17+ __u64 pstate;
18+ };
19+#endif
20+
21 #if UNW_TARGET_IA64
22 # include <elf.h>
23 # ifdef HAVE_ASM_PTRACE_OFFSETS_H
diff --git a/dynamic-layers/selinux/android-tools/android-tools/rules_yocto.mk b/dynamic-layers/selinux/android-tools/android-tools/rules_yocto.mk
deleted file mode 100644
index 5e217f4..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/rules_yocto.mk
+++ /dev/null
@@ -1,4 +0,0 @@
1CPPFLAGS += -fPIC
2ifndef OUT_DIR
3OUT_DIR = ../../debian/out
4endif
diff --git a/dynamic-layers/selinux/android-tools/android-tools_10.0.0.r36.bb b/dynamic-layers/selinux/android-tools/android-tools_10.0.0.r36.bb
deleted file mode 100644
index f342655..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools_10.0.0.r36.bb
+++ /dev/null
@@ -1,229 +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 libusb squashfs-tools p7zip libselinux"
11
12ANDROID_MIRROR = "android.googlesource.com"
13
14# matches with 10.0.0+r36
15SRCREV_boringssl = "ae2dd49c7cb74d04bdba7c1c9bd62c1e9cdf98f6"
16SRCREV_core = "5aa13b053182b758d7a19db0c83e1b9b5bf1ec2e"
17SRCREV_extras = "d31740f9d0399f8b938e88e58843d966e1cccab6"
18SRCREV_libhardware = "c6925520342a7d37758f85eb1cf3baa20a7b7a18"
19SRCREV_build = "28768b3120f751583a2743101b892f210d4715cf"
20SRCREV_libunwind = "03a963ecf6ea836b38b3537cbcda0ecfd7a77393"
21
22SRC_URI = " \
23 git://salsa.debian.org/android-tools-team/android-platform-external-boringssl;name=boringssl;protocol=https;nobranch=1;destsuffix=git/external/boringssl \
24 git://salsa.debian.org/android-tools-team/android-platform-system-core;name=core;protocol=https;nobranch=1;destsuffix=git/system/core \
25 git://salsa.debian.org/android-tools-team/android-platform-system-extras;name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \
26 git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \
27 git://salsa.debian.org/android-tools-team/android-platform-build.git;name=build;protocol=https;nobranch=1;destsuffix=git/build \
28 git://salsa.debian.org/android-tools-team/android-platform-external-libunwind.git;protocol=https;name=libunwind;nobranch=1;destsuffix=git/external/libunwind \
29"
30
31# Patches copied from android-platform-system-core/debian/patches
32# and applied in the order defined by the "series" file
33SRC_URI += " \
34 file://core-debian/move-log-file-to-proper-dir.patch;patchdir=system/core \
35 file://core-debian/Added-missing-headers.patch;patchdir=system/core \
36 file://core-debian/libusb-header-path.patch;patchdir=system/core \
37 file://core-debian/stdatomic.patch;patchdir=system/core \
38 file://core-debian/Nonnull.patch;patchdir=system/core \
39 file://core-debian/Vector-cast.patch;patchdir=system/core \
40 file://core-debian/use-Python-3-for-mkbootimg.patch;patchdir=system/core \
41 file://core-debian/throw-exception-on-unknown-os.patch;patchdir=system/core \
42 file://core-debian/simg_dump-python3.patch;patchdir=system/core \
43 file://core-debian/fix-attribute-issue-with-gcc.patch;patchdir=system/core \
44 file://core-debian/workaround-error-expected-primary-expression-before-.-token.patch;patchdir=system/core \
45 file://core-debian/fix-gettid-exception-declaration.patch;patchdir=system/core \
46 file://core-debian/fix-build-on-non-x86.patch;patchdir=system/core \
47 file://core-debian/add-missing-headers.patch;patchdir=system/core \
48 file://core-debian/hard-code-build-number.patch;patchdir=system/core \
49 file://core-debian/fix-gcc-11-ftbfs.patch;patchdir=system/core \
50 file://core-debian/fix-gnu-hurd.patch;patchdir=system/core \
51"
52
53# Patches copied from android-platform-external-libunwind/debian/patches
54# and applied in the order defined by the "series" file
55SRC_URI += " \
56 file://libunwind-debian/user_pt_regs.patch;patchdir=external/libunwind \
57 file://libunwind-debian/legacy_built-in_sync_functions.patch;patchdir=external/libunwind \
58 file://libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch;patchdir=external/libunwind \
59"
60
61# meta-clang specific patches + files:
62SRC_URI += " \
63 file://core/0001-patching-adb.mk-to-build-in-yocto-environment.patch;patchdir=system/core \
64 file://core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \
65 file://core/0003-socket.h-removing-dependency-of-gtest.patch;patchdir=system/core \
66 file://core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch;patchdir=system/core \
67 file://core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch;patchdir=system/core \
68 file://core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch;patchdir=system/core \
69 file://core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch;patchdir=system/core \
70 file://core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \
71 file://core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch;patchdir=system/core \
72 file://core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch;patchdir=system/core \
73 file://core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch;patchdir=system/core \
74 file://core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch;patchdir=system/core \
75 file://core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch;patchdir=system/core \
76 file://core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch;patchdir=system/core \
77 file://core/0015-Use-namespace-std-to-compile-libbacktrace.patch;patchdir=system/core \
78 file://core/0016-Adapt-adbd-to-work-with-yocto.patch;patchdir=system/core \
79 file://0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch;patchdir=external/boringssl \
80 file://0001-patching-libundwind-to-build-in-yocto-environment.patch;patchdir=external/libunwind \
81 file://0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch;patchdir=system/extras \
82 file://0002-libfec-change-out_dir-in-makefile.patch;patchdir=system/extras \
83 file://rules_yocto.mk;subdir=git \
84 file://android-tools-adbd.service \
85 file://adbd.mk;subdir=git/system/core/debian \
86"
87
88S = "${WORKDIR}/git"
89B = "${WORKDIR}/${BPN}"
90
91# http://errors.yoctoproject.org/Errors/Details/1debian881/
92ARM_INSTRUCTION_SET:armv4 = "arm"
93ARM_INSTRUCTION_SET:armv5 = "arm"
94
95COMPATIBLE_HOST:powerpc = "(null)"
96COMPATIBLE_HOST:powerpc64 = "(null)"
97COMPATIBLE_HOST:powerpc64le = "(null)"
98
99inherit systemd clang
100
101TOOLCHAIN = "clang"
102TOOLCHAIN:class-native = "clang"
103DEPENDS:append:class-target = "\
104 clang-cross-${TARGET_ARCH} \
105"
106DEPENDS:append:class-native = " clang-native"
107
108SYSTEMD_SERVICE:${PN} = "android-tools-adbd.service"
109
110# Find libbsd headers during native builds
111CC:append:class-native = " -I${STAGING_INCDIR}"
112CC:append:class-nativesdk = " -I${STAGING_INCDIR}"
113
114PREREQUISITE_core = "libbase libsparse liblog libcutils"
115TOOLS_TO_BUILD = "libcrypto_utils libadb libziparchive fastboot adb img2simg simg2img libbacktrace"
116TOOLS_TO_BUILD:append:class-target = " adbd"
117
118# Adb needs sys/capability.h, which is not available for native*
119TOOLS:class-native = "boringssl fastboot ext4_utils mkbootimg"
120TOOLS:class-nativesdk = "boringssl fastboot ext4_utils mkbootimg"
121
122do_compile() {
123
124 case "${HOST_ARCH}" in
125 arm)
126 export android_arch=linux-arm
127 cpu=arm
128 deb_host_arch=arm
129 ;;
130 aarch64)
131 export android_arch=linux-arm64
132 cpu=arm64
133 deb_host_arch=arm64
134 ;;
135 riscv64)
136 export android_arch=linux-riscv64
137 ;;
138 mips|mipsel)
139 export android_arch=linux-mips
140 cpu=mips
141 deb_host_arch=mips
142 ;;
143 mips64|mips64el)
144 export android_arch=linux-mips64
145 cpu=mips64
146 deb_host_arch=mips64
147 ;;
148 powerpc|powerpc64)
149 export android_arch=linux-ppc
150 ;;
151 i586|i686|x86_64)
152 export android_arch=linux-x86
153 cpu=x86_64
154 deb_host_arch=amd64
155 ;;
156 esac
157
158 export SRCDIR=${S}
159
160 oe_runmake -f ${S}/external/boringssl/debian/libcrypto.mk -C ${S}/external/boringssl
161 oe_runmake -f ${S}/external/libunwind/debian/libunwind.mk -C ${S}/external/libunwind CPU=${cpu}
162
163 for tool in ${PREREQUISITE_core}; do
164 oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core
165 done
166
167 for i in `find ${S}/system/extras/debian/ -name "*.mk"`; do
168 oe_runmake -f $i -C ${S}/system/extras
169 done
170
171 for tool in ${TOOLS_TO_BUILD}; do
172 if [ "$tool" = "libbacktrace" ]; then
173 oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core DEB_HOST_ARCH=${deb_host_arch}
174 else
175 oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core
176 fi
177 done
178
179}
180
181do_install() {
182 if echo ${TOOLS_TO_BUILD} | grep -q "ext4_utils" ; then
183 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
184 fi
185
186 if echo ${TOOLS_TO_BUILD} | grep -q "adb " ; then
187 install -d ${D}${bindir}
188 install -m0755 ${S}/debian/out/usr/lib/android/adb/adb ${D}${bindir}
189 fi
190
191 if echo ${TOOLS_TO_BUILD} | grep -q "adbd" ; then
192 install -d ${D}${bindir}
193 install -m0755 ${B}/adbd/adbd ${D}${bindir}
194 fi
195
196 # Outside the if statement to avoid errors during do_package
197 install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
198 ${D}${systemd_unitdir}/system/android-tools-adbd.service
199
200 if echo ${TOOLS_TO_BUILD} | grep -q "fastboot" ; then
201 install -d ${D}${bindir}
202 install -m0755 ${S}/debian/out/usr/bin/fastboot/fastboot ${D}${bindir}
203 fi
204
205 install -d ${D}${libdir}/android/
206 install -m0755 ${S}/debian/out/usr/lib/android/*.so.* ${D}${libdir}/android/
207 if echo ${TOOLS_TO_BUILD} | grep -q "mkbootimg" ; then
208 install -d ${D}${bindir}
209 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
210 fi
211}
212
213PACKAGES += "${PN}-fstools"
214
215RDEPENDS:${BPN} = "${BPN}-conf p7zip"
216
217FILES:${PN}-fstools = "\
218 ${bindir}/ext2simg \
219 ${bindir}/ext4fixup \
220 ${bindir}/img2simg \
221 ${bindir}/make_ext4fs \
222 ${bindir}/simg2img \
223 ${bindir}/simg2simg \
224 ${bindir}/simg_dump \
225 ${bindir}/mkuserimg \
226"
227FILES:${PN} += "${libdir}/android ${libdir}/android/*"
228
229BBCLASSEXTEND = "native"