summaryrefslogtreecommitdiffstats
path: root/dynamic-layers
diff options
context:
space:
mode:
authorEtienne Cordonnier <ecordonnier@snap.com>2023-03-03 11:26:18 +0100
committerKhem Raj <raj.khem@gmail.com>2023-03-07 15:08:02 -0800
commit33604a56dc35a04c6b4233f2030cebc60e8dcfe9 (patch)
treee9c96ec6f78d035420069e76a2b41d438a7b135e /dynamic-layers
parent398d4bc3805ca1c5cbb845aacccdb8999aabeab4 (diff)
downloadmeta-clang-33604a56dc35a04c6b4233f2030cebc60e8dcfe9.tar.gz
android-tools: make it work with devtool
devtool modify android-tools was failing with an error: - regenerate patches in the git format working with devtool - add debian patches to yocto instead of applying them manually with do_unpack_and_patch_debian, to make it work with devtool Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Diffstat (limited to 'dynamic-layers')
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libcrypto_mk_change_out_dir.patch)21
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libext4_utils_mk_change_out_dir.patch)22
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libunwind_mk_change_out_dir.patch)21
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libfec_mk_change_out_dir.patch)20
-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.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/adb_mk_change_out_dir.patch)24
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libadb_mk_change_out_dir.patch)20
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/fastboot_compile_remove_gtest.patch)30
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/fastboot_mk_change_out_dir.patch)23
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch)26
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libbase_mk_change_out_dir.patch)20
-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.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libcutils_mk_change_out_dir.patch)20
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/img2simg_change_out_dir.patch)17
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/simg2img_change_out_dir.patch)17
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/liblog_mk_change_out_dir.patch)19
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libsparse_mk_change_out_dir.patch)19
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libziparchive_mk_change_out_dir.patch)20
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch (renamed from dynamic-layers/selinux/android-tools/android-tools/libbacktrace_mk_change_out_dir.patch)23
-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/libcrypto_utils_mk_change_out_dir.patch4
-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/use_name_space_std_to_compile_libbacktrace.patch19
-rw-r--r--dynamic-layers/selinux/android-tools/android-tools_10.0.0.r36.bb87
43 files changed, 1143 insertions, 137 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libcrypto_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch
index 642d6d3..7d6d588 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libcrypto_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch
@@ -1,21 +1,29 @@
1libcrypto.mk: modifications to make it build in yocto environment 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
2 6
3Adding an include file that is setting the common flags. 7Adding an include file that is setting the common flags.
4 8
5Modified the build rule so that it outputs the binary and include 9Modified the build rule so that it outputs the binary and include
6to the OUT_DIR 10to the OUT_DIR
7 11
8
9Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
13---
14 debian/libcrypto.mk | 9 ++++++---
15 1 file changed, 6 insertions(+), 3 deletions(-)
10 16
11--- git/external/boringssl/debian/libcrypto.mk 2021-04-30 11:32:40.610312307 +0000 17diff --git a/debian/libcrypto.mk b/debian/libcrypto.mk
12+++ git/external/boringssl/debian/libcrypto.mk 2021-04-30 11:36:47.738318880 +0000 18index 4c0268e..8b41056 100644
19--- a/debian/libcrypto.mk
20+++ b/debian/libcrypto.mk
13@@ -1,3 +1,4 @@ 21@@ -1,3 +1,4 @@
14+include ../../rules_yocto.mk 22+include ../../rules_yocto.mk
15 include sources.mk 23 include sources.mk
16 24
17 NAME = libcrypto 25 NAME = libcrypto
18@@ -26,6 +27,8 @@ 26@@ -26,6 +27,8 @@ CPPFLAGS += -Isrc/include -Isrc/crypto
19 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread 27 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread
20 28
21 build: $(SOURCES) 29 build: $(SOURCES)
@@ -28,3 +36,6 @@ Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
28+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DOPENSSL_NO_ASM 36+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DOPENSSL_NO_ASM
29+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so 37+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
30+ cp -r include/openssl $(OUT_DIR)/usr/include 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/libext4_utils_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch
index 0c31e5d..04592da 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libext4_utils_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch
@@ -1,4 +1,8 @@
1libext4_utils.mk: modifications to make it build in yocto environment 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
2 6
3Adding an include file that is setting the common flags. 7Adding an include file that is setting the common flags.
4Changed the cppflag to include the headers from other components 8Changed the cppflag to include the headers from other components
@@ -10,15 +14,20 @@ are searched in the output folder.
10Modified the build rule so that it outputs the binary and header to the OUT_DIR 14Modified the build rule so that it outputs the binary and header to the OUT_DIR
11 15
12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libext4_utils.mk | 13 ++++++++-----
19 1 file changed, 8 insertions(+), 5 deletions(-)
13 20
14--- git/system/extras/debian/libext4_utils.mk 2021-04-29 21:46:39.384394114 +0000 21diff --git a/debian/libext4_utils.mk b/debian/libext4_utils.mk
15+++ git/system/extras/debian/libext4_utils.mk 2021-04-29 21:49:53.808605543 +0000 22index 868e790..2e93158 100644
23--- a/debian/libext4_utils.mk
24+++ b/debian/libext4_utils.mk
16@@ -1,3 +1,4 @@ 25@@ -1,3 +1,4 @@
17+include ../../rules_yocto.mk 26+include ../../rules_yocto.mk
18 NAME = libext4_utils 27 NAME = libext4_utils
19 28
20 ext4_utils_SOURCES := \ 29 ext4_utils_SOURCES := \
21@@ -17,14 +18,16 @@ 30@@ -17,14 +18,16 @@ CPPFLAGS += \
22 -Iext4_utils/include \ 31 -Iext4_utils/include \
23 -Ilibfec/include \ 32 -Ilibfec/include \
24 -Isquashfs_utils \ 33 -Isquashfs_utils \
@@ -35,8 +44,11 @@ Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
35- mkdir --parents $(OUT_DIR) 44- mkdir --parents $(OUT_DIR)
36- $(CC) $^ -o $(OUT_DIR)/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) 45- $(CC) $^ -o $(OUT_DIR)/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
37- ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so 46- ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so
38+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ 47+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/
39+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) 48+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
40+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so 49+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
41+ cp -r ext4_utils/include/* $(OUT_DIR)/usr/include/ 50+ cp -r ext4_utils/include/* $(OUT_DIR)/usr/include/
42+ 51+
52--
532.36.1.vfs.0.0
54
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libunwind_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch
index 967c573..f6bea17 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libunwind_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching libundwind to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -18,16 +21,21 @@ Passing the architecture details($CPU)from the recipe.
18Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 21Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
19 22
20Upstream-Status: Pending 23Upstream-Status: Pending
21 24---
22--- git/external/libunwind/debian/libunwind.mk 2021-05-22 02:29:52.950324653 +0000 25 debian/libunwind.mk | 14 ++++++++------
23+++ git/external/libunwind/debian/libunwind.mk 2021-05-22 02:30:48.535322846 +0000 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
24@@ -1,4 +1,4 @@ 32@@ -1,4 +1,4 @@
25-include debian/detect_arch.mk 33-include debian/detect_arch.mk
26+include ../../rules_yocto.mk 34+include ../../rules_yocto.mk
27 35
28 ARCH_SOURCES = is_fpreg.c \ 36 ARCH_SOURCES = is_fpreg.c \
29 regname.c \ 37 regname.c \
30@@ -131,10 +131,12 @@ 38@@ -131,10 +131,12 @@ CFLAGS += -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -Werror -Wno-unused-parameter -
31 CPPFLAGS += -Iinclude -Isrc $($(CPU)_INCLUDES) -Idebian/include 39 CPPFLAGS += -Iinclude -Isrc $($(CPU)_INCLUDES) -Idebian/include
32 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ 40 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
33 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 41 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
@@ -45,3 +53,6 @@ Upstream-Status: Pending
45+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so 53+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
46+ cp -r include/* debian/include/* $(OUT_DIR)/usr/include/android/libunwind/ 54+ cp -r include/* debian/include/* $(OUT_DIR)/usr/include/android/libunwind/
47+ 55+
56--
572.36.1.vfs.0.0
58
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libfec_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch
index 6e63e4f..25f8efe 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libfec_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch
@@ -1,11 +1,22 @@
1--- git/system/extras/debian/libfec.mk 2021-05-17 06:55:51.973044031 +0000 1From 3be070a1fe2efa2877684f95c6a5643f76ee8bbc Mon Sep 17 00:00:00 2001
2+++ git/system/extras/debian/libfec.mk 2021-05-17 06:56:41.940185413 +0000 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
3@@ -1,3 +1,4 @@ 14@@ -1,3 +1,4 @@
4+include ../../rules_yocto.mk 15+include ../../rules_yocto.mk
5 NAME = libfec 16 NAME = libfec
6 17
7 # copied from libfec/Android.bp 18 # copied from libfec/Android.bp
8@@ -12,20 +13,21 @@ 19@@ -12,20 +13,21 @@ CXXSOURCES := $(foreach source, $(filter %.cpp, $(SOURCES)), libfec/$(source))
9 CXXFLAGS += -fno-strict-aliasing -std=g++17 20 CXXFLAGS += -fno-strict-aliasing -std=g++17
10 CPPFLAGS += \ 21 CPPFLAGS += \
11 -Iext4_utils/include \ 22 -Iext4_utils/include \
@@ -33,3 +44,6 @@
33 44
34 $(COBJECTS): %.o: %.c 45 $(COBJECTS): %.o: %.c
35 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) 46 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
47--
482.36.1.vfs.0.0
49
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
new file mode 100644
index 0000000..2820e79
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch
@@ -0,0 +1,94 @@
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
new file mode 100644
index 0000000..a7e0fa8
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch
@@ -0,0 +1,20 @@
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
new file mode 100644
index 0000000..dd39d1e
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch
@@ -0,0 +1,14 @@
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
new file mode 100644
index 0000000..62a8ba2
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch
@@ -0,0 +1,20 @@
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
new file mode 100644
index 0000000..771f0e7
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch
@@ -0,0 +1,17 @@
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
new file mode 100644
index 0000000..66d1ddd
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch
@@ -0,0 +1,24 @@
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
new file mode 100644
index 0000000..8a21054
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch
@@ -0,0 +1,22 @@
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
new file mode 100644
index 0000000..3622d7e
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch
@@ -0,0 +1,22 @@
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
new file mode 100644
index 0000000..6c21022
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch
@@ -0,0 +1,150 @@
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
new file mode 100644
index 0000000..ccc7655
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch
@@ -0,0 +1,43 @@
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
new file mode 100644
index 0000000..d507eab
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch
@@ -0,0 +1,16 @@
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
new file mode 100644
index 0000000..e71af86
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch
@@ -0,0 +1,18 @@
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
new file mode 100644
index 0000000..947b526
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch
@@ -0,0 +1,62 @@
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
new file mode 100644
index 0000000..8de0035
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch
@@ -0,0 +1,74 @@
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
new file mode 100644
index 0000000..5e239b7
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch
@@ -0,0 +1,15 @@
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
new file mode 100644
index 0000000..a14261a
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch
@@ -0,0 +1,18 @@
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
new file mode 100644
index 0000000..5e153b0
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch
@@ -0,0 +1,31 @@
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/adb_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch
index 8c07e13..d2ba525 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/adb_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching adb.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -15,15 +18,21 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
15 18
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
19--- git/system/core/debian/adb.mk 2021-04-29 21:11:00.617892503 +0200 22---
20+++ git/system/core/debian/adb.mk 2021-04-29 21:17:33.256016600 +0200 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
21@@ -1,3 +1,4 @@ 30@@ -1,3 +1,4 @@
22+include ../../rules_yocto.mk 31+include ../../rules_yocto.mk
23 NAME = adb 32 NAME = adb
24 33
25 SOURCES = client/adb_client.cpp \ 34 SOURCES = client/adb_client.cpp \
26@@ -12,10 +13,10 @@ 35@@ -12,10 +13,10 @@ SOURCES = client/adb_client.cpp \
27 36
28 SOURCES := $(foreach source, $(SOURCES), adb/$(source)) 37 SOURCES := $(foreach source, $(SOURCES), adb/$(source))
29 CXXFLAGS += -std=gnu++2a 38 CXXFLAGS += -std=gnu++2a
@@ -37,7 +46,7 @@ Upstream-Status: Pending
37 46
38 # -latomic should be the last library specified 47 # -latomic should be the last library specified
39 # https://github.com/android/ndk/issues/589 48 # https://github.com/android/ndk/issues/589
40@@ -24,7 +25,8 @@ 49@@ -24,7 +25,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
41 endif 50 endif
42 51
43 build: $(SOURCES) 52 build: $(SOURCES)
@@ -48,3 +57,6 @@ Upstream-Status: Pending
48 clean: 57 clean:
49- $(RM) adb/$(NAME) 58- $(RM) adb/$(NAME)
50+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/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/libadb_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch
index 21598b1..1281caa 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libadb_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch
@@ -1,4 +1,8 @@
1libadb.mk: modifications to make it build in yocto environment 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
2 6
3Adding an include file that is setting the common flags. 7Adding an include file that is setting the common flags.
4Changed the cppflag to include the headers from other components 8Changed the cppflag to include the headers from other components
@@ -10,15 +14,20 @@ are searched in the output folder.
10Modified the build rule so that it outputs the binary to the OUT_DIR 14Modified the build rule so that it outputs the binary to the OUT_DIR
11 15
12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libadb.mk | 11 ++++++-----
19 1 file changed, 6 insertions(+), 5 deletions(-)
13 20
14--- git/system/core/debian/libadb.mk 2021-04-30 16:29:34.596618862 +0200 21diff --git a/debian/libadb.mk b/debian/libadb.mk
15+++ git/system/core/debian/libadb.mk 2021-04-30 16:36:53.932837490 +0200 22index ae240c98..db5da353 100644
23--- a/debian/libadb.mk
24+++ b/debian/libadb.mk
16@@ -1,3 +1,4 @@ 25@@ -1,3 +1,4 @@
17+include ../../rules_yocto.mk 26+include ../../rules_yocto.mk
18 NAME := libadb 27 NAME := libadb
19 28
20 LIBADB_SRC_FILES := \ 29 LIBADB_SRC_FILES := \
21@@ -43,18 +44,18 @@ 30@@ -43,18 +44,18 @@ CPPFLAGS += \
22 -Ibase/include \ 31 -Ibase/include \
23 -Idiagnose_usb/include \ 32 -Idiagnose_usb/include \
24 -Ilibcrypto_utils/include \ 33 -Ilibcrypto_utils/include \
@@ -42,3 +51,6 @@ Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
42 51
43 transport_mdns_unsupported.cpp: 52 transport_mdns_unsupported.cpp:
44 echo 'void init_mdns_transport_discovery(void) {}' > 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/fastboot_compile_remove_gtest.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch
index a04f27f..56c25ea 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/fastboot_compile_remove_gtest.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch
@@ -1,4 +1,7 @@
1socket.h: removing dependency of gtest 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
2 5
3Removed the dependency of gtest on the build of fastboot binary. 6Removed the dependency of gtest on the build of fastboot binary.
4Fixes below error 7Fixes below error
@@ -27,25 +30,32 @@ In file included from fastboot/fastboot.cpp:70:
27| ^~~~~~~~~~~~~~~~~~~~ 30| ^~~~~~~~~~~~~~~~~~~~
28| 1 error generated. 31| 1 error generated.
29 32
30
31Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 33Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
32 34---
33--- a/system/core/fastboot/socket.h 2021-04-14 21:14:00.355973915 +0000 35 fastboot/socket.h | 3 ---
34+++ b/system/core/fastboot/socket.h 2021-04-14 21:14:21.879680699 +0000 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
35@@ -40,7 +40,6 @@ 42@@ -40,7 +40,6 @@
36 43
37 #include <android-base/macros.h> 44 #include <android-base/macros.h>
38 #include <cutils/sockets.h> 45 #include <cutils/sockets.h>
39-#include <gtest/gtest_prod.h> 46-#include <gtest/gtest_prod.h>
40 47
41 // Socket interface to be implemented for each platform. 48 // Socket interface to be implemented for each platform.
42 class Socket { 49 class Socket {
43@@ -119,8 +118,6 @@ 50@@ -119,8 +118,6 @@ class Socket {
44 socket_send_buffers_function_ = &socket_send_buffers; 51 socket_send_buffers_function_ = &socket_send_buffers;
45 52
46 private: 53 private:
47- FRIEND_TEST(SocketTest, TestTcpSendBuffers); 54- FRIEND_TEST(SocketTest, TestTcpSendBuffers);
48- FRIEND_TEST(SocketTest, TestUdpSendBuffers); 55- FRIEND_TEST(SocketTest, TestUdpSendBuffers);
49 56
50 DISALLOW_COPY_AND_ASSIGN(Socket); 57 DISALLOW_COPY_AND_ASSIGN(Socket);
51 }; 58 };
59--
602.36.1.vfs.0.0
61
diff --git a/dynamic-layers/selinux/android-tools/android-tools/fastboot_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch
index c8904f0..82ec560 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/fastboot_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching fastboot.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -16,20 +19,25 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
22---
23 debian/fastboot.mk | 12 +++++++-----
24 1 file changed, 7 insertions(+), 5 deletions(-)
19 25
20--- git/system/core/debian/fastboot.mk 2021-05-17 07:47:56.800224043 +0000 26diff --git a/debian/fastboot.mk b/debian/fastboot.mk
21+++ git/system/core/debian/fastboot.mk 2021-05-17 07:49:40.130383096 +0000 27index d1aba626..e75fa87c 100644
28--- a/debian/fastboot.mk
29+++ b/debian/fastboot.mk
22@@ -1,3 +1,4 @@ 30@@ -1,3 +1,4 @@
23+include ../../rules_yocto.mk 31+include ../../rules_yocto.mk
24 NAME = fastboot 32 NAME = fastboot
25 fastboot_SOURCES = \ 33 fastboot_SOURCES = \
26 bootimg_utils.cpp \ 34 bootimg_utils.cpp \
27@@ -38,11 +39,11 @@ 35@@ -38,11 +39,11 @@ CPPFLAGS += \
28 -Ifs_mgr/liblp/include \ 36 -Ifs_mgr/liblp/include \
29 -I/usr/include/android/openssl \ 37 -I/usr/include/android/openssl \
30 -Ilibsparse/include \ 38 -Ilibsparse/include \
31- -Ilibziparchive/include 39- -Ilibziparchive/include
32+ -Ilibziparchive/include -I$(OUT_DIR)/usr/include/ 40+ -Ilibziparchive/include -I$(OUT_DIR)/usr/include/
33 LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 41 LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
34 -fuse-ld=gold \ 42 -fuse-ld=gold \
35- -Wl,-rpath-link=. \ 43- -Wl,-rpath-link=. \
@@ -39,7 +47,7 @@ Upstream-Status: Pending
39 -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 47 -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
40 -l7z \ 48 -l7z \
41 49
42@@ -53,7 +54,8 @@ 50@@ -53,7 +54,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
43 endif 51 endif
44 52
45 build: $(SOURCES) 53 build: $(SOURCES)
@@ -50,3 +58,6 @@ Upstream-Status: Pending
50 clean: 58 clean:
51- $(RM) fastboot/$(NAME) 59- $(RM) fastboot/$(NAME)
52+ $(RM) $(OUT_DIR)/usr/bin/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/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
index 0deb0b2..d465ad6 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch
@@ -1,6 +1,10 @@
1upstream commit taken as below 1From a4839f29e1286b0c53208a45b9c237d81021f829 Mon Sep 17 00:00:00 2001
2Original Issue link 2From: Etienne Cordonnier <ecordonnier@snap.com>
3https://android-review.googlesource.com/c/platform/system/core/+/1123485 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
4 8
5Commit taken below: 9Commit taken below:
6 10
@@ -28,10 +32,15 @@ Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
28https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec 32https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec
29Upstream-Status: Backport [commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec] 33Upstream-Status: Backport [commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec]
30Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 34Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
31 35---
32--- git/system/core/fastboot/fastboot.cpp 2021-05-28 09:24:15.583963227 +0000 36 fastboot/fastboot.cpp | 2 +-
33+++ git/system/core/fastboot/fastboot.cpp 2021-05-28 09:25:09.948974990 +0000 37 1 file changed, 1 insertion(+), 1 deletion(-)
34@@ -869,7 +869,7 @@ 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) {
35 return false; 44 return false;
36 } 45 }
37 46
@@ -40,3 +49,6 @@ Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
40 buf->image_size = sparse_file_len(s, false, false); 49 buf->image_size = sparse_file_len(s, false, false);
41 sparse_file_destroy(s); 50 sparse_file_destroy(s);
42 } else { 51 } else {
52--
532.36.1.vfs.0.0
54
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libbase_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch
index ca56f8c..6211f04 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libbase_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch
@@ -1,4 +1,8 @@
1libbase.mk: modifications to make it build in yocto environment 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
2 6
3Adding an include file that is setting the common flags. 7Adding an include file that is setting the common flags.
4Changed the cppflag to include the headers from other components 8Changed the cppflag to include the headers from other components
@@ -10,15 +14,20 @@ are searched in the output folder.
10Modified the build rule so that it outputs the binary to the OUT_DIR 14Modified the build rule so that it outputs the binary to the OUT_DIR
11 15
12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libbase.mk | 8 +++++---
19 1 file changed, 5 insertions(+), 3 deletions(-)
13 20
14--- git/system/core/debian/libbase.mk 2021-04-29 22:01:13.664181133 +0200 21diff --git a/debian/libbase.mk b/debian/libbase.mk
15+++ git/system/core/debian/libbase.mk 2021-04-29 22:04:52.328123833 +0200 22index 80da48f3..e6c3e365 100644
23--- a/debian/libbase.mk
24+++ b/debian/libbase.mk
16@@ -1,3 +1,4 @@ 25@@ -1,3 +1,4 @@
17+include ../../rules_yocto.mk 26+include ../../rules_yocto.mk
18 NAME = libbase 27 NAME = libbase
19 SOURCES = \ 28 SOURCES = \
20 chrono_utils.cpp \ 29 chrono_utils.cpp \
21@@ -20,8 +21,9 @@ 30@@ -20,8 +21,9 @@ CPPFLAGS += -Iinclude -Ibase/include
22 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 31 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0
23 32
24 build: $(SOURCES) 33 build: $(SOURCES)
@@ -31,3 +40,6 @@ Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
31 clean: 40 clean:
32- $(RM) $(NAME).so* 41- $(RM) $(NAME).so*
33+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(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
new file mode 100644
index 0000000..af92726
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch
@@ -0,0 +1,51 @@
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/libcutils_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch
index 4914654..b876229 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libcutils_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch
@@ -1,11 +1,22 @@
1--- git/system/core/debian/libcutils.mk 2021-05-17 06:38:40.105161629 +0000 1From 4af9cc9e93e5cb09583c0fedeccae3fa195dbe7b Mon Sep 17 00:00:00 2001
2+++ git/system/core/debian/libcutils.mk 2021-05-17 06:42:37.141912366 +0000 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
3@@ -1,3 +1,4 @@ 14@@ -1,3 +1,4 @@
4+include ../../rules_yocto.mk 15+include ../../rules_yocto.mk
5 NAME = libcutils 16 NAME = libcutils
6 17
7 # copied from libcutils/Android.bp 18 # copied from libcutils/Android.bp
8@@ -50,14 +51,15 @@ 19@@ -50,14 +51,15 @@ CPPFLAGS += \
9 -Iinclude \ 20 -Iinclude \
10 21
11 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ 22 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
@@ -25,3 +36,6 @@
25 36
26 $(COBJECTS): %.o: %.c 37 $(COBJECTS): %.o: %.c
27 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) 38 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
39--
402.36.1.vfs.0.0
41
diff --git a/dynamic-layers/selinux/android-tools/android-tools/img2simg_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
index 6913c4b..4ecfa6f 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/img2simg_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching img2simg.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -16,9 +19,14 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
22---
23 debian/img2simg.mk | 11 ++++++-----
24 1 file changed, 6 insertions(+), 5 deletions(-)
19 25
20--- git/system/core/debian/img2simg.mk 2021-05-12 09:05:38.580607289 +0000 26diff --git a/debian/img2simg.mk b/debian/img2simg.mk
21+++ git/system/core/debian/img2simg.mk 2021-05-12 09:09:04.331908253 +0000 27index f1036cef..94772381 100644
28--- a/debian/img2simg.mk
29+++ b/debian/img2simg.mk
22@@ -1,13 +1,14 @@ 30@@ -1,13 +1,14 @@
23+include ../../rules_yocto.mk 31+include ../../rules_yocto.mk
24 NAME = img2simg 32 NAME = img2simg
@@ -39,3 +47,6 @@ Upstream-Status: Pending
39 clean: 47 clean:
40- $(RM) libsparse/$(NAME) 48- $(RM) libsparse/$(NAME)
41+ $(RM) $(OUT_DIR)/usr/bin/$(NAME) 49+ $(RM) $(OUT_DIR)/usr/bin/$(NAME)
50--
512.36.1.vfs.0.0
52
diff --git a/dynamic-layers/selinux/android-tools/android-tools/simg2img_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
index d17adff..aa60058 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/simg2img_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching simg2img.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -16,9 +19,14 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
22---
23 debian/simg2img.mk | 11 ++++++-----
24 1 file changed, 6 insertions(+), 5 deletions(-)
19 25
20--- git/system/core/debian/simg2img.mk 2021-05-12 09:47:52.577840520 +0000 26diff --git a/debian/simg2img.mk b/debian/simg2img.mk
21+++ git/system/core/debian/simg2img.mk 2021-05-12 09:51:43.525678276 +0000 27index 07fb56b4..d319c87e 100644
28--- a/debian/simg2img.mk
29+++ b/debian/simg2img.mk
22@@ -1,13 +1,14 @@ 30@@ -1,13 +1,14 @@
23+include ../../rules_yocto.mk 31+include ../../rules_yocto.mk
24 NAME = simg2img 32 NAME = simg2img
@@ -39,3 +47,6 @@ Upstream-Status: Pending
39 clean: 47 clean:
40- $(RM) libsparse/$(NAME) 48- $(RM) libsparse/$(NAME)
41+ $(RM) $(OUT_DIR)/usr/bin/$(NAME) 49+ $(RM) $(OUT_DIR)/usr/bin/$(NAME)
50--
512.36.1.vfs.0.0
52
diff --git a/dynamic-layers/selinux/android-tools/android-tools/liblog_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch
index 38cfa88..7a37757 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/liblog_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching liblog.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -16,15 +19,20 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
22---
23 debian/liblog.mk | 8 +++++---
24 1 file changed, 5 insertions(+), 3 deletions(-)
19 25
20--- git/system/core/debian/liblog.mk 2021-05-17 08:13:28.304700936 +0000 26diff --git a/debian/liblog.mk b/debian/liblog.mk
21+++ git/system/core/debian/liblog.mk 2021-05-17 08:15:59.590064282 +0000 27index eb1909b9..3b40d710 100644
28--- a/debian/liblog.mk
29+++ b/debian/liblog.mk
22@@ -1,3 +1,4 @@ 30@@ -1,3 +1,4 @@
23+include ../../rules_yocto.mk 31+include ../../rules_yocto.mk
24 NAME = liblog 32 NAME = liblog
25 33
26 # copied from liblog/Android.bp 34 # copied from liblog/Android.bp
27@@ -39,11 +40,12 @@ 35@@ -39,11 +40,12 @@ CPPFLAGS += \
28 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread 36 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread
29 37
30 build: $(COBJECTS) $(CXXOBJECTS) 38 build: $(COBJECTS) $(CXXOBJECTS)
@@ -40,3 +48,6 @@ Upstream-Status: Pending
40 48
41 $(COBJECTS): %.o: %.c 49 $(COBJECTS): %.o: %.c
42 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) 50 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
51--
522.36.1.vfs.0.0
53
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libsparse_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch
index bf439ef..029cc1c 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libsparse_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch
@@ -1,4 +1,7 @@
1patching libsparse.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -16,15 +19,20 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
22---
23 debian/libsparse.mk | 9 +++++----
24 1 file changed, 5 insertions(+), 4 deletions(-)
19 25
20--- git/system/core/debian/libsparse.mk 2021-05-17 08:13:34.764584388 +0000 26diff --git a/debian/libsparse.mk b/debian/libsparse.mk
21+++ git/system/core/debian/libsparse.mk 2021-05-17 08:15:34.850492654 +0000 27index de280def..64caa45f 100644
28--- a/debian/libsparse.mk
29+++ b/debian/libsparse.mk
22@@ -1,3 +1,4 @@ 30@@ -1,3 +1,4 @@
23+include ../../rules_yocto.mk 31+include ../../rules_yocto.mk
24 NAME = libsparse 32 NAME = libsparse
25 SOURCES = \ 33 SOURCES = \
26 backed_block.cpp \ 34 backed_block.cpp \
27@@ -18,16 +19,16 @@ 35@@ -18,16 +19,16 @@ LDFLAGS += \
28 -shared -Wl,-soname,$(NAME).so.0 \ 36 -shared -Wl,-soname,$(NAME).so.0 \
29 -lz \ 37 -lz \
30 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ 38 -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
@@ -45,3 +53,6 @@ Upstream-Status: Pending
45 53
46 $(COBJECTS): %.o: %.c 54 $(COBJECTS): %.o: %.c
47 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) 55 $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
56--
572.36.1.vfs.0.0
58
diff --git a/dynamic-layers/selinux/android-tools/android-tools/libziparchive_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch
index 4f88b0a..b49ec3b 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libziparchive_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch
@@ -1,4 +1,8 @@
1patching libziparchive.mk to build in yocto environment. 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.
2 6
3Changes include: 7Changes include:
4Introduced an output folder which will keep all the outputs from the 8Introduced an output folder which will keep all the outputs from the
@@ -16,15 +20,20 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 20Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 21
18Upstream-Status: Pending 22Upstream-Status: Pending
23---
24 debian/libziparchive.mk | 12 +++++++-----
25 1 file changed, 7 insertions(+), 5 deletions(-)
19 26
20--- git/system/core/debian/libziparchive.mk 2021-05-17 08:13:41.684459540 +0000 27diff --git a/debian/libziparchive.mk b/debian/libziparchive.mk
21+++ git/system/core/debian/libziparchive.mk 2021-05-17 08:16:19.293722572 +0000 28index 803ea58e..6a697059 100644
29--- a/debian/libziparchive.mk
30+++ b/debian/libziparchive.mk
22@@ -1,3 +1,4 @@ 31@@ -1,3 +1,4 @@
23+include ../../rules_yocto.mk 32+include ../../rules_yocto.mk
24 NAME = libziparchive 33 NAME = libziparchive
25 SOURCES = zip_archive.cc \ 34 SOURCES = zip_archive.cc \
26 zip_archive_stream_entry.cc\ 35 zip_archive_stream_entry.cc\
27@@ -5,14 +6,15 @@ 36@@ -5,14 +6,15 @@ SOURCES = zip_archive.cc \
28 SOURCES := $(foreach source, $(SOURCES), libziparchive/$(source)) 37 SOURCES := $(foreach source, $(SOURCES), libziparchive/$(source))
29 CXXFLAGS += -std=gnu++17 38 CXXFLAGS += -std=gnu++17
30 CPPFLAGS += -DZLIB_CONST -D_FILE_OFFSET_BITS=64 \ 39 CPPFLAGS += -DZLIB_CONST -D_FILE_OFFSET_BITS=64 \
@@ -45,3 +54,6 @@ Upstream-Status: Pending
45 clean: 54 clean:
46- $(RM) $(NAME).so* 55- $(RM) $(NAME).so*
47+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(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/libbacktrace_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch
index 6ae9793..433caf2 100644
--- a/dynamic-layers/selinux/android-tools/android-tools/libbacktrace_mk_change_out_dir.patch
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch
@@ -1,4 +1,7 @@
1patching libbacktrace.mk to build in yocto environment. 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.
2 5
3Changes include: 6Changes include:
4Introduced an output folder which will keep all the outputs from the 7Introduced an output folder which will keep all the outputs from the
@@ -16,17 +19,22 @@ Modified the build rule so that it outputs the binary to the OUT_DIR
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17 20
18Upstream-Status: Pending 21Upstream-Status: Pending
22---
23 debian/libbacktrace.mk | 14 +++++++-------
24 1 file changed, 7 insertions(+), 7 deletions(-)
19 25
20--- git/system/core/debian/libbacktrace.mk 2021-05-21 23:51:55.022408433 +0000 26diff --git a/debian/libbacktrace.mk b/debian/libbacktrace.mk
21+++ git/system/core/debian/libbacktrace.mk 2021-05-21 23:53:07.487543521 +0000 27index 330d211c..229b39d9 100644
28--- a/debian/libbacktrace.mk
29+++ b/debian/libbacktrace.mk
22@@ -1,5 +1,5 @@ 30@@ -1,5 +1,5 @@
23 31
24-include /usr/share/dpkg/architecture.mk 32-include /usr/share/dpkg/architecture.mk
25+include ../../rules_yocto.mk 33+include ../../rules_yocto.mk
26 34
27 NAME = libbacktrace 35 NAME = libbacktrace
28 36
29@@ -88,11 +89,11 @@ 37@@ -88,11 +88,11 @@ CPPFLAGS += \
30 -Ilibprocinfo/include \ 38 -Ilibprocinfo/include \
31 -Ilibunwindstack/include \ 39 -Ilibunwindstack/include \
32 -I/usr/include/android/lzma \ 40 -I/usr/include/android/lzma \
@@ -41,7 +49,7 @@ Upstream-Status: Pending
41 49
42 # -latomic should be the last library specified 50 # -latomic should be the last library specified
43 # https://github.com/android/ndk/issues/589 51 # https://github.com/android/ndk/issues/589
44@@ -104,11 +105,11 @@ 52@@ -104,11 +104,11 @@ ifeq ($(DEB_HOST_ARCH), mipsel)
45 endif 53 endif
46 54
47 build: $(COBJECTS) $(CXXOBJECTS) $(OBJECTS_ASSEMBLY) 55 build: $(COBJECTS) $(CXXOBJECTS) $(OBJECTS_ASSEMBLY)
@@ -56,3 +64,6 @@ Upstream-Status: Pending
56 64
57 $(CXXOBJECTS): %.o: %.cpp 65 $(CXXOBJECTS): %.o: %.cpp
58 $(CXX) $< -o $@ $(CXXFLAGS) $(CPPFLAGS) 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
new file mode 100644
index 0000000..d8fee66
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch
@@ -0,0 +1,32 @@
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/libcrypto_utils_mk_change_out_dir.patch b/dynamic-layers/selinux/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch
index ec0db57..668338d 100644
--- 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
@@ -11,8 +11,8 @@ Modified the build rule so that it outputs the binary and header to the OUT_DIR
11 11
12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> 12Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
13 13
14--- git/system/core/debian/libcrypto_utils.mk 2021-04-30 14:18:54.071379767 +0200 14--- git/debian/libcrypto_utils.mk 2021-04-30 14:18:54.071379767 +0200
15+++ git/system/core/debian/libcrypto_utils.mk 2021-04-30 14:22:46.179047308 +0200 15+++ git/debian/libcrypto_utils.mk 2021-04-30 14:22:46.179047308 +0200
16@@ -1,15 +1,17 @@ 16@@ -1,15 +1,17 @@
17+include ../../rules_yocto.mk 17+include ../../rules_yocto.mk
18 NAME:= libcrypto_utils 18 NAME:= libcrypto_utils
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
new file mode 100644
index 0000000..cc1a8cb
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch
@@ -0,0 +1,14 @@
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
new file mode 100644
index 0000000..8d78faa
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch
@@ -0,0 +1,25 @@
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
new file mode 100644
index 0000000..9cac341
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/series
@@ -0,0 +1,3 @@
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
new file mode 100644
index 0000000..8051b6d
--- /dev/null
+++ b/dynamic-layers/selinux/android-tools/android-tools/libunwind-debian/user_pt_regs.patch
@@ -0,0 +1,23 @@
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/use_name_space_std_to_compile_libbacktrace.patch b/dynamic-layers/selinux/android-tools/android-tools/use_name_space_std_to_compile_libbacktrace.patch
deleted file mode 100644
index 079ade4..0000000
--- a/dynamic-layers/selinux/android-tools/android-tools/use_name_space_std_to_compile_libbacktrace.patch
+++ /dev/null
@@ -1,19 +0,0 @@
1To Fix the below error
2
3 In file included from libunwindstack/DwarfSection.cpp:21:
4| libunwindstack/include/unwindstack/DwarfMemory.h:32:29: error: unknown type name 'size_t'; did you mean 'std::size_t'?
5| bool ReadBytes(void* dst, size_t num_bytes);
6| ^~~~~~
7| std::size_t
8
9--- ./system/core/libunwindstack/include/unwindstack/DwarfMemory.h 2021-05-22 00:52:15.132452862 +0000
10+++ ./system/core/libunwindstack/include/unwindstack/DwarfMemory.h 2021-05-22 00:53:09.793416724 +0000
11@@ -23,7 +23,7 @@
12
13 // Forward declarations.
14 class Memory;
15-
16+using namespace std;
17 class DwarfMemory {
18 public:
19 DwarfMemory(Memory* memory) : memory_(memory) {}
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
index 0d7a972..b943a5d 100644
--- 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
@@ -26,25 +26,59 @@ SRC_URI = " \
26 git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \ 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 \ 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 \ 28 git://salsa.debian.org/android-tools-team/android-platform-external-libunwind.git;protocol=https;name=libunwind;nobranch=1;destsuffix=git/external/libunwind \
29 file://adb_mk_change_out_dir.patch \ 29"
30 file://libadb_mk_change_out_dir.patch \ 30
31 file://fastboot_compile_remove_gtest.patch \ 31# Patches copied from android-platform-system-core/debian/patches
32 file://fastboot_mk_change_out_dir.patch \ 32# and applied in the order defined by the "series" file
33 file://fastboot_dont_use_sparse_file_import_auto_in_load_buf_fd.patch \ 33SRC_URI += " \
34 file://libbase_mk_change_out_dir.patch \ 34 file://core-debian/move-log-file-to-proper-dir.patch;patchdir=system/core \
35 file://libext4_utils_mk_change_out_dir.patch \ 35 file://core-debian/Added-missing-headers.patch;patchdir=system/core \
36 file://libcrypto_mk_change_out_dir.patch \ 36 file://core-debian/libusb-header-path.patch;patchdir=system/core \
37 file://libcrypto_utils_mk_change_out_dir.patch \ 37 file://core-debian/stdatomic.patch;patchdir=system/core \
38 file://libcutils_mk_change_out_dir.patch \ 38 file://core-debian/Nonnull.patch;patchdir=system/core \
39 file://libfec_mk_change_out_dir.patch \ 39 file://core-debian/Vector-cast.patch;patchdir=system/core \
40 file://img2simg_change_out_dir.patch \ 40 file://core-debian/use-Python-3-for-mkbootimg.patch;patchdir=system/core \
41 file://simg2img_change_out_dir.patch \ 41 file://core-debian/throw-exception-on-unknown-os.patch;patchdir=system/core \
42 file://liblog_mk_change_out_dir.patch \ 42 file://core-debian/simg_dump-python3.patch;patchdir=system/core \
43 file://libsparse_mk_change_out_dir.patch \ 43 file://core-debian/fix-attribute-issue-with-gcc.patch;patchdir=system/core \
44 file://libziparchive_mk_change_out_dir.patch \ 44 file://core-debian/workaround-error-expected-primary-expression-before-.-token.patch;patchdir=system/core \
45 file://libbacktrace_mk_change_out_dir.patch \ 45 file://core-debian/fix-gettid-exception-declaration.patch;patchdir=system/core \
46 file://libunwind_mk_change_out_dir.patch \ 46 file://core-debian/fix-build-on-non-x86.patch;patchdir=system/core \
47 file://use_name_space_std_to_compile_libbacktrace.patch \ 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://0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch;patchdir=external/boringssl \
79 file://0001-patching-libundwind-to-build-in-yocto-environment.patch;patchdir=external/libunwind \
80 file://0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch;patchdir=system/extras \
81 file://0002-libfec-change-out_dir-in-makefile.patch;patchdir=system/extras \
48 file://rules_yocto.mk;subdir=git \ 82 file://rules_yocto.mk;subdir=git \
49 file://android-tools-adbd.service \ 83 file://android-tools-adbd.service \
50" 84"
@@ -52,21 +86,6 @@ SRC_URI = " \
52S = "${WORKDIR}/git" 86S = "${WORKDIR}/git"
53B = "${WORKDIR}/${BPN}" 87B = "${WORKDIR}/${BPN}"
54 88
55#apply all the patches maintained in the debian version.
56do_unpack_and_patch_debian() {
57 cd ${S}/system/core
58 for i in `find ${S}/system/core/debian/patches -name "*.patch"`; do
59 patch -p1 < $i
60 done
61 #a patch with no .patch extention, lets apply that
62 patch -p1 < ${S}/system/core/debian/patches/Added-missing-headers
63 cd ${S}/external/libunwind
64 for i in `find ${S}/external/libunwind/debian/patches -name "*.patch"`; do
65 patch -p1 < $i
66 done
67}
68addtask unpack_and_patch_debian after do_unpack before do_patch
69
70# http://errors.yoctoproject.org/Errors/Details/1debian881/ 89# http://errors.yoctoproject.org/Errors/Details/1debian881/
71ARM_INSTRUCTION_SET:armv4 = "arm" 90ARM_INSTRUCTION_SET:armv4 = "arm"
72ARM_INSTRUCTION_SET:armv5 = "arm" 91ARM_INSTRUCTION_SET:armv5 = "arm"