From 3add35fa2dfe1d19148657c41a2a37ed3f9c3064 Mon Sep 17 00:00:00 2001 From: Etienne Cordonnier Date: Tue, 21 Mar 2023 11:03:11 +0100 Subject: android-tools: update to 29.0.6.r14 Note: the adbd makefile can't be upstreamed to debian, because there is already an open PR upstream: https://salsa.debian.org/android-tools-team/android-platform-tools/-/merge_requests/4/diffs Signed-off-by: Etienne Cordonnier Signed-off-by: Khem Raj --- .../android-tools-conf-configfs_1.0.bb | 2 +- .../android-tools/0001-Fixes-for-yocto-build.patch | 162 +++++ ...k-modifications-to-make-it-build-in-yocto.patch | 41 -- ...ls.mk-modifications-to-make-it-build-in-y.patch | 54 -- ...-libundwind-to-build-in-yocto-environment.patch | 58 -- ...ls-modifications-to-make-it-build-in-yoct.patch | 366 ++++++++++++ .../0002-libfec-change-out_dir-in-makefile.patch | 49 -- ...e-of-usbdevfs_urb-to-match-new-kernel-UAP.patch | 126 ++++ .../0004-adb-Fix-build-on-big-endian-systems.patch | 48 ++ .../0005-adb-Allow-adbd-to-be-run-as-root.patch | 23 + .../android-tools/android-tools/adbd.mk | 69 ++- .../core-debian/Added-missing-headers.patch | 94 --- .../android-tools/core-debian/Nonnull.patch | 20 - .../android-tools/core-debian/Vector-cast.patch | 14 - .../core-debian/add-missing-headers.patch | 20 - .../core-debian/fix-attribute-issue-with-gcc.patch | 17 - .../core-debian/fix-build-on-non-x86.patch | 24 - .../core-debian/fix-gcc-11-ftbfs.patch | 22 - .../fix-gettid-exception-declaration.patch | 22 - .../android-tools/core-debian/fix-gnu-hurd.patch | 150 ----- .../core-debian/hard-code-build-number.patch | 43 -- .../core-debian/libusb-header-path.patch | 16 - .../core-debian/move-log-file-to-proper-dir.patch | 18 - .../core-debian/simg_dump-python3.patch | 62 -- .../android-tools/core-debian/stdatomic.patch | 74 --- .../throw-exception-on-unknown-os.patch | 15 - .../core-debian/use-Python-3-for-mkbootimg.patch | 18 - ...xpected-primary-expression-before-.-token.patch | 31 - ...hing-adb.mk-to-build-in-yocto-environment.patch | 62 -- ...odifications-to-make-it-build-in-yocto-en.patch | 56 -- ...003-socket.h-removing-dependency-of-gtest.patch | 61 -- ...fastboot.mk-to-build-in-yocto-environment.patch | 63 -- ...n-t-use-sparse_file_import_auto-in-load_b.patch | 54 -- ...modifications-to-make-it-build-in-yocto-e.patch | 45 -- ...tils.mk-modifications-to-make-it-build-in.patch | 51 -- ...odifications-to-make-it-build-in-yocto-en.patch | 41 -- ...img2simg.mk-to-build-in-yocto-environment.patch | 53 -- ...simg2img.mk-to-build-in-yocto-environment.patch | 53 -- ...g-liblog.mk-to-build-in-yocto-environment.patch | 53 -- ...ibsparse.mk-to-build-in-yocto-environment.patch | 58 -- ...bziparchive.mk-to-build-in-yocto-environm.patch | 59 -- ...bbacktrace.mk-to-build-in-yocto-environme.patch | 69 --- ...Use-namespace-std-to-compile-libbacktrace.patch | 32 - .../core/0016-Adapt-adbd-to-work-with-yocto.patch | 170 ------ ...e-of-usbdevfs_urb-to-match-new-kernel-UAP.patch | 128 ---- .../core/0018-img2simg-Fix-wrong-rpath.patch | 26 - .../core/0019-Fix-compilation-with-gcc.patch | 157 ----- .../0020-adb-Fix-build-on-big-endian-systems.patch | 50 -- .../0021-adb-Allow-adbd-to-be-run-as-root.patch | 25 - .../android-tools/debian/Add-riscv64-support.patch | 651 +++++++++++++++++++++ .../debian/Added-missing-headers.patch | 44 ++ .../android-tools/debian/Nonnull.patch | 20 + .../android-tools/debian/Vector-cast.patch | 14 + .../android-tools/debian/add-missing-headers.patch | 41 ++ .../20150704-CVE-2015-3239_dwarf_i.h.patch | 13 + .../libunwind/legacy_built-in_sync_functions.patch | 26 + .../debian/external/libunwind/user_pt_regs.patch | 24 + .../debian/fix-attribute-issue-with-gcc.patch | 17 + .../debian/fix-build-on-non-x86.patch | 24 + .../debian/fix-gettid-exception-declaration.patch | 24 + .../debian/fix-standard-namespace-errors.patch | 22 + .../debian/hard-code-build-number.patch | 44 ++ .../android-tools/debian/libusb-header-path.patch | 16 + .../debian/move-log-file-to-proper-dir.patch | 18 + .../android-tools/debian/simg_dump-python3.patch | 62 ++ .../android-tools/debian/stdatomic.patch | 64 ++ .../android-tools/debian/stub-out-fastdeploy.patch | 93 +++ .../debian/system/core/Add-riscv64-support.patch | 651 +++++++++++++++++++++ .../debian/system/core/Added-missing-headers.patch | 44 ++ .../android-tools/debian/system/core/Nonnull.patch | 20 + .../debian/system/core/Vector-cast.patch | 14 + .../debian/system/core/add-missing-headers.patch | 41 ++ .../system/core/fix-attribute-issue-with-gcc.patch | 17 + .../debian/system/core/fix-build-on-non-x86.patch | 24 + .../core/fix-gettid-exception-declaration.patch | 24 + .../core/fix-standard-namespace-errors.patch | 22 + .../system/core/hard-code-build-number.patch | 44 ++ .../debian/system/core/libusb-header-path.patch | 16 + .../system/core/move-log-file-to-proper-dir.patch | 18 + .../debian/system/core/simg_dump-python3.patch | 62 ++ .../debian/system/core/stdatomic.patch | 64 ++ .../debian/system/core/stub-out-fastdeploy.patch | 93 +++ .../core/throw-exception-on-unknown-os.patch | 16 + .../debian/throw-exception-on-unknown-os.patch | 16 + .../libcrypto_utils_mk_change_out_dir.patch | 39 -- .../20150704-CVE-2015-3239_dwarf_i.h.patch | 14 - .../legacy_built-in_sync_functions.patch | 25 - .../android-tools/libunwind-debian/series | 3 - .../libunwind-debian/user_pt_regs.patch | 23 - .../android-tools/android-tools/remount | 2 + .../android-tools/android-tools/rules_yocto.mk | 3 - .../android-tools/android-tools_10.0.0.r36.bb | 231 -------- .../android-tools/android-tools_29.0.6.r14.bb | 194 ++++++ 93 files changed, 3367 insertions(+), 2594 deletions(-) create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-Fixes-for-yocto-build.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-android-tools-modifications-to-make-it-build-in-yoct.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0004-adb-Fix-build-on-big-endian-systems.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0005-adb-Allow-adbd-to-be-run-as-root.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Added-missing-headers.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Nonnull.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Vector-cast.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/add-missing-headers.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gnu-hurd.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/hard-code-build-number.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/libusb-header-path.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/simg_dump-python3.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/stdatomic.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0017-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0018-img2simg-Fix-wrong-rpath.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0019-Fix-compilation-with-gcc.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0020-adb-Fix-build-on-big-endian-systems.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0021-adb-Allow-adbd-to-be-run-as-root.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Add-riscv64-support.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Added-missing-headers.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Nonnull.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Vector-cast.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/add-missing-headers.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/legacy_built-in_sync_functions.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/user_pt_regs.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-attribute-issue-with-gcc.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-build-on-non-x86.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-gettid-exception-declaration.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-standard-namespace-errors.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/hard-code-build-number.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/libusb-header-path.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/move-log-file-to-proper-dir.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/simg_dump-python3.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stdatomic.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stub-out-fastdeploy.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Add-riscv64-support.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Added-missing-headers.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Nonnull.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Vector-cast.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/add-missing-headers.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-attribute-issue-with-gcc.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-build-on-non-x86.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-gettid-exception-declaration.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-standard-namespace-errors.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/hard-code-build-number.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/libusb-header-path.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/move-log-file-to-proper-dir.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/simg_dump-python3.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stdatomic.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stub-out-fastdeploy.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/throw-exception-on-unknown-os.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/throw-exception-on-unknown-os.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/series delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/user_pt_regs.patch create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/remount delete mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_10.0.0.r36.bb create mode 100644 meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools-conf-configfs_1.0.bb b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools-conf-configfs_1.0.bb index 3f9d49a2d2..1c26c7207b 100644 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools-conf-configfs_1.0.bb +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools-conf-configfs_1.0.bb @@ -1,4 +1,4 @@ -DESCRIPTION = "Different utilities from Android - corressponding configuration files for using ConfigFS" +DESCRIPTION = "Various utilities from Android - corresponding configuration files for using ConfigFS" SECTION = "console/utils" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-Fixes-for-yocto-build.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-Fixes-for-yocto-build.patch new file mode 100644 index 0000000000..dcf27d805e --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-Fixes-for-yocto-build.patch @@ -0,0 +1,162 @@ +From 5de85f8273c7284aa93e35c40f025d4d43d42df9 Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier +Date: Thu, 16 Mar 2023 18:59:35 +0100 +Subject: [PATCH] Fixes for yocto build + +Signed-off-by: JJ Robertson +[rebased on version 29] +Signed-off-by: Etienne Cordonnier + +--- + system/core/adb/daemon/file_sync_service.cpp | 4 ++-- + system/core/adb/daemon/framebuffer_service.h | 2 -- + system/core/adb/daemon/main.cpp | 5 +++-- + system/core/adb/daemon/restart_service.h | 2 -- + system/core/adb/daemon/services.cpp | 6 ++---- + system/core/adb/daemon/shell_service.cpp | 5 ++++- + system/core/adb/types.h | 1 + + 7 files changed, 12 insertions(+), 13 deletions(-) + +diff --git a/system/core/adb/daemon/file_sync_service.cpp b/system/core/adb/daemon/file_sync_service.cpp +index d6af7087..92e7087a 100644 +--- a/system/core/adb/daemon/file_sync_service.cpp ++++ b/system/core/adb/daemon/file_sync_service.cpp +@@ -111,7 +111,7 @@ static bool secure_mkdirs(const std::string& path) { + partial_path += path_component; + + if (should_use_fs_config(partial_path)) { +- fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); ++ // fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); + } + if (adb_mkdir(partial_path.c_str(), mode) == -1) { + if (errno != EEXIST) { +@@ -469,7 +469,7 @@ static bool do_send(int s, const std::string& spec, std::vector& buffer) { + uint64_t capabilities = 0; + if (should_use_fs_config(path)) { + unsigned int broken_api_hack = mode; +- fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); ++ // fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); + mode = broken_api_hack; + } + +diff --git a/system/core/adb/daemon/framebuffer_service.h b/system/core/adb/daemon/framebuffer_service.h +index bab44be3..264da597 100644 +--- a/system/core/adb/daemon/framebuffer_service.h ++++ b/system/core/adb/daemon/framebuffer_service.h +@@ -18,6 +18,4 @@ + + #include "adb_unique_fd.h" + +-#if defined(__ANDROID__) + void framebuffer_service(unique_fd fd); +-#endif +diff --git a/system/core/adb/daemon/main.cpp b/system/core/adb/daemon/main.cpp +index 3322574c..e807d13d 100644 +--- a/system/core/adb/daemon/main.cpp ++++ b/system/core/adb/daemon/main.cpp +@@ -208,6 +208,9 @@ int adbd_main(int server_port) { + umask(0); + + signal(SIGPIPE, SIG_IGN); ++ signal(SIGINT, SIG_DFL); ++ signal(SIGQUIT, SIG_DFL); ++ + + #if defined(__BIONIC__) + auto fdsan_level = android_fdsan_get_error_level(); +@@ -254,13 +257,11 @@ int adbd_main(int server_port) { + + bool is_usb = false; + +-#if defined(__ANDROID__) + if (access(USB_FFS_ADB_EP0, F_OK) == 0) { + // Listen on USB. + usb_init(); + is_usb = true; + } +-#endif + + // If one of these properties is set, also listen on that port. + // If one of the properties isn't set and we couldn't listen on usb, listen +diff --git a/system/core/adb/daemon/restart_service.h b/system/core/adb/daemon/restart_service.h +index 19840bd5..7a97614b 100644 +--- a/system/core/adb/daemon/restart_service.h ++++ b/system/core/adb/daemon/restart_service.h +@@ -18,9 +18,7 @@ + + #include "adb_unique_fd.h" + +-#if defined(__ANDROID__) + void restart_root_service(unique_fd fd); + void restart_unroot_service(unique_fd fd); + void restart_tcp_service(unique_fd fd, int port); + void restart_usb_service(unique_fd fd); +-#endif +diff --git a/system/core/adb/daemon/services.cpp b/system/core/adb/daemon/services.cpp +index 4ec90d27..d8541c23 100644 +--- a/system/core/adb/daemon/services.cpp ++++ b/system/core/adb/daemon/services.cpp +@@ -156,7 +156,7 @@ static void spin_service(unique_fd fd) { + } + #endif + // Fall through +- std::string cmd = "/system/bin/reboot "; ++ std::string cmd = "/sbin/reboot "; + cmd += name; + return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone); + } +@@ -265,11 +265,10 @@ unique_fd daemon_service_to_fd(std::string_view name, atransport* transport) { + } + #endif + +-#if defined(__ANDROID__) + if (name.starts_with("framebuffer:")) { + return create_service_thread("fb", framebuffer_service); + } else if (android::base::ConsumePrefix(&name, "remount:")) { +- std::string cmd = "/system/bin/remount "; ++ std::string cmd = "/sbin/remount "; + cmd += name; + return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone); + } else if (android::base::ConsumePrefix(&name, "reboot:")) { +@@ -303,7 +302,6 @@ unique_fd daemon_service_to_fd(std::string_view name, atransport* transport) { + } else if (name.starts_with("usb:")) { + return create_service_thread("usb", restart_usb_service); + } +-#endif + + if (android::base::ConsumePrefix(&name, "dev:")) { + return unique_fd{unix_open(name, O_RDWR | O_CLOEXEC)}; +diff --git a/system/core/adb/daemon/shell_service.cpp b/system/core/adb/daemon/shell_service.cpp +index f62032d0..ebcfe18d 100644 +--- a/system/core/adb/daemon/shell_service.cpp ++++ b/system/core/adb/daemon/shell_service.cpp +@@ -273,13 +273,16 @@ bool Subprocess::ForkAndExec(std::string* error) { + env["HOSTNAME"] = GetHostName(); + env["LOGNAME"] = pw->pw_name; + env["SHELL"] = pw->pw_shell; +- env["TMPDIR"] = "/data/local/tmp"; + env["USER"] = pw->pw_name; + } + + if (!terminal_type_.empty()) { + env["TERM"] = terminal_type_; + } ++ if (env.find("PS1") == env.end()) { ++ env["PS1"] = "\\h:\\w\\$ "; ++ } ++ + + std::vector joined_env; + for (const auto& it : env) { +diff --git a/system/core/adb/types.h b/system/core/adb/types.h +index c619fffc..f8e0f521 100644 +--- a/system/core/adb/types.h ++++ b/system/core/adb/types.h +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #include + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch deleted file mode 100644 index 7d6d588dd5..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 30193c177138551a9aa269ae249ed2800811b223 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:24:11 +0100 -Subject: [PATCH] libcrypto.mk: modifications to make it build in yocto - environment - -Adding an include file that is setting the common flags. - -Modified the build rule so that it outputs the binary and include -to the OUT_DIR - -Signed-off-by: Nisha Parrakat ---- - debian/libcrypto.mk | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/debian/libcrypto.mk b/debian/libcrypto.mk -index 4c0268e..8b41056 100644 ---- a/debian/libcrypto.mk -+++ b/debian/libcrypto.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - include sources.mk - - NAME = libcrypto -@@ -26,6 +27,8 @@ CPPFLAGS += -Isrc/include -Isrc/crypto - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread - - build: $(SOURCES) -- mkdir --parents debian/out -- $(CC) $^ -o debian/out/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 debian/out/$(NAME).so -\ No newline at end of file -+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -+ mkdir --parents $(OUT_DIR)/usr/include -+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DOPENSSL_NO_ASM -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r include/openssl $(OUT_DIR)/usr/include --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch deleted file mode 100644 index 04592da81f..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch +++ /dev/null @@ -1,54 +0,0 @@ -From e284ceac2b10133ca916bbae8055f040607b506c Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:21:49 +0100 -Subject: [PATCH 1/2] libext4_utils.mk: modifications to make it build in yocto - environment - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary and header to the OUT_DIR - -Signed-off-by: Nisha Parrakat ---- - debian/libext4_utils.mk | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/debian/libext4_utils.mk b/debian/libext4_utils.mk -index 868e790..2e93158 100644 ---- a/debian/libext4_utils.mk -+++ b/debian/libext4_utils.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = libext4_utils - - ext4_utils_SOURCES := \ -@@ -17,14 +18,16 @@ CPPFLAGS += \ - -Iext4_utils/include \ - -Ilibfec/include \ - -Isquashfs_utils \ -- -I/usr/include/android \ -+ -I/usr/include/android -I$(OUT_DIR)/usr/include \ - -D_GNU_SOURCE -DFEC_NO_KLOG -DSQUASHFS_NO_KLOG -D_LARGEFILE64_SOURCE - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ - -lbase -lsparse -lselinux - - build: $(SOURCES) -- mkdir --parents $(OUT_DIR) -- $(CC) $^ -o $(OUT_DIR)/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so -+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r ext4_utils/include/* $(OUT_DIR)/usr/include/ -+ --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch deleted file mode 100644 index 335f8b0ac8..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0001-patching-libundwind-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,58 +0,0 @@ -From d5fb34aef65b5c5472544e4f42ad777d8fa16ba9 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:41:52 +0100 -Subject: [PATCH] patching libundwind to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Passing the architecture details($CPU)from the recipe. - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/libunwind.mk | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/debian/libunwind.mk b/debian/libunwind.mk -index 738b205..ada4ef9 100644 ---- a/debian/libunwind.mk -+++ b/debian/libunwind.mk -@@ -1,4 +1,4 @@ --include debian/detect_arch.mk -+include ../../rules_yocto.mk - - ARCH_SOURCES = is_fpreg.c \ - regname.c \ -@@ -131,10 +131,12 @@ CFLAGS += -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -Werror -Wno-unused-parameter - - CPPFLAGS += -Iinclude -Isrc $($(CPU)_INCLUDES) -Idebian/include - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -lpthread -nostdlib -lc -lgcc -Ldebian/out -l7z -+ -lpthread -nostdlib -lc -lgcc -l7z - - build: $(SOURCES) -- mkdir --parents debian/out -- ln -s /usr/lib/p7zip/7z.so debian/out/lib7z.so -- $(CC) $^ -o debian/out/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 debian/out/$(NAME).so -+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -+ mkdir --parents $(OUT_DIR)/usr/include/android/libunwind -+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -Wno-header-guard -Wno-absolute-value -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r include/* debian/include/* $(OUT_DIR)/usr/include/android/libunwind/ -+ --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-android-tools-modifications-to-make-it-build-in-yoct.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-android-tools-modifications-to-make-it-build-in-yoct.patch new file mode 100644 index 0000000000..2b95ad2b0a --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-android-tools-modifications-to-make-it-build-in-yoct.patch @@ -0,0 +1,366 @@ +From fe211cbc305a9316c1d4da2f086d6a50f1c92188 Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier +Date: Fri, 17 Mar 2023 10:33:11 +0100 +Subject: [PATCH] android-tools: modifications to make it build in yocto + +- Fix relocation errors on aarch64, e.g.: +"relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZTV19SparseFileBufSource' which may bind externally can not be used when making a shared object; recompile with -fPIC" + +- use ln -f to avoid error "File exists" on incremental builds + +- fix missing headers + +Signed-off-by: Etienne Cordonnier + +--- + debian/external/boringssl/libcrypto.mk | 1 + + debian/system/core/append2simg.mk | 2 +- + debian/system/core/fastboot.mk | 2 +- + debian/system/core/img2simg.mk | 2 +- + debian/system/core/libbacktrace.mk | 8 ++++---- + debian/system/core/libbase.mk | 5 +++-- + debian/system/core/libcutils.mk | 5 +++-- + debian/system/core/liblog.mk | 3 ++- + debian/system/core/libsparse.mk | 5 +++-- + debian/system/core/libutils.mk | 2 +- + debian/system/core/libziparchive.mk | 5 +++-- + debian/system/core/simg2img.mk | 2 +- + debian/system/core/simg2simg.mk | 2 +- + frameworks/native/libs/adbd_auth/adbd_auth.cpp | 2 ++ + system/core/adb/adb_listeners.cpp | 12 ++++++------ + system/core/adb/transport_local.cpp | 2 +- + 16 files changed, 34 insertions(+), 26 deletions(-) + +diff --git a/debian/external/boringssl/libcrypto.mk b/debian/external/boringssl/libcrypto.mk +index c0ea54f4..b3a77bfd 100644 +--- a/debian/external/boringssl/libcrypto.mk ++++ b/debian/external/boringssl/libcrypto.mk +@@ -27,6 +27,7 @@ CPPFLAGS += \ + -DBORINGSSL_IMPLEMENTATION \ + -DBORINGSSL_SHARED_LIBRARY \ + -DOPENSSL_SMALL \ ++ -DOPENSSL_NO_ASM \ + -Iexternal/boringssl/src/crypto \ + -Iexternal/boringssl/src/include \ + +diff --git a/debian/system/core/append2simg.mk b/debian/system/core/append2simg.mk +index 1599bdb8..598c751d 100644 +--- a/debian/system/core/append2simg.mk ++++ b/debian/system/core/append2simg.mk +@@ -11,7 +11,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN/../lib/android' \ + -lbase \ + -llog \ + -lpthread \ +diff --git a/debian/system/core/fastboot.mk b/debian/system/core/fastboot.mk +index d5c9a285..a59ba1a4 100644 +--- a/debian/system/core/fastboot.mk ++++ b/debian/system/core/fastboot.mk +@@ -49,7 +49,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN/../lib/android' \ + -fuse-ld=gold \ + -lbase \ + -lcutils \ +diff --git a/debian/system/core/img2simg.mk b/debian/system/core/img2simg.mk +index 11adf014..8baf5ba5 100644 +--- a/debian/system/core/img2simg.mk ++++ b/debian/system/core/img2simg.mk +@@ -11,7 +11,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN/../lib/android' \ + -lbase \ + -llog \ + -lpthread \ +diff --git a/debian/system/core/libbacktrace.mk b/debian/system/core/libbacktrace.mk +index e3411d76..86e69874 100644 +--- a/debian/system/core/libbacktrace.mk ++++ b/debian/system/core/libbacktrace.mk +@@ -1,3 +1,4 @@ ++include rules_yocto.mk + include /usr/share/dpkg/architecture.mk + + NAME = libbacktrace +@@ -83,10 +84,9 @@ CPPFLAGS += \ + LDFLAGS += \ + -L/usr/lib/p7zip \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/p7zip \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ +- -l:7z.so \ ++ -l7z \ + -lbase \ + -llog \ + -lpthread \ +@@ -101,7 +101,7 @@ endif + build: $(OBJECTS_CXX) $(OBJECTS_ASSEMBLY) debian/out/external/libunwind/libunwind.a + mkdir -p debian/out/system/core + $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) +- cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so ++ cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so + + $(OBJECTS_CXX): %.o: %.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) +diff --git a/debian/system/core/libbase.mk b/debian/system/core/libbase.mk +index d2b074ba..8a90d6de 100644 +--- a/debian/system/core/libbase.mk ++++ b/debian/system/core/libbase.mk +@@ -1,3 +1,4 @@ ++include rules_yocto.mk + NAME = libbase + + SOURCES = \ +@@ -30,7 +31,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ + -llog \ + -lpthread \ +@@ -44,7 +45,7 @@ endif + + build: $(OBJECTS) + $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) +- cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so ++ cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so + + $(OBJECTS): %.o: %.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) +diff --git a/debian/system/core/libcutils.mk b/debian/system/core/libcutils.mk +index 9d928b56..c22b0965 100644 +--- a/debian/system/core/libcutils.mk ++++ b/debian/system/core/libcutils.mk +@@ -1,3 +1,4 @@ ++include rules_yocto.mk + NAME = libcutils + + libcutils_nonwindows_sources = \ +@@ -47,7 +48,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ + -lbase \ + -llog \ +@@ -56,7 +57,7 @@ LDFLAGS += \ + + build: $(OBJECTS_C) $(OBJECTS_CXX) + $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) +- cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so ++ cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so + + $(OBJECTS_C): %.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) +diff --git a/debian/system/core/liblog.mk b/debian/system/core/liblog.mk +index f8c3d7fe..34a07341 100644 +--- a/debian/system/core/liblog.mk ++++ b/debian/system/core/liblog.mk +@@ -1,3 +1,4 @@ ++include rules_yocto.mk + NAME = liblog + + liblog_sources = \ +@@ -35,7 +36,7 @@ LDFLAGS += \ + build: $(OBJECTS) + mkdir -p debian/out/system/core + $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) +- cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so ++ cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so + + $(OBJECTS): %.o: %.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) +diff --git a/debian/system/core/libsparse.mk b/debian/system/core/libsparse.mk +index c2b2694c..2da12b8e 100644 +--- a/debian/system/core/libsparse.mk ++++ b/debian/system/core/libsparse.mk +@@ -1,3 +1,4 @@ ++include rules_yocto.mk + NAME = libsparse + + SOURCES = \ +@@ -19,7 +20,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ + -lbase \ + -lz \ +@@ -27,7 +28,7 @@ LDFLAGS += \ + + build: $(OBJECTS) + $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) +- cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so ++ cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so + + $(OBJECTS): %.o: %.cpp + $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) +diff --git a/debian/system/core/libutils.mk b/debian/system/core/libutils.mk +index c37b1d2d..332492c1 100644 +--- a/debian/system/core/libutils.mk ++++ b/debian/system/core/libutils.mk +@@ -41,7 +41,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ + -lbacktrace \ + -lcutils \ +diff --git a/debian/system/core/libziparchive.mk b/debian/system/core/libziparchive.mk +index 1b286b4e..1b7499be 100644 +--- a/debian/system/core/libziparchive.mk ++++ b/debian/system/core/libziparchive.mk +@@ -1,3 +1,4 @@ ++include rules_yocto.mk + NAME = libziparchive + + SOURCES = \ +@@ -19,7 +20,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN' \ + -Wl,-soname,$(NAME).so.0 \ + -lbase \ + -llog \ +@@ -29,7 +30,7 @@ LDFLAGS += \ + + build: $(OBJECTS) + $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) +- cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so ++ cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so + + $(OBJECTS): %.o: %.cc + $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) +diff --git a/debian/system/core/simg2img.mk b/debian/system/core/simg2img.mk +index f6e3f59d..df4f44f3 100644 +--- a/debian/system/core/simg2img.mk ++++ b/debian/system/core/simg2img.mk +@@ -13,7 +13,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN/../lib/android' \ + -lbase \ + -llog \ + -lpthread \ +diff --git a/debian/system/core/simg2simg.mk b/debian/system/core/simg2simg.mk +index ed53b04c..646ab030 100644 +--- a/debian/system/core/simg2simg.mk ++++ b/debian/system/core/simg2simg.mk +@@ -13,7 +13,7 @@ CPPFLAGS += \ + + LDFLAGS += \ + -Ldebian/out/system/core \ +- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ ++ -Wl,-rpath='$$ORIGIN/../lib/android' \ + -lbase \ + -llog \ + -lpthread \ +diff --git a/frameworks/native/libs/adbd_auth/adbd_auth.cpp b/frameworks/native/libs/adbd_auth/adbd_auth.cpp +index a9c23110..6ca334ba 100644 +--- a/frameworks/native/libs/adbd_auth/adbd_auth.cpp ++++ b/frameworks/native/libs/adbd_auth/adbd_auth.cpp +@@ -23,8 +23,10 @@ + #include + #include + ++#include + #include + #include ++#include + #include + #include + #include +diff --git a/system/core/adb/adb_listeners.cpp b/system/core/adb/adb_listeners.cpp +index 29909a55..440cdbd4 100644 +--- a/system/core/adb/adb_listeners.cpp ++++ b/system/core/adb/adb_listeners.cpp +@@ -109,7 +109,7 @@ static void listener_event_func(int _fd, unsigned ev, void* _l) + } + + // Called as a transport disconnect function. |arg| is the raw alistener*. +-static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_mutex) { ++static void listener_disconnect(void* arg, atransport*) { + std::lock_guard lock(listener_list_mutex); + for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { + if (iter->get() == arg) { +@@ -121,7 +121,7 @@ static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_m + } + + // Write the list of current listeners (network redirections) into a string. +-std::string format_listeners() EXCLUDES(listener_list_mutex) { ++std::string format_listeners() { + std::lock_guard lock(listener_list_mutex); + std::string result; + for (auto& l : listener_list) { +@@ -140,7 +140,7 @@ std::string format_listeners() EXCLUDES(listener_list_mutex) { + } + + InstallStatus remove_listener(const char* local_name, atransport* transport) +- EXCLUDES(listener_list_mutex) { ++{ + std::lock_guard lock(listener_list_mutex); + for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { + if (local_name == (*iter)->local_name) { +@@ -151,7 +151,7 @@ InstallStatus remove_listener(const char* local_name, atransport* transport) + return INSTALL_STATUS_LISTENER_NOT_FOUND; + } + +-void remove_all_listeners() EXCLUDES(listener_list_mutex) { ++void remove_all_listeners() { + std::lock_guard lock(listener_list_mutex); + auto iter = listener_list.begin(); + while (iter != listener_list.end()) { +@@ -164,7 +164,7 @@ void remove_all_listeners() EXCLUDES(listener_list_mutex) { + } + } + +-void close_smartsockets() EXCLUDES(listener_list_mutex) { ++void close_smartsockets() { + std::lock_guard lock(listener_list_mutex); + auto pred = [](const std::unique_ptr& listener) { + return listener->local_name == "*smartsocket*"; +@@ -174,7 +174,7 @@ void close_smartsockets() EXCLUDES(listener_list_mutex) { + + InstallStatus install_listener(const std::string& local_name, const char* connect_to, + atransport* transport, int no_rebind, int* resolved_tcp_port, +- std::string* error) EXCLUDES(listener_list_mutex) { ++ std::string* error) { + std::lock_guard lock(listener_list_mutex); + for (auto& l : listener_list) { + if (local_name == l->local_name) { +diff --git a/system/core/adb/transport_local.cpp b/system/core/adb/transport_local.cpp +index c7261860..5988ec4d 100644 +--- a/system/core/adb/transport_local.cpp ++++ b/system/core/adb/transport_local.cpp +@@ -333,7 +333,7 @@ struct EmulatorConnection : public FdConnection { + + /* Only call this function if you already hold local_transports_lock. */ + static atransport* find_emulator_transport_by_adb_port_locked(int adb_port) +- REQUIRES(local_transports_lock) { ++{ + auto it = local_transports.find(adb_port); + if (it == local_transports.end()) { + return nullptr; diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch deleted file mode 100644 index 25f8efee73..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0002-libfec-change-out_dir-in-makefile.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 3be070a1fe2efa2877684f95c6a5643f76ee8bbc Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:32:11 +0100 -Subject: [PATCH 2/2] libfec: change out_dir in makefile - ---- - debian/libfec.mk | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/debian/libfec.mk b/debian/libfec.mk -index 1d48392..dea9316 100644 ---- a/debian/libfec.mk -+++ b/debian/libfec.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = libfec - - # copied from libfec/Android.bp -@@ -12,20 +13,21 @@ CXXSOURCES := $(foreach source, $(filter %.cpp, $(SOURCES)), libfec/$(source)) - CXXFLAGS += -fno-strict-aliasing -std=g++17 - CPPFLAGS += \ - -Iext4_utils/include \ -- -Ilibfec/include \ -+ -Ilibfec/include -I $(OUT_DIR)/usr/include \ - -D_GNU_SOURCE -DFEC_NO_KLOG -D_LARGEFILE64_SOURCE - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ - -lbase -lsparse -lselinux - - build: $(COBJECTS) $(CXXOBJECTS) -- mkdir -p $(OUT_DIR) -- $(CXX) $^ -o $(OUT_DIR)/$(NAME).so.0 $(LDFLAGS) -- ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so -+ mkdir -p $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r libfec/include/* $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so* -+ $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* - - $(COBJECTS): %.o: %.c - $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch new file mode 100644 index 0000000000..7ea040c68a --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch @@ -0,0 +1,126 @@ +From 02b6b6977d80af4b9b806054fadb5a06cedf011d Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier +Date: Tue, 14 Mar 2023 11:33:50 +0100 +Subject: [PATCH] Update usage of usbdevfs_urb to match new kernel UAPI +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Linux kernel API has been changed by commit 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members") +where zero-length array iso_frame_desc in struct usbdevfs_urb was replaced with a proper flexible-array member. + +Current USB API usage causes a compilation error at Linux 6.0: + +In file included from /home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:28: +/usr/include/linux/usbdevice_fs.h:134:41: error: flexible array member ‘usbdevfs_urb::iso_frame_desc’ not at end of ‘struct usb_handle’ + 134 | struct usbdevfs_iso_packet_desc iso_frame_desc[]; + | ^~~~~~~~~~~~~~ +/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:76:18: note: next member ‘usbdevfs_urb usb_handle::urb_out’ declared here + 76 | usbdevfs_urb urb_out; + | ^~~~~~~ +/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:61:8: note: in the definition of ‘struct usb_handle’ + 61 | struct usb_handle { + | ^~~~~~~~~~ + +Fix it by using pointers to a struct with flexible-array members. +Current fix works both with the old and the new API. + +See https://github.com/nmeum/android-tools/issues/74 for more context. + +Tested: built on Linux against kernel 5.19 and 6.0; 'adb shell' over USB +cable +Acked-by: Gustavo A. R. Silva gustavoars@kernel.org +Change-Id: I7f0f7b35d9a3ab980d3520b541b60c7857a6b101 +Signed-off-by: Anatol Pomozov + +[Backported on version 10] +Signed-off-by: Etienne Cordonnier + +--- + system/core/adb/client/usb_linux.cpp | 24 ++++++++++++++---------- + 1 file changed, 14 insertions(+), 10 deletions(-) + +diff --git a/system/core/adb/client/usb_linux.cpp b/system/core/adb/client/usb_linux.cpp +index 343e7b59..6a4479f3 100644 +--- a/system/core/adb/client/usb_linux.cpp ++++ b/system/core/adb/client/usb_linux.cpp +@@ -71,8 +71,8 @@ struct usb_handle : public ::usb_handle { + unsigned zero_mask; + unsigned writeable = 1; + +- usbdevfs_urb urb_in; +- usbdevfs_urb urb_out; ++ usbdevfs_urb *urb_in; ++ usbdevfs_urb *urb_out; + + bool urb_in_busy = false; + bool urb_out_busy = false; +@@ -305,7 +305,7 @@ static int usb_bulk_write(usb_handle* h, const void* data, int len) { + std::unique_lock lock(h->mutex); + D("++ usb_bulk_write ++"); + +- usbdevfs_urb* urb = &h->urb_out; ++ usbdevfs_urb* urb = h->urb_out; + memset(urb, 0, sizeof(*urb)); + urb->type = USBDEVFS_URB_TYPE_BULK; + urb->endpoint = h->ep_out; +@@ -344,7 +344,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { + std::unique_lock lock(h->mutex); + D("++ usb_bulk_read ++"); + +- usbdevfs_urb* urb = &h->urb_in; ++ usbdevfs_urb* urb = h->urb_in; + memset(urb, 0, sizeof(*urb)); + urb->type = USBDEVFS_URB_TYPE_BULK; + urb->endpoint = h->ep_in; +@@ -389,7 +389,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { + } + D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length); + +- if (out == &h->urb_in) { ++ if (out == h->urb_in) { + D("[ reap urb - IN complete ]"); + h->urb_in_busy = false; + if (urb->status != 0) { +@@ -398,7 +398,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { + } + return urb->actual_length; + } +- if (out == &h->urb_out) { ++ if (out == h->urb_out) { + D("[ reap urb - OUT compelete ]"); + h->urb_out_busy = false; + h->cv.notify_all(); +@@ -502,10 +502,10 @@ void usb_kick(usb_handle* h) { + ** but this ensures that a reader blocked on REAPURB + ** will get unblocked + */ +- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in); +- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out); +- h->urb_in.status = -ENODEV; +- h->urb_out.status = -ENODEV; ++ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_in); ++ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_out); ++ h->urb_in->status = -ENODEV; ++ h->urb_out->status = -ENODEV; + h->urb_in_busy = false; + h->urb_out_busy = false; + h->cv.notify_all(); +@@ -521,6 +521,8 @@ int usb_close(usb_handle* h) { + + D("-- usb close %p (fd = %d) --", h, h->fd); + ++ delete h->urb_in; ++ delete h->urb_out; + delete h; + + return 0; +@@ -556,6 +558,8 @@ static void register_device(const char* dev_name, const char* dev_path, unsigned + usb->ep_out = ep_out; + usb->zero_mask = zero_mask; + usb->max_packet_size = max_packet_size; ++ usb->urb_in = new usbdevfs_urb; ++ usb->urb_out = new usbdevfs_urb; + + // Initialize mark so we don't get garbage collected after the device scan. + usb->mark = true; diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0004-adb-Fix-build-on-big-endian-systems.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0004-adb-Fix-build-on-big-endian-systems.patch new file mode 100644 index 0000000000..83fe4475c3 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0004-adb-Fix-build-on-big-endian-systems.patch @@ -0,0 +1,48 @@ +From e4a29888cb52c1eafd3ab57a6e220b38147ecfbe Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier +Date: Tue, 14 Mar 2023 13:39:23 +0100 +Subject: [PATCH] adb: Fix build on big endian systems + +The usb_linux_client.c file defines cpu_to_le16/32 by using the C +library htole16/32 function calls. However, cpu_to_le16/32 are used +when initializing structures, i.e in a context where a function call +is not allowed. + +It works fine on little endian systems because htole16/32 are defined +by the C library as no-ops. But on big-endian systems, they are +actually doing something, which might involve calling a function, +causing build failures. + +To solve this, we simply open-code cpu_to_le16/32 in a way that allows +them to be used when initializing structures. + +Signed-off-by: Thomas Petazzoni +[Forward-ported to version 29] +Signed-off-by: Etienne Cordonnier + +--- + system/core/adb/daemon/usb_ffs.cpp | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/system/core/adb/daemon/usb_ffs.cpp b/system/core/adb/daemon/usb_ffs.cpp +index b19fa5d5..ef2291ca 100644 +--- a/system/core/adb/daemon/usb_ffs.cpp ++++ b/system/core/adb/daemon/usb_ffs.cpp +@@ -39,8 +39,15 @@ + + #define USB_EXT_PROP_UNICODE 1 + +-#define cpu_to_le16(x) htole16(x) +-#define cpu_to_le32(x) htole32(x) ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++# define cpu_to_le16(x) (x) ++# define cpu_to_le32(x) (x) ++#else ++# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) ++# define cpu_to_le32(x) \ ++ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ ++ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) ++#endif + + // clang-format off + struct func_desc { diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0005-adb-Allow-adbd-to-be-run-as-root.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0005-adb-Allow-adbd-to-be-run-as-root.patch new file mode 100644 index 0000000000..3fbdcd4bac --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/0005-adb-Allow-adbd-to-be-run-as-root.patch @@ -0,0 +1,23 @@ +From 4ef35041ba5c02df48c31f2382e7c3c4316ad936 Mon Sep 17 00:00:00 2001 +From: Etienne Cordonnier +Date: Tue, 14 Mar 2023 13:53:51 +0100 +Subject: [PATCH] adb: Allow adbd to be run as root + +Signed-off-by: Etienne Cordonnier + +--- + system/core/adb/daemon/main.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/system/core/adb/daemon/main.cpp b/system/core/adb/daemon/main.cpp +index e807d13d..309663a2 100644 +--- a/system/core/adb/daemon/main.cpp ++++ b/system/core/adb/daemon/main.cpp +@@ -75,6 +75,7 @@ static bool should_drop_capabilities_bounding_set() { + } + + static bool should_drop_privileges() { ++ return true; + // "adb root" not allowed, always drop privileges. + if (!ALLOW_ADBD_ROOT && !is_device_unlocked()) return true; + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/adbd.mk b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/adbd.mk index cb82683bbd..3282216b8e 100644 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/adbd.mk +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/adbd.mk @@ -1,18 +1,23 @@ -include ../../rules_yocto.mk +include rules_yocto.mk NAME = adbd SOURCES = \ - adb/daemon/main.cpp \ + adb/adbconnection/adbconnection_server.cpp \ adb/daemon/auth.cpp \ - adb/daemon/jdwp_service.cpp \ adb/daemon/file_sync_service.cpp \ + adb/daemon/file_sync_service.h \ + adb/daemon/framebuffer_service.cpp \ + adb/daemon/framebuffer_service.h \ + adb/daemon/jdwp_service.cpp \ + adb/daemon/main.cpp \ + adb/daemon/restart_service.cpp \ + adb/daemon/restart_service.h \ adb/daemon/services.cpp \ adb/daemon/shell_service.cpp \ - adb/daemon/remount_service.cpp \ - adb/daemon/restart_service.cpp \ - adb/daemon/reboot_service.cpp \ - adb/daemon/framebuffer_service.cpp \ - adb/daemon/set_verity_enable_state_service.cpp \ + adb/daemon/shell_service.h \ + adb/daemon/usb_ffs.cpp \ + adb/daemon/usb_legacy.cpp \ + adb/daemon/usb.cpp \ adb/shell_service_protocol.cpp \ adb/adb.cpp \ adb/adb_io.cpp \ @@ -20,41 +25,51 @@ SOURCES = \ adb/adb_trace.cpp \ adb/adb_unique_fd.cpp \ adb/adb_utils.cpp \ - adb/fdevent.cpp \ + adb/fdevent/fdevent.cpp \ + adb/fdevent/fdevent_epoll.cpp \ adb/services.cpp \ adb/sockets.cpp \ adb/socket_spec.cpp \ adb/sysdeps/errno.cpp \ + adb/sysdeps/posix/network.cpp \ + adb/sysdeps_unix.cpp \ adb/transport.cpp \ adb/transport_fd.cpp \ adb/transport_local.cpp \ adb/transport_usb.cpp \ - adb/sysdeps_unix.cpp \ - adb/sysdeps/posix/network.cpp \ - adb/daemon/usb_legacy.cpp \ - adb/daemon/usb_ffs.cpp \ - adb/daemon/usb.cpp \ + adb/types.cpp \ diagnose_usb/diagnose_usb.cpp \ libasyncio/AsyncIO.cpp \ +SOURCES := $(foreach source, $(SOURCES), system/core/$(source)) + +SOURCES += \ + frameworks/native/libs/adbd_auth/adbd_auth.cpp + CXXFLAGS += -std=gnu++20 -CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ -Imkbootimg/include/bootimg -Ifs_mgr/include \ - -Ifs_mgr/include_fstab \ +CPPFLAGS += -Isystem/coreinclude -Isystem/core/adb -Isystem/core/base/include -Idebian/out/system/core -Isystem/tools/mkbootimg/include/bootimg -Isystem/core/fs_mgr/include \ + -Isystem/core/fs_mgr/include_fstab \ -DADB_VERSION='"$(DEB_VERSION)"' -D_GNU_SOURCE -LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ - -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lbase -lcrypto_utils -lcrypto -lcutils -llog -lresolv +LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib/android' -Wl,-rpath-link='$$ORIGIN/../lib/android' \ + -lpthread -Ldebian/out/system/core -Ldebian/out/external/boringssl -lbase -lcrypto_utils -l:libcrypto.a -lcutils -llog -lresolv PAGE_SIZE ?= 4096 CXXFLAGS += -UADB_HOST -CXXFLAGS += -DADB_HOST=0 +CXXFLAGS += -DADB_HOST=0 CXXFLAGS += -DALLOW_ADBD_DISABLE_VERITY CXXFLAGS += -DALLOW_ADBD_NO_AUTH -CXXFLAGS += -DPLATFORM_TOOLS_VERSION='"28.0.2"' -CXXFLAGS += -Idiagnose_usb/include -CXXFLAGS += -Iadb/daemon/include -CXXFLAGS += -Ilibasyncio/include -CXXFLAGS += -Wno-c++11-narrowing +CXXFLAGS += -DPLATFORM_TOOLS_VERSION='"28.0.2"' +CXXFLAGS += -Isystem/core/diagnose_usb/include +CXXFLAGS += -Isystem/core/adb/daemon/include +CXXFLAGS += -Isystem/core/adb/adbconnection/include +CXXFLAGS += -Isystem/core/libasyncio/include +CXXFLAGS += -Isystem/core/libcutils/include +CXXFLAGS += -Isystem/core/libcrypto_utils/include +CXXFLAGS += -Isystem/core/liblog/include/ +CXXFLAGS += -Isystem/core/libutils/include +CXXFLAGS += -Iframeworks/native/libs/adbd_auth/include +CXXFLAGS += -Wno-c++11-narrowing CXXFLAGS += -DPAGE_SIZE=$(PAGE_SIZE) @@ -65,8 +80,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) endif build: $(SOURCES) - mkdir --parents ../../../android-tools/adbd - $(CXX) $^ -o ../../../android-tools/adbd/adbd $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) + mkdir --parents debian/out/system/core + $(CXX) $^ -o debian/out/system/core/adbd $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) clean: - $(RM) $(OUT_DIR)/usr/bin/$(NAME) + $(RM) debian/out/system/core/adbd diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Added-missing-headers.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Added-missing-headers.patch deleted file mode 100644 index 2820e7980e..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Added-missing-headers.patch +++ /dev/null @@ -1,94 +0,0 @@ -Description: Added missing headers causing compile errors -Author: Umang Parmar -Forwarded: not-needed - ---- a/adb/sysdeps/posix/network.cpp -+++ b/adb/sysdeps/posix/network.cpp -@@ -22,6 +22,7 @@ - #include - - #include -+#include - - #include - #include ---- a/base/errors_unix.cpp -+++ b/base/errors_unix.cpp -@@ -17,6 +17,7 @@ - #include "android-base/errors.h" - - #include -+#include - - namespace android { - namespace base { ---- a/base/file.cpp -+++ b/base/file.cpp -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include - #include ---- a/base/logging.cpp -+++ b/base/logging.cpp -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - // For getprogname(3) or program_invocation_short_name. - #if defined(__ANDROID__) || defined(__APPLE__) ---- a/libcutils/include/cutils/jstring.h -+++ b/libcutils/include/cutils/jstring.h -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - #ifdef __cplusplus - extern "C" { ---- a/libbacktrace/BacktraceMap.cpp -+++ b/libbacktrace/BacktraceMap.cpp -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - #include - ---- a/demangle/Demangler.cpp -+++ b/demangle/Demangler.cpp -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - #include "Demangler.h" - ---- a/libbacktrace/UnwindStackMap.cpp -+++ b/libbacktrace/UnwindStackMap.cpp -@@ -20,6 +20,7 @@ - - #include - #include -+#include - - #include - #include ---- a/adb/types.h -+++ b/adb/types.h -@@ -17,6 +17,7 @@ - #pragma once - - #include -+#include - #include - #include - #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Nonnull.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Nonnull.patch deleted file mode 100644 index a7e0fa81e7..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Nonnull.patch +++ /dev/null @@ -1,20 +0,0 @@ -Description: Bring Clang's _Nonnull keyword to GCC -Author: Kai-Chung Yan -Forwarded: not-needed ---- a/adb/sysdeps.h -+++ b/adb/sysdeps.h -@@ -40,11 +40,12 @@ - #include "sysdeps/network.h" - #include "sysdeps/stat.h" - -+#define _Nonnull -+#define _Nullable -+ - #ifdef _WIN32 - - // Clang-only nullability specifiers --#define _Nonnull --#define _Nullable - - #include - #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Vector-cast.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Vector-cast.patch deleted file mode 100644 index dd39d1ee7a..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/Vector-cast.patch +++ /dev/null @@ -1,14 +0,0 @@ -Description: Fix the wired error by GCC7 that fails to match the correct parent method. -Author: Kai-Chung Yan -Forwarded: not-needed ---- a/libutils/include/utils/Vector.h -+++ b/libutils/include/utils/Vector.h -@@ -256,7 +256,7 @@ - - template inline - const Vector& Vector::operator = (const Vector& rhs) const { -- VectorImpl::operator = (static_cast(rhs)); -+ VectorImpl::operator = (rhs); - return *this; - } - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/add-missing-headers.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/add-missing-headers.patch deleted file mode 100644 index 62a8ba2033..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/add-missing-headers.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/fs_mgr/liblp/reader.cpp -+++ b/fs_mgr/liblp/reader.cpp -@@ -21,6 +21,7 @@ - #include - - #include -+#include - - #include - #include ---- a/fs_mgr/liblp/writer.cpp -+++ b/fs_mgr/liblp/writer.cpp -@@ -20,6 +20,7 @@ - #include - - #include -+#include - - #include - #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch deleted file mode 100644 index 771f0e71c5..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch +++ /dev/null @@ -1,17 +0,0 @@ -Description: remove clang-ism -Forwarded: not-needed - ---- a/base/include/android-base/logging.h -+++ b/base/include/android-base/logging.h -@@ -484,10 +484,7 @@ - // -Wno-user-defined-warnings to CPPFLAGS. - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wgcc-compat" --#define OSTREAM_STRING_POINTER_USAGE_WARNING \ -- __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) --inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) -- OSTREAM_STRING_POINTER_USAGE_WARNING { -+inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { - return stream << static_cast(string_pointer); - } - #pragma clang diagnostic pop diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch deleted file mode 100644 index 66d1dddc61..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch +++ /dev/null @@ -1,24 +0,0 @@ -Description: non-x86 arches do not have PAGE_SIZE -Forwarded: not-needed ---- a/base/cmsg.cpp -+++ b/base/cmsg.cpp -@@ -33,7 +33,8 @@ - const std::vector& fds) { - size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); - size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); -- if (cmsg_space >= PAGE_SIZE) { -+ size_t pagesize = static_cast(sysconf(_SC_PAGE_SIZE)); -+ if (cmsg_space >= pagesize) { - errno = ENOMEM; - return -1; - } -@@ -75,7 +76,8 @@ - fds->clear(); - - size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds); -- if (cmsg_space >= PAGE_SIZE) { -+ size_t pagesize = static_cast(sysconf(_SC_PAGE_SIZE)); -+ if (cmsg_space >= pagesize) { - errno = ENOMEM; - return -1; - } diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch deleted file mode 100644 index 8a21054ba7..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h -=================================================================== ---- android-platform-system-core.orig/libunwindstack/include/unwindstack/DwarfMemory.h -+++ android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h -@@ -29,7 +29,7 @@ class DwarfMemory { - DwarfMemory(Memory* memory) : memory_(memory) {} - virtual ~DwarfMemory() = default; - -- bool ReadBytes(void* dst, size_t num_bytes); -+ bool ReadBytes(void* dst, std::size_t num_bytes); - - template - bool ReadSigned(uint64_t* value); -@@ -39,7 +39,7 @@ class DwarfMemory { - bool ReadSLEB128(int64_t* value); - - template -- size_t GetEncodedSize(uint8_t encoding); -+ std::size_t GetEncodedSize(uint8_t encoding); - - bool AdjustEncodedValue(uint8_t encoding, uint64_t* value); - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch deleted file mode 100644 index 3622d7ebb1..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/libcutils/include/cutils/threads.h -+++ b/libcutils/include/cutils/threads.h -@@ -33,7 +33,7 @@ - // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. - // - --extern pid_t gettid(); -+extern pid_t gettid(void) __THROW; - - // - // Deprecated: use `_Thread_local` in C or `thread_local` in C++. ---- a/libcutils/threads.cpp -+++ b/libcutils/threads.cpp -@@ -33,7 +33,7 @@ - - // No definition needed for Android because we'll just pick up bionic's copy. - #ifndef __ANDROID__ --pid_t gettid() { -+pid_t gettid(void) __THROW { - #if defined(__APPLE__) - uint64_t tid; - pthread_threadid_np(NULL, &tid); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gnu-hurd.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gnu-hurd.patch deleted file mode 100644 index 6c21022182..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/fix-gnu-hurd.patch +++ /dev/null @@ -1,150 +0,0 @@ -From: Roger Shimizu -Date: Sun, 10 Jan 2021 19:03:17 +0900 -Subject: Fix GNU/Hurd - -Reference: -- https://www.gnu.org/software/hurd/hurd/porting/guidelines.html - -Closes: #915762 ---- - base/cmsg.cpp | 2 ++ - base/threads.cpp | 2 +- - libcutils/ashmem-host.cpp | 20 +++++++++++++++++--- - libcutils/canned_fs_config.cpp | 2 +- - libcutils/fs.cpp | 20 ++++++++++++++++---- - 5 files changed, 37 insertions(+), 9 deletions(-) - -diff --git a/base/cmsg.cpp b/base/cmsg.cpp -index ae5bb16..e5ec321 100644 ---- a/base/cmsg.cpp -+++ b/base/cmsg.cpp -@@ -20,7 +20,9 @@ - #include - #include - #include -+#ifndef __GNU__ - #include -+#endif - - #include - -diff --git a/base/threads.cpp b/base/threads.cpp -index 48f6197..19cc293 100644 ---- a/base/threads.cpp -+++ b/base/threads.cpp -@@ -47,7 +47,7 @@ uint64_t GetThreadId() { - } // namespace base - } // namespace android - --#if defined(__GLIBC__) -+#if defined(__GLIBC__) && !defined(__GNU__) - int tgkill(int tgid, int tid, int sig) { - return syscall(__NR_tgkill, tgid, tid, sig); - } -diff --git a/libcutils/ashmem-host.cpp b/libcutils/ashmem-host.cpp -index 32446d4..83dd622 100644 ---- a/libcutils/ashmem-host.cpp -+++ b/libcutils/ashmem-host.cpp -@@ -31,16 +31,30 @@ - #include - #include - #include -+#include - - #include - - int ashmem_create_region(const char* /*ignored*/, size_t size) { -- char pattern[PATH_MAX]; -- snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); -+ char *pattern; -+ size_t pattern_size = 128; -+ while(1) { -+ pattern = (char*) malloc(pattern_size); -+ if(snprintf(pattern, strlen(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()) < pattern_size) -+ break; -+ free(pattern); -+ pattern_size *= 2; -+ if(pattern_size >= INT_LEAST16_MAX) -+ return -1; -+ } - int fd = mkstemp(pattern); -- if (fd == -1) return -1; -+ if (fd == -1) { -+ free(pattern); -+ return -1; -+ } - - unlink(pattern); -+ free(pattern); - - if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) { - close(fd); -diff --git a/libcutils/canned_fs_config.cpp b/libcutils/canned_fs_config.cpp -index 2772ef0..1e41f37 100644 ---- a/libcutils/canned_fs_config.cpp -+++ b/libcutils/canned_fs_config.cpp -@@ -42,7 +42,7 @@ static int path_compare(const void* a, const void* b) { - } - - int load_canned_fs_config(const char* fn) { -- char buf[PATH_MAX + 200]; -+ char buf[1024]; - FILE* f; - - f = fopen(fn, "r"); -diff --git a/libcutils/fs.cpp b/libcutils/fs.cpp -index ef85acc..2884835 100644 ---- a/libcutils/fs.cpp -+++ b/libcutils/fs.cpp -@@ -33,6 +33,7 @@ - #include - #include - #include -+#include - - #include - -@@ -150,15 +151,24 @@ fail: - } - - int fs_write_atomic_int(const char* path, int value) { -- char temp[PATH_MAX]; -- if (snprintf(temp, PATH_MAX, "%s.XXXXXX", path) >= PATH_MAX) { -- ALOGE("Path too long"); -- return -1; -+ char *temp; -+ size_t temp_size = 128; -+ while(1) { -+ temp = (char*) malloc(temp_size); -+ if(snprintf(temp, strlen(temp), "%s.XXXXXX", path) < temp_size) -+ break; -+ free(temp); -+ temp_size *= 2; -+ if(temp_size >= INT_LEAST16_MAX) { -+ ALOGE("Path too long"); -+ return -1; -+ } - } - - int fd = TEMP_FAILURE_RETRY(mkstemp(temp)); - if (fd == -1) { - ALOGE("Failed to open %s: %s", temp, strerror(errno)); -+ free(temp); - return -1; - } - -@@ -182,12 +192,14 @@ int fs_write_atomic_int(const char* path, int value) { - goto fail_closed; - } - -+ free(temp); - return 0; - - fail: - close(fd); - fail_closed: - unlink(temp); -+ free(temp); - return -1; - } - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/hard-code-build-number.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/hard-code-build-number.patch deleted file mode 100644 index ccc7655e75..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/hard-code-build-number.patch +++ /dev/null @@ -1,43 +0,0 @@ -Description: just hard code rather than deal with circular deps -Forwarded: not-needed ---- a/adb/adb.cpp -+++ b/adb/adb.cpp -@@ -44,8 +44,6 @@ - #include - #include - #include --#include --#include - - #include "adb_auth.h" - #include "adb_io.h" -@@ -69,7 +67,7 @@ - "Version %s-%s\n" - "Installed as %s\n", - ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, -- PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(), -+ PLATFORM_TOOLS_VERSION, "debian", - android::base::GetExecutablePath().c_str()); - } - ---- a/fastboot/fastboot.cpp -+++ b/fastboot/fastboot.cpp -@@ -58,9 +58,7 @@ - #include - #include - #include --#include - #include --#include - #include - #include - -@@ -1680,7 +1678,7 @@ - setvbuf(stdout, nullptr, _IONBF, 0); - setvbuf(stderr, nullptr, _IONBF, 0); - } else if (name == "version") { -- fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str()); -+ fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, "debian"); - fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str()); - return 0; - #if !defined(_WIN32) diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/libusb-header-path.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/libusb-header-path.patch deleted file mode 100644 index d507eab851..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/libusb-header-path.patch +++ /dev/null @@ -1,16 +0,0 @@ -Description: libusb.h comes from different location -Author: Umang Parmar -Forwarded: not-needed -Last-Update: 2018-05-26 - ---- a/adb/client/usb_libusb.cpp -+++ b/adb/client/usb_libusb.cpp -@@ -30,7 +30,7 @@ - #include - #include - --#include -+#include - - #include - #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch deleted file mode 100644 index e71af8637c..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch +++ /dev/null @@ -1,18 +0,0 @@ -Description: Update log file directory. -Author: Umang Parmar -Last Updated: 2018-05-17 - ---- a/adb/adb_utils.cpp -+++ b/adb/adb_utils.cpp -@@ -339,6 +339,11 @@ - - return temp_path_utf8 + log_name; - #else -+ std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid()); -+ struct stat st = {0}; -+ if (stat(log_dir.c_str(), &st) == 0) { -+ return log_dir; -+ } - const char* tmp_dir = getenv("TMPDIR"); - if (tmp_dir == nullptr) tmp_dir = "/tmp"; - return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid()); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/simg_dump-python3.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/simg_dump-python3.patch deleted file mode 100644 index 947b5269b8..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/simg_dump-python3.patch +++ /dev/null @@ -1,62 +0,0 @@ -Description: Port simg_dump to Python 3. -Author: Antonio Russo -Forwarded: no -Last-Update: 2019-01-05 -Origin: https://bugs.debian.org/945646 - ---- -Index: android-platform-system-core/libsparse/simg_dump.py -=================================================================== ---- android-platform-system-core.orig/libsparse/simg_dump.py -+++ android-platform-system-core/libsparse/simg_dump.py -@@ -1,4 +1,4 @@ --#! /usr/bin/env python -+#! /usr/bin/env python3 - - # Copyright (C) 2012 The Android Open Source Project - # -@@ -14,7 +14,7 @@ - # See the License for the specific language governing permissions and - # limitations under the License. - --from __future__ import print_function -+ - import csv - import getopt - import hashlib -@@ -47,7 +47,7 @@ def main(): - opts, args = getopt.getopt(sys.argv[1:], - "vsc:", - ["verbose", "showhash", "csvfile"]) -- except getopt.GetoptError, e: -+ except getopt.GetoptError as e: - print(e) - usage(me) - for o, a in opts: -@@ -66,7 +66,7 @@ def main(): - usage(me) - - if csvfilename: -- csvfile = open(csvfilename, "wb") -+ csvfile = open(csvfilename, "w", newline='') - csvwriter = csv.writer(csvfile) - - output = verbose or csvfilename or showhash -@@ -121,7 +121,7 @@ def main(): - "output offset", "output blocks", "type", "hash"]) - - offset = 0 -- for i in xrange(1, total_chunks + 1): -+ for i in range(1, total_chunks + 1): - header_bin = FH.read(12) - header = struct.unpack("<2H2I", header_bin) - chunk_type = header[0] -@@ -160,7 +160,7 @@ def main(): - if showhash: - h = hashlib.sha1() - data = fill_bin * (blk_sz / 4); -- for block in xrange(chunk_sz): -+ for block in range(chunk_sz): - h.update(data) - curhash = h.hexdigest() - elif chunk_type == 0xCAC3: diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/stdatomic.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/stdatomic.patch deleted file mode 100644 index 8de0035a5e..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/stdatomic.patch +++ /dev/null @@ -1,74 +0,0 @@ -Description: Fix incompatibility between and - This 2 headers combined will cause errors for both GCC and Clang. This patch - makes sure only one of them is present at any time. -Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 -Bug: https://reviews.llvm.org/D45470 ---- a/libcutils/include/cutils/trace.h -+++ b/libcutils/include/cutils/trace.h -@@ -18,7 +18,14 @@ - #define _LIBS_CUTILS_TRACE_H - - #include -+#ifdef __cplusplus -+#include -+using std::atomic_bool; -+using std::atomic_load_explicit; -+using std::memory_order_acquire; -+#else - #include -+#endif - #include - #include - #include ---- a/libcutils/include/cutils/atomic.h -+++ b/libcutils/include/cutils/atomic.h -@@ -19,7 +19,23 @@ - - #include - #include -+#ifdef __cplusplus -+#include -+using std::atomic_compare_exchange_strong_explicit; -+using std::atomic_fetch_add_explicit; -+using std::atomic_fetch_or_explicit; -+using std::atomic_fetch_sub_explicit; -+using std::atomic_int_least32_t; -+using std::atomic_load_explicit; -+using std::atomic_store_explicit; -+using std::atomic_thread_fence; -+using std::memory_order::memory_order_acquire; -+using std::memory_order::memory_order_relaxed; -+using std::memory_order::memory_order_release; -+using std::memory_order::memory_order_seq_cst; -+#else - #include -+#endif - - #ifndef ANDROID_ATOMIC_INLINE - #define ANDROID_ATOMIC_INLINE static inline ---- a/liblog/logger.h -+++ b/liblog/logger.h -@@ -16,7 +16,13 @@ - - #pragma once - -+#ifdef __cplusplus -+#include -+using std::atomic_int; -+using std::atomic_uintptr_t; -+#else - #include -+#endif - #include - - #include ---- a/liblog/logger_write.cpp -+++ b/liblog/logger_write.cpp -@@ -15,7 +15,6 @@ - */ - - #include --#include - #include - #include - #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch deleted file mode 100644 index 5e239b7dc6..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch +++ /dev/null @@ -1,15 +0,0 @@ -Description: Turn #error into exceptions - So the library can be built on non-Linux platforms too, although can't - guarauntee its functionality regarding that piece of code. ---- a/base/file.cpp -+++ b/base/file.cpp -@@ -422,7 +422,8 @@ - path[PATH_MAX - 1] = 0; - return path; - #else --#error unknown OS -+#include -+ throw std::runtime_error(std::string("Unknown OS!")); - #endif - } - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch deleted file mode 100644 index a14261a2e3..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch +++ /dev/null @@ -1,18 +0,0 @@ -Description: Use Python 3 for `mkbootimg` -Bug: https://android.googlesource.com/platform/system/core/+/c434cf82d526f07cd3dcebf53582eeddf12b0a74 ---- a/mkbootimg/mkbootimg.py -+++ b/mkbootimg/mkbootimg.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/python3 - # Copyright 2015, The Android Open Source Project - # - # Licensed under the Apache License, Version 2.0 (the "License"); ---- a/mkbootimg/unpack_bootimg.py -+++ b/mkbootimg/unpack_bootimg.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/python3 - # Copyright 2018, The Android Open Source Project - # - # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch deleted file mode 100644 index 5e153b040f..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch +++ /dev/null @@ -1,31 +0,0 @@ -Description: code uses C99/C++20 constructs that g++ does not support - $ 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 -liblog/fake_writer.cpp:36:5: error: expected primary-expression before ‘.’ token - .context.priv = &logFds, - ^ - This is an ugly hack. The actual fix is probably to compile using - clang. Otherwise, these .context.priv elements shuld be initialized - in a different way. - -Forwarded: not-needed - ---- a/liblog/fake_writer.cpp -+++ b/liblog/fake_writer.cpp -@@ -33,7 +33,6 @@ - - struct android_log_transport_write fakeLoggerWrite = { - .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node}, -- .context.priv = &logFds, - .name = "fake", - .available = NULL, - .open = fakeOpen, ---- a/liblog/stderr_write.cpp -+++ b/liblog/stderr_write.cpp -@@ -56,7 +56,6 @@ - - struct android_log_transport_write stderrLoggerWrite = { - .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node}, -- .context.priv = NULL, - .name = "stderr", - .available = stderrAvailable, - .open = stderrOpen, diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch deleted file mode 100644 index d2ba525570..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,62 +0,0 @@ -From d133fc2c71fb6b0358af453b03bcb6d1874e902a Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 12:25:40 +0100 -Subject: [PATCH 01/15] patching adb.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/adb.mk | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/debian/adb.mk b/debian/adb.mk -index 8dbacf9a..97c9d6ca 100644 ---- a/debian/adb.mk -+++ b/debian/adb.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = adb - - SOURCES = client/adb_client.cpp \ -@@ -12,10 +13,10 @@ SOURCES = client/adb_client.cpp \ - - SOURCES := $(foreach source, $(SOURCES), adb/$(source)) - CXXFLAGS += -std=gnu++2a --CPPFLAGS += -Iinclude -Iadb -Ibase/include \ -+CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ \ - -DADB_VERSION='"$(DEB_VERSION)"' -DADB_HOST=1 -D_GNU_SOURCE --LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=. \ -- -lpthread -L. -ladb -lbase -+LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ -+ -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -ladb -lbase - - # -latomic should be the last library specified - # https://github.com/android/ndk/issues/589 -@@ -24,7 +25,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) - endif - - build: $(SOURCES) -- $(CXX) $^ -o adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -+ mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) - - clean: -- $(RM) adb/$(NAME) -+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch deleted file mode 100644 index 1281caa49c..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f802e7685cfbdd66d74da2975b3a1c6d77f1a2de Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 12:28:10 +0100 -Subject: [PATCH 02/15] libadb.mk: modifications to make it build in yocto - environment - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat ---- - debian/libadb.mk | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/debian/libadb.mk b/debian/libadb.mk -index ae240c98..db5da353 100644 ---- a/debian/libadb.mk -+++ b/debian/libadb.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME := libadb - - LIBADB_SRC_FILES := \ -@@ -43,18 +44,18 @@ CPPFLAGS += \ - -Ibase/include \ - -Idiagnose_usb/include \ - -Ilibcrypto_utils/include \ -- -Iinclude \ -+ -Iinclude -I$(OUT_DIR)/usr/include \ - -DPLATFORM_TOOLS_VERSION='"$(PLATFORM_TOOLS_VERSION)"' \ - -DADB_HOST=1 -DADB_VERSION='"$(DEB_VERSION)"' - - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android -lcrypto \ -- -lpthread -L. -lbase -lcutils -lcrypto_utils -lusb-1.0 -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lcrypto \ -+ -lpthread -lbase -lcutils -lcrypto_utils -lusb-1.0 - - $(NAME).so: $(SOURCES) -- $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so - - transport_mdns_unsupported.cpp: - echo 'void init_mdns_transport_discovery(void) {}' > transport_mdns_unsupported.cpp --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch deleted file mode 100644 index 56c25eae34..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0003-socket.h-removing-dependency-of-gtest.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 4fdd086c2e9c85bc5a367a861696191e190cebc9 Mon Sep 17 00:00:00 2001 -From: Nisha Parrakat -Date: Thu, 2 Mar 2023 17:20:48 +0100 -Subject: [PATCH 03/15] socket.h: removing dependency of gtest - -Removed the dependency of gtest on the build of fastboot binary. -Fixes below error - -In file included from fastboot/fastboot.cpp:70: -| In file included from fastboot/tcp.h:36: -| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found -| #include -| ^~~~~~~~~~~~~~~~~~~~ -| 1 error generated. -| In file included from fastboot/socket.cpp:29: -| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found -| #include -| ^~~~~~~~~~~~~~~~~~~~ -| 1 error generated. -| In file included from fastboot/tcp.cpp:29: -| In file included from fastboot/tcp.h:36: -| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found -| #include -| ^~~~~~~~~~~~~~~~~~~~ -| 1 error generated. -| In file included from fastboot/udp.cpp:31: -| In file included from fastboot/udp.h:34: -| fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found -| #include -| ^~~~~~~~~~~~~~~~~~~~ -| 1 error generated. - -Signed-off-by: Nisha Parrakat ---- - fastboot/socket.h | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/fastboot/socket.h b/fastboot/socket.h -index e791f2c8..671fc115 100644 ---- a/fastboot/socket.h -+++ b/fastboot/socket.h -@@ -40,7 +40,6 @@ - - #include - #include --#include - - // Socket interface to be implemented for each platform. - class Socket { -@@ -119,8 +118,6 @@ class Socket { - socket_send_buffers_function_ = &socket_send_buffers; - - private: -- FRIEND_TEST(SocketTest, TestTcpSendBuffers); -- FRIEND_TEST(SocketTest, TestUdpSendBuffers); - - DISALLOW_COPY_AND_ASSIGN(Socket); - }; --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch deleted file mode 100644 index 367e31af22..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,63 +0,0 @@ -From e826f68c68e05b0f5cc3b3c10d7d9e4deb135114 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:14:15 +0100 -Subject: [PATCH 04/15] patching fastboot.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/fastboot.mk | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/debian/fastboot.mk b/debian/fastboot.mk -index d1aba626..e75fa87c 100644 ---- a/debian/fastboot.mk -+++ b/debian/fastboot.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = fastboot - fastboot_SOURCES = \ - bootimg_utils.cpp \ -@@ -38,11 +39,11 @@ CPPFLAGS += \ - -Ifs_mgr/liblp/include \ - -I/usr/include/android/openssl \ - -Ilibsparse/include \ -- -Ilibziparchive/include -+ -Ilibziparchive/include -I$(OUT_DIR)/usr/include/ - LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ - -fuse-ld=gold \ -- -Wl,-rpath-link=. \ -- -L. -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \ -+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \ - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ - -l7z \ - -@@ -53,7 +54,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) - endif - - build: $(SOURCES) -- $(CXX) $^ -o fastboot/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -+ mkdir --parents $(OUT_DIR)/usr/bin/ -+ $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) - - clean: -- $(RM) fastboot/$(NAME) -+ $(RM) $(OUT_DIR)/usr/bin/$(NAME) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch deleted file mode 100644 index d465ad6bfc..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch +++ /dev/null @@ -1,54 +0,0 @@ -From a4839f29e1286b0c53208a45b9c237d81021f829 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:15:47 +0100 -Subject: [PATCH 05/15] fastboot: don't use sparse_file_import_auto() in - load_buf_fd() - -upstream commit taken as below Original Issue link https://android-review.googlesource.com/c/platform/system/core/+/1123485 - -Commit taken below: - -fastboot: don't use sparse_file_import_auto() in load_buf_fd() - -load_buf_fd() attempts to find the size of the file that it is about -to load by first calling sparse_file_import_auto() then using -sparse_file_len() upon success or falling back to the file size on the -filesystem on failure. - -This is problematic however as sparse_file_import_auto() creates a -sparse_file out of the normal file, but does not resparse it, so an -assertion fails during the sparse_file_len() call. - -This is fixed by using sparse_file_import() instead. This will fail -in the case that the file is not sparse and the call to -sparse_file_len() will be properly skipped. - -Bug: 140538105 -Test: flash blueline factory image with assertions enabled in - libsparse/sparse.cpp - -Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c - -https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec -Upstream-Status: Backport [commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec] -Signed-off-by: Nisha Parrakat ---- - fastboot/fastboot.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp -index 3b7b5571..0ae9402e 100644 ---- a/fastboot/fastboot.cpp -+++ b/fastboot/fastboot.cpp -@@ -869,7 +869,7 @@ static bool load_buf_fd(int fd, struct fastboot_buffer* buf) { - return false; - } - -- if (sparse_file* s = sparse_file_import_auto(fd, false, false)) { -+ if (sparse_file* s = sparse_file_import(fd, false, false)) { - buf->image_size = sparse_file_len(s, false, false); - sparse_file_destroy(s); - } else { --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch deleted file mode 100644 index 6211f04637..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 22c7140dc170ecb26bde33fed4c9249b164f8d3c Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:19:08 +0100 -Subject: [PATCH 06/15] libbase.mk: modifications to make it build in yocto - environment - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat ---- - debian/libbase.mk | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/debian/libbase.mk b/debian/libbase.mk -index 80da48f3..e6c3e365 100644 ---- a/debian/libbase.mk -+++ b/debian/libbase.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = libbase - SOURCES = \ - chrono_utils.cpp \ -@@ -20,8 +21,9 @@ CPPFLAGS += -Iinclude -Ibase/include - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 - - build: $(SOURCES) -- $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r base/include/* $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(NAME).so* -+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch deleted file mode 100644 index af927264c5..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch +++ /dev/null @@ -1,51 +0,0 @@ -From cae154ec12a864ada8372b393fceb1d682c78c60 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 14:38:05 +0100 -Subject: [PATCH 07/15] libcrypto_utils.mk: modifications to make it build in - yocto environment - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary and header to the OUT_DIR - -Signed-off-by: Nisha Parrakat ---- - debian/libcrypto_utils.mk | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/debian/libcrypto_utils.mk b/debian/libcrypto_utils.mk -index 3afd4124..80c52f30 100644 ---- a/debian/libcrypto_utils.mk -+++ b/debian/libcrypto_utils.mk -@@ -1,15 +1,17 @@ -+include ../../rules_yocto.mk - NAME:= libcrypto_utils - SOURCES := android_pubkey.c - SOURCES := $(foreach source, $(SOURCES), libcrypto_utils/$(source)) --CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -+CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -I$(OUT_DIR)/usr/include - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -lcrypto -Wl,-z,defs -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -l:libcrypto.so.0 -Wl,-z,defs - - build: $(SOURCES) -- $(CC) $^ -o $(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r libcrypto_utils/include/* $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(NAME).so* -+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch deleted file mode 100644 index b87622922e..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4af9cc9e93e5cb09583c0fedeccae3fa195dbe7b Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:26:08 +0100 -Subject: [PATCH 08/15] libcutils: modifications to make it build in yocto - environment ---- - debian/libcutils.mk | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/debian/libcutils.mk b/debian/libcutils.mk -index 7cd18d87..bb45fb57 100644 ---- a/debian/libcutils.mk -+++ b/debian/libcutils.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = libcutils - - # copied from libcutils/Android.bp -@@ -50,14 +51,15 @@ CPPFLAGS += \ - -Iinclude \ - - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ -- -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -lpthread -L. -llog -lbase -+ -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -llog -lbase - - build: $(COBJECTS) $(CXXOBJECTS) -- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r libcutils/include/cutils $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so* -+ $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* - - $(COBJECTS): %.o: %.c - $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch deleted file mode 100644 index ad9b8dd552..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,53 +0,0 @@ -From bea40821d787ca31b38d5879fbf751be1dbea622 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:33:30 +0100 -Subject: [PATCH 09/15] patching img2simg.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/img2simg.mk | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/debian/img2simg.mk b/debian/img2simg.mk -index f1036cef..94772381 100644 ---- a/debian/img2simg.mk -+++ b/debian/img2simg.mk -@@ -1,13 +1,15 @@ -+include ../../rules_yocto.mk - NAME = img2simg - SOURCES = img2simg.cpp - SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) - CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 --LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -Wl,-rpath-link=. \ -- -L. -lsparse -+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lsparse - - build: $(SOURCES) -- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS) -+ mkdir --parents $(OUT_DIR)/usr/bin -+ $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS) - - clean: -- $(RM) libsparse/$(NAME) -+ $(RM) $(OUT_DIR)/usr/bin/$(NAME) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch deleted file mode 100644 index b7a72b8bd5..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 08441cf4334b911dba8c493dca3b1e2166c7d322 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:34:34 +0100 -Subject: [PATCH 10/15] patching simg2img.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/simg2img.mk | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/debian/simg2img.mk b/debian/simg2img.mk -index 07fb56b4..d319c87e 100644 ---- a/debian/simg2img.mk -+++ b/debian/simg2img.mk -@@ -1,13 +1,15 @@ -+include ../../rules_yocto.mk - NAME = simg2img - SOURCES = simg2img.cpp sparse_crc32.cpp - SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) - CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 --LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -Wl,-rpath-link=. \ -- -L. -lsparse -+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lsparse - - build: $(SOURCES) -- $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS) -+ mkdir --parents $(OUT_DIR)/usr/bin -+ $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS) - - clean: -- $(RM) libsparse/$(NAME) -+ $(RM) $(OUT_DIR)/usr/bin/$(NAME) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch deleted file mode 100644 index 7a37757bd8..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 99e46ec157e6fb912258ac6506896196e53d790b Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:35:44 +0100 -Subject: [PATCH 11/15] patching liblog.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/liblog.mk | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/debian/liblog.mk b/debian/liblog.mk -index eb1909b9..3b40d710 100644 ---- a/debian/liblog.mk -+++ b/debian/liblog.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = liblog - - # copied from liblog/Android.bp -@@ -39,11 +40,12 @@ CPPFLAGS += \ - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread - - build: $(COBJECTS) $(CXXOBJECTS) -- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r liblog/include/* $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(COBJECTS) $(CXXOBJECTS) $(NAME).so* -+ $(RM) $(COBJECTS) $(CXXOBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* - - $(COBJECTS): %.o: %.c - $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch deleted file mode 100644 index 029cc1c77e..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 65ddf7ea7daae721b2d331164155542820ed3e33 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:36:58 +0100 -Subject: [PATCH 12/15] patching libsparse.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/libsparse.mk | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/debian/libsparse.mk b/debian/libsparse.mk -index de280def..64caa45f 100644 ---- a/debian/libsparse.mk -+++ b/debian/libsparse.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = libsparse - SOURCES = \ - backed_block.cpp \ -@@ -18,16 +19,16 @@ LDFLAGS += \ - -shared -Wl,-soname,$(NAME).so.0 \ - -lz \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L. \ -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ - -lbase - - - build: $(COBJECTS) $(CXXOBJECTS) -- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so - - clean: -- $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so* -+ $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* - - $(COBJECTS): %.o: %.c - $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch deleted file mode 100644 index b49ec3b405..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch +++ /dev/null @@ -1,59 +0,0 @@ -From ae2bf1925fe02ea040005df27842c77c6d02b051 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:39:24 +0100 -Subject: [PATCH 13/15] patching libziparchive.mk to build in yocto - environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/libziparchive.mk | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/debian/libziparchive.mk b/debian/libziparchive.mk -index 803ea58e..6a697059 100644 ---- a/debian/libziparchive.mk -+++ b/debian/libziparchive.mk -@@ -1,3 +1,4 @@ -+include ../../rules_yocto.mk - NAME = libziparchive - SOURCES = zip_archive.cc \ - zip_archive_stream_entry.cc\ -@@ -5,14 +6,15 @@ SOURCES = zip_archive.cc \ - SOURCES := $(foreach source, $(SOURCES), libziparchive/$(source)) - CXXFLAGS += -std=gnu++17 - CPPFLAGS += -DZLIB_CONST -D_FILE_OFFSET_BITS=64 \ -- -Iinclude -Ibase/include -Ilibziparchive/include -+ -Iinclude -Ibase/include -Ilibziparchive/include -I$(OUT_DIR)/usr/include/ - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -lz -L. -llog -lbase -+ -lz -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -llog -lbase - - build: $(SOURCES) -- $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r libziparchive/include/* $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(NAME).so* -+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch deleted file mode 100644 index 433caf2481..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch +++ /dev/null @@ -1,69 +0,0 @@ -From a99b74f25c7f786e26b5400218090d86596d4541 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:40:32 +0100 -Subject: [PATCH 14/15] patching libbacktrace.mk to build in yocto environment. - -Changes include: -Introduced an output folder which will keep all the outputs from the -android-tools. - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary to the OUT_DIR - -Signed-off-by: Nisha Parrakat - -Upstream-Status: Pending ---- - debian/libbacktrace.mk | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/debian/libbacktrace.mk b/debian/libbacktrace.mk -index 330d211c..229b39d9 100644 ---- a/debian/libbacktrace.mk -+++ b/debian/libbacktrace.mk -@@ -1,5 +1,5 @@ - --include /usr/share/dpkg/architecture.mk -+include ../../rules_yocto.mk - - NAME = libbacktrace - -@@ -88,11 +88,11 @@ CPPFLAGS += \ - -Ilibprocinfo/include \ - -Ilibunwindstack/include \ - -I/usr/include/android/lzma \ -- -I/usr/include/android/unwind -+ -I$(OUT_DIR)/usr/include/android/libunwind - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android -lunwind \ -- -L. -lbase -llog -lpthread -l7z -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lunwind \ -+ -lbase -llog -lpthread -l7z - - # -latomic should be the last library specified - # https://github.com/android/ndk/issues/589 -@@ -104,11 +104,11 @@ ifeq ($(DEB_HOST_ARCH), mipsel) - endif - - build: $(COBJECTS) $(CXXOBJECTS) $(OBJECTS_ASSEMBLY) -- $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) -+ ln -sf $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(NAME).so - - clean: -- $(RM) $(COBJECTS) $(CXXOBJECTS) $(NAME).so* -+ $(RM) $(COBJECTS) $(CXXOBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* - - $(CXXOBJECTS): %.o: %.cpp - $(CXX) $< -o $@ $(CXXFLAGS) $(CPPFLAGS) --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch deleted file mode 100644 index d8fee6655e..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0015-Use-namespace-std-to-compile-libbacktrace.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 19a16829ef7b7ffd6466b9b90585d667a1663969 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Fri, 3 Mar 2023 13:43:50 +0100 -Subject: [PATCH 15/15] Use namespace std to compile libbacktrace - -To Fix the below error - - In file included from libunwindstack/DwarfSection.cpp:21: -| libunwindstack/include/unwindstack/DwarfMemory.h:32:29: error: unknown type name 'size_t'; did you mean 'std::size_t'? -| bool ReadBytes(void* dst, size_t num_bytes); -| ^~~~~~ -| std::size_t ---- - libunwindstack/include/unwindstack/DwarfMemory.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libunwindstack/include/unwindstack/DwarfMemory.h b/libunwindstack/include/unwindstack/DwarfMemory.h -index 244c0e12..0a3fefeb 100644 ---- a/libunwindstack/include/unwindstack/DwarfMemory.h -+++ b/libunwindstack/include/unwindstack/DwarfMemory.h -@@ -23,7 +23,7 @@ namespace unwindstack { - - // Forward declarations. - class Memory; -- -+using namespace std; - class DwarfMemory { - public: - DwarfMemory(Memory* memory) : memory_(memory) {} --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch deleted file mode 100644 index ce6bc87aa7..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0016-Adapt-adbd-to-work-with-yocto.patch +++ /dev/null @@ -1,170 +0,0 @@ -From fbbcb1a9359b5bf0c09bcf56b149594473f91e3a Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Wed, 8 Mar 2023 15:21:49 +0100 -Subject: [PATCH] Adapt adbd to work with yocto - -- remove TMPDIR which is used by commands like mktemp (set to /data/local/tmp in android - but vanilla linux uses /tmp per default) -- define PS1 which was missing -- remove android header-files and make adbd compile with yocto - -Co-authored-by: JJ Robertson -Co-authored-by: Wejdene Smida -Signed-off-by: Etienne Cordonnier - ---- - adb/daemon/file_sync_service.cpp | 4 ++-- - adb/daemon/main.cpp | 4 ++-- - adb/daemon/reboot_service.cpp | 5 ++++- - adb/daemon/set_verity_enable_state_service.cpp | 6 +++++- - adb/daemon/shell_service.cpp | 5 ++++- - adb/types.h | 1 + - 6 files changed, 18 insertions(+), 7 deletions(-) - -diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp -index e82a51f2..ba112cbe 100644 ---- a/adb/daemon/file_sync_service.cpp -+++ b/adb/daemon/file_sync_service.cpp -@@ -111,7 +111,7 @@ static bool secure_mkdirs(const std::string& path) { - partial_path += path_component; - - if (should_use_fs_config(partial_path)) { -- fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); -+ // fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); - } - if (adb_mkdir(partial_path.c_str(), mode) == -1) { - if (errno != EEXIST) { -@@ -434,7 +434,7 @@ static bool do_send(int s, const std::string& spec, std::vector& buffer) { - uint64_t capabilities = 0; - if (should_use_fs_config(path)) { - unsigned int broken_api_hack = mode; -- fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); -+ // fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); - mode = broken_api_hack; - } - -diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp -index e5a49171..c75263c4 100644 ---- a/adb/daemon/main.cpp -+++ b/adb/daemon/main.cpp -@@ -191,6 +191,8 @@ int adbd_main(int server_port) { - umask(0); - - signal(SIGPIPE, SIG_IGN); -+ signal(SIGINT, SIG_DFL); -+ signal(SIGQUIT, SIG_DFL); - - #if defined(__BIONIC__) - auto fdsan_level = android_fdsan_get_error_level(); -@@ -232,13 +234,11 @@ int adbd_main(int server_port) { - - bool is_usb = false; - --#if defined(__ANDROID__) - if (access(USB_FFS_ADB_EP0, F_OK) == 0) { - // Listen on USB. - usb_init(); - is_usb = true; - } --#endif - - // If one of these properties is set, also listen on that port. - // If one of the properties isn't set and we couldn't listen on usb, listen -diff --git a/adb/daemon/reboot_service.cpp b/adb/daemon/reboot_service.cpp -index a5a11b86..6bd069d4 100644 ---- a/adb/daemon/reboot_service.cpp -+++ b/adb/daemon/reboot_service.cpp -@@ -28,7 +28,9 @@ - #include - #include - #include --#include -+// #include -+#include -+#include - #include - - #include "adb_io.h" -@@ -76,6 +78,7 @@ void reboot_service(unique_fd fd, const std::string& arg) { - return; - } - } -+ syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_arg.c_str()); - // Don't return early. Give the reboot command time to take effect - // to avoid messing up scripts which do "adb reboot && adb wait-for-device" - while (true) { -diff --git a/adb/daemon/set_verity_enable_state_service.cpp b/adb/daemon/set_verity_enable_state_service.cpp -index 889229fe..51e9be93 100644 ---- a/adb/daemon/set_verity_enable_state_service.cpp -+++ b/adb/daemon/set_verity_enable_state_service.cpp -@@ -22,7 +22,7 @@ - #include - #include - #include --#include -+// #include - #include - #include - #include -@@ -65,6 +65,7 @@ static bool make_block_device_writable(const std::string& dev) { - /* Turn verity on/off */ - static bool set_verity_enabled_state(int fd, const char* block_device, const char* mount_point, - bool enable) { -+#if defined(__ANDROID__) - if (!make_block_device_writable(block_device)) { - WriteFdFmt(fd, "Could not make block device %s writable (%s).\n", - block_device, strerror(errno)); -@@ -115,6 +116,7 @@ static bool set_verity_enabled_state(int fd, const char* block_device, const cha - mount_point, strerror(errno)); - } - WriteFdFmt(fd, "Verity %s on %s\n", enable ? "enabled" : "disabled", mount_point); -+#endif - return true; - } - -@@ -126,6 +128,7 @@ static std::string get_ab_suffix() { - return android::base::GetProperty("ro.boot.slot_suffix", ""); - } - -+#if defined(__ANDROID__) - static bool is_avb_device_locked() { - return android::base::GetProperty("ro.boot.vbmeta.device_state", "") == "locked"; - } -@@ -245,3 +248,4 @@ void set_verity_enabled_state_service(unique_fd fd, bool enable) { - WriteFdExactly(fd.get(), "Now reboot your device for settings to take effect\n"); - } - } -+#endif -diff --git a/adb/daemon/shell_service.cpp b/adb/daemon/shell_service.cpp -index 3c8f3939..355c1a1c 100644 ---- a/adb/daemon/shell_service.cpp -+++ b/adb/daemon/shell_service.cpp -@@ -261,9 +261,12 @@ bool Subprocess::ForkAndExec(std::string* error) { - env["HOSTNAME"] = GetHostName(); - env["LOGNAME"] = pw->pw_name; - env["SHELL"] = pw->pw_shell; -- env["TMPDIR"] = "/data/local/tmp"; - env["USER"] = pw->pw_name; - } -+ if (env.find("PS1") == env.end()) { -+ env["PS1"] = "\\h:\\w\\$ "; -+ } -+ - - if (!terminal_type_.empty()) { - env["TERM"] = terminal_type_; -diff --git a/adb/types.h b/adb/types.h -index 6af4a150..9efe223b 100644 ---- a/adb/types.h -+++ b/adb/types.h -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0017-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0017-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch deleted file mode 100644 index 7209e626b7..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0017-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 0dac14385d9c79089f8026e2764b75fa111adb8a Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Tue, 14 Mar 2023 11:33:50 +0100 -Subject: [PATCH] Update usage of usbdevfs_urb to match new kernel UAPI -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Linux kernel API has been changed by commit 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members") -where zero-length array iso_frame_desc in struct usbdevfs_urb was replaced with a proper flexible-array member. - -Current USB API usage causes a compilation error at Linux 6.0: - -In file included from /home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:28: -/usr/include/linux/usbdevice_fs.h:134:41: error: flexible array member ‘usbdevfs_urb::iso_frame_desc’ not at end of ‘struct usb_handle’ - 134 | struct usbdevfs_iso_packet_desc iso_frame_desc[]; - | ^~~~~~~~~~~~~~ -/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:76:18: note: next member ‘usbdevfs_urb usb_handle::urb_out’ declared here - 76 | usbdevfs_urb urb_out; - | ^~~~~~~ -/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:61:8: note: in the definition of ‘struct usb_handle’ - 61 | struct usb_handle { - | ^~~~~~~~~~ - -Fix it by using pointers to a struct with flexible-array members. -Current fix works both with the old and the new API. - -See https://github.com/nmeum/android-tools/issues/74 for more context. - -Tested: built on Linux against kernel 5.19 and 6.0; 'adb shell' over USB -cable -Acked-by: Gustavo A. R. Silva gustavoars@kernel.org -Change-Id: I7f0f7b35d9a3ab980d3520b541b60c7857a6b101 -Signed-off-by: Anatol Pomozov - -[Backported on version 10] -Signed-off-by: Etienne Cordonnier ---- - adb/client/usb_linux.cpp | 24 ++++++++++++++---------- - 1 file changed, 14 insertions(+), 10 deletions(-) - -diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp -index 81b83064..7d55ec5b 100644 ---- a/adb/client/usb_linux.cpp -+++ b/adb/client/usb_linux.cpp -@@ -71,8 +71,8 @@ struct usb_handle : public ::usb_handle { - unsigned zero_mask; - unsigned writeable = 1; - -- usbdevfs_urb urb_in; -- usbdevfs_urb urb_out; -+ usbdevfs_urb *urb_in; -+ usbdevfs_urb *urb_out; - - bool urb_in_busy = false; - bool urb_out_busy = false; -@@ -305,7 +305,7 @@ static int usb_bulk_write(usb_handle* h, const void* data, int len) { - std::unique_lock lock(h->mutex); - D("++ usb_bulk_write ++"); - -- usbdevfs_urb* urb = &h->urb_out; -+ usbdevfs_urb* urb = h->urb_out; - memset(urb, 0, sizeof(*urb)); - urb->type = USBDEVFS_URB_TYPE_BULK; - urb->endpoint = h->ep_out; -@@ -344,7 +344,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { - std::unique_lock lock(h->mutex); - D("++ usb_bulk_read ++"); - -- usbdevfs_urb* urb = &h->urb_in; -+ usbdevfs_urb* urb = h->urb_in; - memset(urb, 0, sizeof(*urb)); - urb->type = USBDEVFS_URB_TYPE_BULK; - urb->endpoint = h->ep_in; -@@ -389,7 +389,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { - } - D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length); - -- if (out == &h->urb_in) { -+ if (out == h->urb_in) { - D("[ reap urb - IN complete ]"); - h->urb_in_busy = false; - if (urb->status != 0) { -@@ -398,7 +398,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { - } - return urb->actual_length; - } -- if (out == &h->urb_out) { -+ if (out == h->urb_out) { - D("[ reap urb - OUT compelete ]"); - h->urb_out_busy = false; - h->cv.notify_all(); -@@ -483,10 +483,10 @@ void usb_kick(usb_handle* h) { - ** but this ensures that a reader blocked on REAPURB - ** will get unblocked - */ -- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in); -- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out); -- h->urb_in.status = -ENODEV; -- h->urb_out.status = -ENODEV; -+ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_in); -+ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_out); -+ h->urb_in->status = -ENODEV; -+ h->urb_out->status = -ENODEV; - h->urb_in_busy = false; - h->urb_out_busy = false; - h->cv.notify_all(); -@@ -502,6 +502,8 @@ int usb_close(usb_handle* h) { - - D("-- usb close %p (fd = %d) --", h, h->fd); - -+ delete h->urb_in; -+ delete h->urb_out; - delete h; - - return 0; -@@ -537,6 +539,8 @@ static void register_device(const char* dev_name, const char* dev_path, unsigned - usb->ep_out = ep_out; - usb->zero_mask = zero_mask; - usb->max_packet_size = max_packet_size; -+ usb->urb_in = new usbdevfs_urb; -+ usb->urb_out = new usbdevfs_urb; - - // Initialize mark so we don't get garbage collected after the device scan. - usb->mark = true; --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0018-img2simg-Fix-wrong-rpath.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0018-img2simg-Fix-wrong-rpath.patch deleted file mode 100644 index 5f28263022..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0018-img2simg-Fix-wrong-rpath.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 25bd3456dcd539b89648273152e405314287f4f8 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Mon, 13 Mar 2023 13:46:14 +0100 -Subject: [PATCH 2/2] img2simg: Fix wrong rpath and re-add libbase - -Signed-off-by: Etienne Cordonnier ---- - debian/img2simg.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/debian/img2simg.mk b/debian/img2simg.mk -index d1b9b927..459af454 100644 ---- a/debian/img2simg.mk -+++ b/debian/img2simg.mk -@@ -3,7 +3,7 @@ NAME = img2simg - SOURCES = img2simg.cpp - SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) - CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 --LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib/android' -lbase \ - -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ - -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lsparse - --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0019-Fix-compilation-with-gcc.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0019-Fix-compilation-with-gcc.patch deleted file mode 100644 index 033c5fb919..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0019-Fix-compilation-with-gcc.patch +++ /dev/null @@ -1,157 +0,0 @@ -From d198ecb4c36b645e5428aa5117f7673bf2f7a3e6 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Tue, 14 Mar 2023 11:42:08 +0100 -Subject: [PATCH] Fix compilation with gcc - -Signed-off-by: Etienne Cordonnier ---- - adb/adb_listeners.cpp | 18 ++++++++++++------ - adb/daemon/auth.cpp | 3 ++- - adb/daemon/usb.cpp | 3 ++- - adb/fdevent.cpp | 3 ++- - adb/transport_fd.cpp | 3 ++- - adb/transport_local.cpp | 3 ++- - 6 files changed, 22 insertions(+), 11 deletions(-) - -diff --git a/adb/adb_listeners.cpp b/adb/adb_listeners.cpp -index 29909a55..fbdf4487 100644 ---- a/adb/adb_listeners.cpp -+++ b/adb/adb_listeners.cpp -@@ -109,7 +109,8 @@ static void listener_event_func(int _fd, unsigned ev, void* _l) - } - - // Called as a transport disconnect function. |arg| is the raw alistener*. --static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_mutex) { -+ EXCLUDES(listener_list_mutex) -+static void listener_disconnect(void* arg, atransport*) { - std::lock_guard lock(listener_list_mutex); - for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { - if (iter->get() == arg) { -@@ -121,7 +122,8 @@ static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_m - } - - // Write the list of current listeners (network redirections) into a string. --std::string format_listeners() EXCLUDES(listener_list_mutex) { -+EXCLUDES(listener_list_mutex) -+std::string format_listeners() { - std::lock_guard lock(listener_list_mutex); - std::string result; - for (auto& l : listener_list) { -@@ -139,8 +141,9 @@ std::string format_listeners() EXCLUDES(listener_list_mutex) { - return result; - } - -+EXCLUDES(listener_list_mutex) - InstallStatus remove_listener(const char* local_name, atransport* transport) -- EXCLUDES(listener_list_mutex) { -+{ - std::lock_guard lock(listener_list_mutex); - for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { - if (local_name == (*iter)->local_name) { -@@ -151,7 +154,8 @@ InstallStatus remove_listener(const char* local_name, atransport* transport) - return INSTALL_STATUS_LISTENER_NOT_FOUND; - } - --void remove_all_listeners() EXCLUDES(listener_list_mutex) { -+EXCLUDES(listener_list_mutex) -+void remove_all_listeners() { - std::lock_guard lock(listener_list_mutex); - auto iter = listener_list.begin(); - while (iter != listener_list.end()) { -@@ -164,7 +168,8 @@ void remove_all_listeners() EXCLUDES(listener_list_mutex) { - } - } - --void close_smartsockets() EXCLUDES(listener_list_mutex) { -+EXCLUDES(listener_list_mutex) -+void close_smartsockets() { - std::lock_guard lock(listener_list_mutex); - auto pred = [](const std::unique_ptr& listener) { - return listener->local_name == "*smartsocket*"; -@@ -172,9 +177,10 @@ void close_smartsockets() EXCLUDES(listener_list_mutex) { - listener_list.remove_if(pred); - } - -+EXCLUDES(listener_list_mutex) - InstallStatus install_listener(const std::string& local_name, const char* connect_to, - atransport* transport, int no_rebind, int* resolved_tcp_port, -- std::string* error) EXCLUDES(listener_list_mutex) { -+ std::string* error) { - std::lock_guard lock(listener_list_mutex); - for (auto& l : listener_list) { - if (local_name == l->local_name) { -diff --git a/adb/daemon/auth.cpp b/adb/daemon/auth.cpp -index a18afa4e..0fd60a1f 100644 ---- a/adb/daemon/auth.cpp -+++ b/adb/daemon/auth.cpp -@@ -98,8 +98,9 @@ bool adbd_auth_verify(const char* token, size_t token_size, const std::string& s - return false; - } - -+REQUIRES(framework_mutex) - static bool adbd_send_key_message_locked(std::string_view msg_type, std::string_view key) -- REQUIRES(framework_mutex) { -+{ - if (framework_fd < 0) { - LOG(ERROR) << "Client not connected to send msg_type " << msg_type; - return false; -diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp -index 1abae87c..3a466782 100644 ---- a/adb/daemon/usb.cpp -+++ b/adb/daemon/usb.cpp -@@ -628,7 +628,8 @@ struct UsbFfsConnection : public Connection { - return CreateWriteBlock(std::move(block), 0, len, id); - } - -- void SubmitWrites() REQUIRES(write_mutex_) { -+ REQUIRES(write_mutex_) -+ void SubmitWrites() { - if (writes_submitted_ == kUsbWriteQueueDepth) { - return; - } -diff --git a/adb/fdevent.cpp b/adb/fdevent.cpp -index 32f90863..bff24544 100644 ---- a/adb/fdevent.cpp -+++ b/adb/fdevent.cpp -@@ -376,7 +376,8 @@ static void fdevent_call_fdfunc(fdevent* fde) { - fde->func); - } - --static void fdevent_run_flush() EXCLUDES(run_queue_mutex) { -+EXCLUDES(run_queue_mutex) -+static void fdevent_run_flush() { - // We need to be careful around reentrancy here, since a function we call can queue up another - // function. - while (true) { -diff --git a/adb/transport_fd.cpp b/adb/transport_fd.cpp -index a93e68a0..c5af09ff 100644 ---- a/adb/transport_fd.cpp -+++ b/adb/transport_fd.cpp -@@ -168,7 +168,8 @@ struct NonblockingFdConnection : public Connection { - TryAgain, - }; - -- WriteResult DispatchWrites() REQUIRES(write_mutex_) { -+ REQUIRES(write_mutex_) -+ WriteResult DispatchWrites() { - CHECK(!write_buffer_.empty()); - auto iovs = write_buffer_.iovecs(); - ssize_t rc = adb_writev(fd_.get(), iovs.data(), iovs.size()); -diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp -index b9f738df..a273e8f7 100644 ---- a/adb/transport_local.cpp -+++ b/adb/transport_local.cpp -@@ -345,8 +345,9 @@ struct EmulatorConnection : public FdConnection { - }; - - /* Only call this function if you already hold local_transports_lock. */ -+REQUIRES(local_transports_lock) - static atransport* find_emulator_transport_by_adb_port_locked(int adb_port) -- REQUIRES(local_transports_lock) { -+{ - auto it = local_transports.find(adb_port); - if (it == local_transports.end()) { - return nullptr; --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0020-adb-Fix-build-on-big-endian-systems.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0020-adb-Fix-build-on-big-endian-systems.patch deleted file mode 100644 index a2c490bfe4..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0020-adb-Fix-build-on-big-endian-systems.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f9fe8163cd759c21dd5ec0711b56dccd79ff1c4a Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Tue, 14 Mar 2023 13:39:23 +0100 -Subject: [PATCH] adb: Fix build on big endian systems - -The usb_linux_client.c file defines cpu_to_le16/32 by using the C -library htole16/32 function calls. However, cpu_to_le16/32 are used -when initializing structures, i.e in a context where a function call -is not allowed. - -It works fine on little endian systems because htole16/32 are defined -by the C library as no-ops. But on big-endian systems, they are -actually doing something, which might involve calling a function, -causing build failures. - -To solve this, we simply open-code cpu_to_le16/32 in a way that allows -them to be used when initializing structures. - -Signed-off-by: Thomas Petazzoni -[Forward-ported to version 10] -Signed-off-by: Etienne Cordonnier ---- - adb/daemon/usb_ffs.cpp | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/adb/daemon/usb_ffs.cpp b/adb/daemon/usb_ffs.cpp -index 07b4ba89..25f30352 100644 ---- a/adb/daemon/usb_ffs.cpp -+++ b/adb/daemon/usb_ffs.cpp -@@ -37,8 +37,15 @@ - // Number of buffers needed to fit MAX_PAYLOAD, with an extra for ZLPs. - #define USB_FFS_NUM_BUFS ((4 * MAX_PAYLOAD / USB_FFS_BULK_SIZE) + 1) - --#define cpu_to_le16(x) htole16(x) --#define cpu_to_le32(x) htole32(x) -+#if __BYTE_ORDER == __LITTLE_ENDIAN -+# define cpu_to_le16(x) (x) -+# define cpu_to_le32(x) (x) -+#else -+# define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) -+# define cpu_to_le32(x) \ -+ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ -+ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) -+#endif - - struct func_desc { - struct usb_interface_descriptor intf; --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0021-adb-Allow-adbd-to-be-run-as-root.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0021-adb-Allow-adbd-to-be-run-as-root.patch deleted file mode 100644 index dbb12849c7..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/core/0021-adb-Allow-adbd-to-be-run-as-root.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0bc94c83b9d846416613f9c8831cae6caf1713e5 Mon Sep 17 00:00:00 2001 -From: Etienne Cordonnier -Date: Tue, 14 Mar 2023 13:53:51 +0100 -Subject: [PATCH] adb: Allow adbd to be run as root - -Signed-off-by: Etienne Cordonnier ---- - adb/daemon/main.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp -index c75263c4..d27f6996 100644 ---- a/adb/daemon/main.cpp -+++ b/adb/daemon/main.cpp -@@ -72,6 +72,7 @@ static bool should_drop_capabilities_bounding_set() { - } - - static bool should_drop_privileges() { -+ return true; - // "adb root" not allowed, always drop privileges. - if (!ALLOW_ADBD_ROOT && !is_device_unlocked()) return true; - --- -2.36.1.vfs.0.0 - diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Add-riscv64-support.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Add-riscv64-support.patch new file mode 100644 index 0000000000..4669f89d07 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Add-riscv64-support.patch @@ -0,0 +1,651 @@ +From: Guo Ren +Date: Wed, 29 Jun 2022 16:46:46 +0800 +Subject: Add riscv64 support + +This patch contains the dwarf unwind support for 64bit risc-v. + + * DwarfCfa.cpp (cfa_def_cfa_register): setup register if CFA_REG is + not setup for riscv64 + * Elf.cpp (GetRelPc): convert offset to virtual address for riscv64. + * ElfInterface.cpp (GetVirtAddrFromOffset): New for riscv64. + * RegsRiscv64.cpp (StepIfSignalHandler): Fix signal frame check. + libunwindstack/include/unwindstack/ + * ElfInterface.h (GetVirtAddrFromOffset): New for riscv64. + libunwindstack/tests/ + * DwarfCfaTest.cpp (cfa_def_cfa_register): ok for riscv64. + * RegsStepIfSignalHandlerTest.cpp (riscv64_step_if_signal_handler): Fix + testcase for riscv64 + +Test: Builds. +Test: All unit tests pass. + +Signed-off-by: Guo Ren +Signed-off-by: Lifang Xia +Signed-off-by: Mao Han +Change-Id: Ib21ddf23cc83f332af202df7bffcaceec16063e0 +--- + system/core/libunwindstack/Android.bp | 1 + + system/core/libunwindstack/Elf.cpp | 2 + + system/core/libunwindstack/Regs.cpp | 10 ++ + system/core/libunwindstack/RegsRiscv64.cpp | 156 +++++++++++++++++++++ + .../core/libunwindstack/include/unwindstack/Elf.h | 5 + + .../include/unwindstack/MachineRiscv64.h | 59 ++++++++ + .../include/unwindstack/RegsGetLocal.h | 43 ++++++ + .../include/unwindstack/RegsRiscv64.h | 59 ++++++++ + .../include/unwindstack/UcontextRiscv64.h | 80 +++++++++++ + .../include/unwindstack/UserRiscv64.h | 37 +++++ + system/core/libunwindstack/tools/unwind.cpp | 3 + + .../core/libunwindstack/tools/unwind_symbols.cpp | 3 + + 12 files changed, 458 insertions(+) + create mode 100644 system/core/libunwindstack/RegsRiscv64.cpp + create mode 100644 system/core/libunwindstack/include/unwindstack/MachineRiscv64.h + create mode 100644 system/core/libunwindstack/include/unwindstack/RegsRiscv64.h + create mode 100644 system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h + create mode 100644 system/core/libunwindstack/include/unwindstack/UserRiscv64.h + +diff --git a/system/core/libunwindstack/Android.bp b/system/core/libunwindstack/Android.bp +index 3695f72..f1f9c68 100644 +--- a/system/core/libunwindstack/Android.bp ++++ b/system/core/libunwindstack/Android.bp +@@ -70,6 +70,7 @@ cc_library { + "RegsArm64.cpp", + "RegsX86.cpp", + "RegsX86_64.cpp", ++ "RegsRiscv64.cpp", + "RegsMips.cpp", + "RegsMips64.cpp", + "Unwinder.cpp", +diff --git a/system/core/libunwindstack/Elf.cpp b/system/core/libunwindstack/Elf.cpp +index f01b092..3c2088b 100644 +--- a/system/core/libunwindstack/Elf.cpp ++++ b/system/core/libunwindstack/Elf.cpp +@@ -290,6 +290,8 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { + arch_ = ARCH_X86_64; + } else if (e_machine == EM_MIPS) { + arch_ = ARCH_MIPS64; ++ } else if (e_machine == EM_RISCV) { ++ arch_ = ARCH_RISCV64; + } else { + // Unsupported. + ALOGI("64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = %d\n", +diff --git a/system/core/libunwindstack/Regs.cpp b/system/core/libunwindstack/Regs.cpp +index c7dec52..447a554 100644 +--- a/system/core/libunwindstack/Regs.cpp ++++ b/system/core/libunwindstack/Regs.cpp +@@ -27,12 +27,14 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + +@@ -67,6 +69,8 @@ Regs* Regs::RemoteGet(pid_t pid) { + return RegsMips::Read(buffer.data()); + case sizeof(mips64_user_regs): + return RegsMips64::Read(buffer.data()); ++ case sizeof(riscv64_user_regs): ++ return RegsRiscv64::Read(buffer.data()); + } + return nullptr; + } +@@ -85,6 +89,8 @@ Regs* Regs::CreateFromUcontext(ArchEnum arch, void* ucontext) { + return RegsMips::CreateFromUcontext(ucontext); + case ARCH_MIPS64: + return RegsMips64::CreateFromUcontext(ucontext); ++ case ARCH_RISCV64: ++ return RegsRiscv64::CreateFromUcontext(ucontext); + case ARCH_UNKNOWN: + default: + return nullptr; +@@ -104,6 +110,8 @@ ArchEnum Regs::CurrentArch() { + return ARCH_MIPS; + #elif defined(__mips__) && defined(__LP64__) + return ARCH_MIPS64; ++#elif defined(__riscv) ++ return ARCH_RISCV64; + #else + abort(); + #endif +@@ -123,6 +131,8 @@ Regs* Regs::CreateFromLocal() { + regs = new RegsMips(); + #elif defined(__mips__) && defined(__LP64__) + regs = new RegsMips64(); ++#elif defined(__riscv) ++ regs = new RegsRiscv64(); + #else + abort(); + #endif +diff --git a/system/core/libunwindstack/RegsRiscv64.cpp b/system/core/libunwindstack/RegsRiscv64.cpp +new file mode 100644 +index 0000000..887762a +--- /dev/null ++++ b/system/core/libunwindstack/RegsRiscv64.cpp +@@ -0,0 +1,156 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace unwindstack { ++ ++RegsRiscv64::RegsRiscv64() ++ : RegsImpl(RISCV64_REG_MAX, Location(LOCATION_REGISTER, RISCV64_REG_RA)) {} ++ ++ArchEnum RegsRiscv64::Arch() { ++ return ARCH_RISCV64; ++} ++ ++uint64_t RegsRiscv64::pc() { ++ return regs_[RISCV64_REG_PC]; ++} ++ ++uint64_t RegsRiscv64::sp() { ++ return regs_[RISCV64_REG_SP]; ++} ++ ++void RegsRiscv64::set_pc(uint64_t pc) { ++ regs_[RISCV64_REG_PC] = pc; ++} ++ ++void RegsRiscv64::set_sp(uint64_t sp) { ++ regs_[RISCV64_REG_SP] = sp; ++} ++ ++uint64_t RegsRiscv64::GetPcAdjustment(uint64_t rel_pc, Elf*) { ++ if (rel_pc < 8) { ++ return 0; ++ } ++ // For now, just assume no compact branches ++ return 8; ++} ++ ++bool RegsRiscv64::SetPcFromReturnAddress(Memory*) { ++ uint64_t ra = regs_[RISCV64_REG_RA]; ++ if (regs_[RISCV64_REG_PC] == ra) { ++ return false; ++ } ++ ++ regs_[RISCV64_REG_PC] = ra; ++ return true; ++} ++ ++void RegsRiscv64::IterateRegisters(std::function fn) { ++ fn("pc", regs_[RISCV64_REG_PC]); ++ fn("ra", regs_[RISCV64_REG_RA]); ++ fn("sp", regs_[RISCV64_REG_SP]); ++ fn("gp", regs_[RISCV64_REG_GP]); ++ fn("tp", regs_[RISCV64_REG_TP]); ++ fn("t0", regs_[RISCV64_REG_T0]); ++ fn("t1", regs_[RISCV64_REG_T1]); ++ fn("t2", regs_[RISCV64_REG_T2]); ++ fn("t3", regs_[RISCV64_REG_T3]); ++ fn("t4", regs_[RISCV64_REG_T4]); ++ fn("t5", regs_[RISCV64_REG_T5]); ++ fn("t6", regs_[RISCV64_REG_T6]); ++ fn("s0", regs_[RISCV64_REG_S0]); ++ fn("s1", regs_[RISCV64_REG_S1]); ++ fn("s2", regs_[RISCV64_REG_S2]); ++ fn("s3", regs_[RISCV64_REG_S3]); ++ fn("s4", regs_[RISCV64_REG_S4]); ++ fn("s5", regs_[RISCV64_REG_S5]); ++ fn("s6", regs_[RISCV64_REG_S6]); ++ fn("s7", regs_[RISCV64_REG_S7]); ++ fn("s8", regs_[RISCV64_REG_S8]); ++ fn("s9", regs_[RISCV64_REG_S9]); ++ fn("s10", regs_[RISCV64_REG_S10]); ++ fn("s11", regs_[RISCV64_REG_S11]); ++ fn("a0", regs_[RISCV64_REG_A0]); ++ fn("a1", regs_[RISCV64_REG_A1]); ++ fn("a2", regs_[RISCV64_REG_A2]); ++ fn("a3", regs_[RISCV64_REG_A3]); ++ fn("a4", regs_[RISCV64_REG_A4]); ++ fn("a5", regs_[RISCV64_REG_A5]); ++ fn("a6", regs_[RISCV64_REG_A6]); ++ fn("a7", regs_[RISCV64_REG_A7]); ++} ++ ++Regs* RegsRiscv64::Read(void* remote_data) { ++ riscv64_user_regs* user = reinterpret_cast(remote_data); ++ ++ RegsRiscv64* regs = new RegsRiscv64(); ++ memcpy(regs->RawData(), &user->regs[0], RISCV64_REG_MAX * sizeof(uint64_t)); ++ // uint64_t* reg_data = reinterpret_cast(regs->RawData()); ++ return regs; ++} ++ ++Regs* RegsRiscv64::CreateFromUcontext(void* ucontext) { ++ riscv64_ucontext_t* riscv64_ucontext = reinterpret_cast(ucontext); ++ ++ RegsRiscv64* regs = new RegsRiscv64(); ++ memcpy(regs->RawData(), &riscv64_ucontext->uc_mcontext.__gregs[0], ++ RISCV64_REG_MAX * sizeof(uint64_t)); ++ return regs; ++} ++ ++bool RegsRiscv64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) { ++ uint64_t data; ++ Memory* elf_memory = elf->memory(); ++ // Read from elf memory since it is usually more expensive to read from ++ // process memory. ++ if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) { ++ return false; ++ } ++ // Look for the kernel sigreturn function. ++ // __kernel_rt_sigreturn: ++ // li a7, __NR_rt_sigreturn ++ // scall ++ ++ const uint8_t li_scall[] = {0x93, 0x08, 0xb0, 0x08, 0x73, 0x00, 0x00, 0x00}; ++ if (memcmp(&data, &li_scall, 8) != 0) { ++ return false; ++ } ++ ++ // SP + sizeof(siginfo_t) + uc_mcontext offset + PC offset. ++ if (!process_memory->ReadFully(regs_[RISCV64_REG_SP] + 0x80 + 0xb0 + 0x00, regs_.data(), ++ sizeof(uint64_t) * (RISCV64_REG_MAX))) { ++ return false; ++ } ++ return true; ++} ++ ++Regs* RegsRiscv64::Clone() { ++ return new RegsRiscv64(*this); ++} ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/include/unwindstack/Elf.h b/system/core/libunwindstack/include/unwindstack/Elf.h +index 472ed92..88fa0ff 100644 +--- a/system/core/libunwindstack/include/unwindstack/Elf.h ++++ b/system/core/libunwindstack/include/unwindstack/Elf.h +@@ -32,6 +32,10 @@ + #define EM_AARCH64 183 + #endif + ++#if !defined(EM_RISCV) ++#define EM_RISCV 243 ++#endif ++ + namespace unwindstack { + + // Forward declaration. +@@ -46,6 +50,7 @@ enum ArchEnum : uint8_t { + ARCH_X86_64, + ARCH_MIPS, + ARCH_MIPS64, ++ ARCH_RISCV64, + }; + + class Elf { +diff --git a/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h +new file mode 100644 +index 0000000..397e680 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h +@@ -0,0 +1,59 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#pragma once ++ ++#include ++ ++namespace unwindstack { ++ ++enum Riscv64Reg : uint16_t { ++ RISCV64_REG_PC, ++ RISCV64_REG_RA, ++ RISCV64_REG_SP, ++ RISCV64_REG_GP, ++ RISCV64_REG_TP, ++ RISCV64_REG_T0, ++ RISCV64_REG_T1, ++ RISCV64_REG_T2, ++ RISCV64_REG_S0, ++ RISCV64_REG_S1, ++ RISCV64_REG_A0, ++ RISCV64_REG_A1, ++ RISCV64_REG_A2, ++ RISCV64_REG_A3, ++ RISCV64_REG_A4, ++ RISCV64_REG_A5, ++ RISCV64_REG_A6, ++ RISCV64_REG_A7, ++ RISCV64_REG_S2, ++ RISCV64_REG_S3, ++ RISCV64_REG_S4, ++ RISCV64_REG_S5, ++ RISCV64_REG_S6, ++ RISCV64_REG_S7, ++ RISCV64_REG_S8, ++ RISCV64_REG_S9, ++ RISCV64_REG_S10, ++ RISCV64_REG_S11, ++ RISCV64_REG_T3, ++ RISCV64_REG_T4, ++ RISCV64_REG_T5, ++ RISCV64_REG_T6, ++ RISCV64_REG_MAX, ++}; ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h +index f0b5e3a..698eba2 100644 +--- a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h ++++ b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h +@@ -81,6 +81,49 @@ inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { + : "x12", "x13", "memory"); + } + ++#elif defined(__riscv) ++ ++inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { ++ asm volatile( ++ "1:\n" ++ "sd ra, 8(%[base])\n" ++ "sd sp, 16(%[base])\n" ++ "sd gp, 24(%[base])\n" ++ "sd tp, 32(%[base])\n" ++ "sd t0, 40(%[base])\n" ++ "sd t1, 48(%[base])\n" ++ "sd t2, 56(%[base])\n" ++ "sd s0, 64(%[base])\n" ++ "sd s1, 72(%[base])\n" ++ "sd a0, 80(%[base])\n" ++ "sd a1, 88(%[base])\n" ++ "sd a2, 96(%[base])\n" ++ "sd a3, 104(%[base])\n" ++ "sd a4, 112(%[base])\n" ++ "sd a5, 120(%[base])\n" ++ "sd a6, 128(%[base])\n" ++ "sd a7, 136(%[base])\n" ++ "sd s2, 144(%[base])\n" ++ "sd s3, 152(%[base])\n" ++ "sd s4, 160(%[base])\n" ++ "sd s5, 168(%[base])\n" ++ "sd s6, 176(%[base])\n" ++ "sd s7, 184(%[base])\n" ++ "sd s8, 192(%[base])\n" ++ "sd s9, 200(%[base])\n" ++ "sd s10, 208(%[base])\n" ++ "sd s11, 216(%[base])\n" ++ "sd t3, 224(%[base])\n" ++ "sd t4, 232(%[base])\n" ++ "sd t5, 240(%[base])\n" ++ "sd t6, 248(%[base])\n" ++ "la t1, 1b\n" ++ "sd t1, 0(%[base])\n" ++ : [base] "+r"(reg_data) ++ : ++ : "t1", "memory"); ++} ++ + #elif defined(__i386__) || defined(__x86_64__) || defined(__mips__) + + extern "C" void AsmGetRegs(void* regs); +diff --git a/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h +new file mode 100644 +index 0000000..eb09397 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h +@@ -0,0 +1,59 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#pragma once ++ ++#include ++ ++#include ++ ++#include ++#include ++ ++namespace unwindstack { ++ ++// Forward declarations. ++class Memory; ++ ++class RegsRiscv64 : public RegsImpl { ++ public: ++ RegsRiscv64(); ++ virtual ~RegsRiscv64() = default; ++ ++ ArchEnum Arch() override final; ++ ++ uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override; ++ ++ bool SetPcFromReturnAddress(Memory* process_memory) override; ++ ++ bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override; ++ ++ void IterateRegisters(std::function) override final; ++ ++ uint64_t pc() override; ++ uint64_t sp() override; ++ ++ void set_pc(uint64_t pc) override; ++ void set_sp(uint64_t sp) override; ++ ++ Regs* Clone() override final; ++ ++ static Regs* Read(void* data); ++ ++ static Regs* CreateFromUcontext(void* ucontext); ++}; ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h +new file mode 100644 +index 0000000..c6c82b1 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h +@@ -0,0 +1,80 @@ ++/* ++ * Copyright (C) 2014 The Android Open Source Project ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#pragma once ++ ++#include ++ ++typedef uint64_t __riscv_mc_gp_state[32]; // unsigned long ++ ++struct __riscv_mc_f_ext_state { ++ uint32_t __f[32]; ++ uint32_t __fcsr; ++}; ++ ++struct __riscv_mc_d_ext_state { ++ uint64_t __f[32]; ++ uint32_t __fcsr; ++}; ++ ++struct __riscv_mc_q_ext_state { ++ uint64_t __f[64] __attribute__((__aligned__(16))); ++ uint32_t __fcsr; ++ uint32_t __reserved[3]; ++}; ++ ++union __riscv_mc_fp_state { ++ struct __riscv_mc_f_ext_state __f; ++ struct __riscv_mc_d_ext_state __d; ++ struct __riscv_mc_q_ext_state __q; ++}; ++ ++struct __riscv_stack_t { ++ uint64_t ss_sp; ++ int32_t ss_flags; ++ uint64_t ss_size; ++}; ++ ++struct riscv64_sigset_t { ++ uint64_t sig; // unsigned long ++}; ++ ++struct riscv64_mcontext_t { ++ __riscv_mc_gp_state __gregs; ++ union __riscv_mc_fp_state __fpregs; ++}; ++ ++struct riscv64_ucontext_t { ++ uint64_t uc_flags; // unsigned long ++ struct riscv64_ucontext_t* uc_link; ++ __riscv_stack_t uc_stack; ++ riscv64_sigset_t uc_sigmask; ++ /* The kernel adds extra padding here to allow sigset_t to grow. */ ++ int8_t __padding[128 - sizeof(riscv64_sigset_t)]; // char ++ riscv64_mcontext_t uc_mcontext; ++}; +diff --git a/system/core/libunwindstack/include/unwindstack/UserRiscv64.h b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h +new file mode 100644 +index 0000000..1e91228 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h +@@ -0,0 +1,37 @@ ++/* ++ * Copyright (C) 2016 The Android Open Source Project ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#pragma once ++ ++namespace unwindstack { ++ ++struct riscv64_user_regs { ++ uint64_t regs[32]; ++}; ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/tools/unwind.cpp b/system/core/libunwindstack/tools/unwind.cpp +index 1812e50..ae20891 100644 +--- a/system/core/libunwindstack/tools/unwind.cpp ++++ b/system/core/libunwindstack/tools/unwind.cpp +@@ -83,6 +83,9 @@ void DoUnwind(pid_t pid) { + case unwindstack::ARCH_MIPS64: + printf("mips64"); + break; ++ case unwindstack::ARCH_RISCV64: ++ printf("riscv64"); ++ break; + default: + printf("unknown\n"); + return; +diff --git a/system/core/libunwindstack/tools/unwind_symbols.cpp b/system/core/libunwindstack/tools/unwind_symbols.cpp +index 8df2284..976db56 100644 +--- a/system/core/libunwindstack/tools/unwind_symbols.cpp ++++ b/system/core/libunwindstack/tools/unwind_symbols.cpp +@@ -77,6 +77,9 @@ int main(int argc, char** argv) { + case EM_AARCH64: + printf("ABI: arm64\n"); + break; ++ case EM_RISCV: ++ printf("ABI: riscv64\n"); ++ break; + case EM_386: + printf("ABI: x86\n"); + break; diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Added-missing-headers.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Added-missing-headers.patch new file mode 100644 index 0000000000..c07e93660f --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Added-missing-headers.patch @@ -0,0 +1,44 @@ +Description: Added missing headers causing compile errors +Author: Umang Parmar +Forwarded: not-needed + +--- a/system/core/adb/sysdeps/posix/network.cpp ++++ b/system/core/adb/sysdeps/posix/network.cpp +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include + #include +--- a/system/core/base/file.cpp ++++ b/system/core/base/file.cpp +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include + #include +--- a/system/core/libbacktrace/BacktraceMap.cpp ++++ b/system/core/libbacktrace/BacktraceMap.cpp +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include + +--- a/system/core/libbacktrace/UnwindStackMap.cpp ++++ b/system/core/libbacktrace/UnwindStackMap.cpp +@@ -20,6 +20,7 @@ + + #include + #include ++#include + + #include + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Nonnull.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Nonnull.patch new file mode 100644 index 0000000000..8d1408a48e --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Nonnull.patch @@ -0,0 +1,20 @@ +Description: Bring Clang's _Nonnull keyword to GCC +Author: Kai-Chung Yan +Forwarded: not-needed +--- a/system/core/adb/sysdeps.h ++++ b/system/core/adb/sysdeps.h +@@ -40,11 +40,12 @@ + #include "sysdeps/network.h" + #include "sysdeps/stat.h" + ++#define _Nonnull ++#define _Nullable ++ + #ifdef _WIN32 + + // Clang-only nullability specifiers +-#define _Nonnull +-#define _Nullable + + #include + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Vector-cast.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Vector-cast.patch new file mode 100644 index 0000000000..b32d5f6f54 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/Vector-cast.patch @@ -0,0 +1,14 @@ +Description: Fix the weird error by GCC7 that fails to match the correct parent method. +Author: Kai-Chung Yan +Forwarded: not-needed +--- a/system/core/libutils/include/utils/Vector.h ++++ b/system/core/libutils/include/utils/Vector.h +@@ -256,7 +256,7 @@ + + template inline + const Vector& Vector::operator = (const Vector& rhs) const { +- VectorImpl::operator = (static_cast(rhs)); ++ VectorImpl::operator = (rhs); + return *this; + } + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/add-missing-headers.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/add-missing-headers.patch new file mode 100644 index 0000000000..49d3ecefbb --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/add-missing-headers.patch @@ -0,0 +1,41 @@ +Forwarded: not-needed +--- a/system/core/fs_mgr/liblp/reader.cpp ++++ b/system/core/fs_mgr/liblp/reader.cpp +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include + #include +--- a/system/core/fs_mgr/liblp/writer.cpp ++++ b/system/core/fs_mgr/liblp/writer.cpp +@@ -21,6 +21,7 @@ + #include + + #include ++#include + + #include + #include +--- a/system/core/liblog/logger_write.cpp ++++ b/system/core/liblog/logger_write.cpp +@@ -27,6 +27,7 @@ + #include + #endif + ++#include + #include + + #include +--- a/system/core/libziparchive/zip_archive_stream_entry.cc ++++ b/system/core/libziparchive/zip_archive_stream_entry.cc +@@ -23,6 +23,7 @@ + #include + #include + ++#include + #include + #include + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch new file mode 100644 index 0000000000..b926eddcdf --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch @@ -0,0 +1,13 @@ +Description: Off-by-one error in the dwarf_to_unw_regnum function in include/dwarf_i.h in +libunwind 1.1 allows local users to have unspecified impact via invalid dwarf opcodes. +--- a/external/libunwind/include/dwarf_i.h ++++ b/external/libunwind/include/dwarf_i.h +@@ -20,7 +20,7 @@ + extern const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH]; + /* REG is evaluated multiple times; it better be side-effects free! */ + # define dwarf_to_unw_regnum(reg) \ +- (((reg) <= DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0) ++ (((reg) < DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0) + #endif + + #ifdef UNW_LOCAL_ONLY diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/legacy_built-in_sync_functions.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/legacy_built-in_sync_functions.patch new file mode 100644 index 0000000000..ce1d4e52eb --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/legacy_built-in_sync_functions.patch @@ -0,0 +1,26 @@ +Description: Replace the legacy __sync built-in functions with __atomic ones + libunwind uses the built-in __sync_* functions which are deprecated by GCC and + should be replaced by __atomic_* ones. See the official manuals [1]. + . + The legacy __sync functions do not require to specify the memory order but + __atomic ones do, so we choose the strongest one: __ATOMIC_SEQ_CST. + . + We do this because __sync_fetch_and_add() is not supported on armel. + . + [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html +Author: Kai-Chung Yan () +Last-Update: 2016-10-04 +Forwarded: not-needed +--- a/external/libunwind/include/libunwind_i.h ++++ b/external/libunwind/include/libunwind_i.h +@@ -155,8 +155,8 @@ cmpxchg_ptr (void *addr, void *old, void + u.vp = addr; + return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new); + } +-# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1) +-# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value) ++# define fetch_and_add1(_ptr) __atomic_fetch_add(_ptr, 1, __ATOMIC_SEQ_CST) ++# define fetch_and_add(_ptr, value) __atomic_fetch_add(_ptr, value, __ATOMIC_SEQ_CST) + # define HAVE_CMPXCHG + # define HAVE_FETCH_AND_ADD + #endif diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/user_pt_regs.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/user_pt_regs.patch new file mode 100644 index 0000000000..600471f126 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/external/libunwind/user_pt_regs.patch @@ -0,0 +1,24 @@ +Author: Kai-Chung Yan +Last-Update: 2016-08-24 +Description: Manual definition of struct user_pt_regs + On ARM64, libunwind uses struct user_pt_regs which is not defined in + anywhere, which causes FTBFS. +Forwarded: not-needed +--- a/external/libunwind/src/ptrace/_UPT_access_reg.c ++++ b/external/libunwind/src/ptrace/_UPT_access_reg.c +@@ -26,6 +26,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE + + #include "_UPT_internal.h" + ++#if defined(__aarch64__) ++ struct user_pt_regs { ++ __u64 regs[31]; ++ __u64 sp; ++ __u64 pc; ++ __u64 pstate; ++ }; ++#endif ++ + #if UNW_TARGET_IA64 + # include + # ifdef HAVE_ASM_PTRACE_OFFSETS_H diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-attribute-issue-with-gcc.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-attribute-issue-with-gcc.patch new file mode 100644 index 0000000000..e0b4275579 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-attribute-issue-with-gcc.patch @@ -0,0 +1,17 @@ +Description: remove clang-ism +Forwarded: not-needed + +--- a/system/core/base/include/android-base/logging.h ++++ b/system/core/base/include/android-base/logging.h +@@ -451,10 +451,7 @@ + // -Wno-user-defined-warnings to CPPFLAGS. + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgcc-compat" +-#define OSTREAM_STRING_POINTER_USAGE_WARNING \ +- __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) +-inline OSTREAM_STRING_POINTER_USAGE_WARNING +-std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { ++inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { + return stream << static_cast(string_pointer); + } + #pragma clang diagnostic pop diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-build-on-non-x86.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-build-on-non-x86.patch new file mode 100644 index 0000000000..98a5078244 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-build-on-non-x86.patch @@ -0,0 +1,24 @@ +Description: non-x86 arches do not have PAGE_SIZE +Forwarded: not-needed +--- a/system/core/base/cmsg.cpp ++++ b/system/core/base/cmsg.cpp +@@ -33,7 +33,8 @@ + const std::vector& fds) { + size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); + size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); +- if (cmsg_space >= PAGE_SIZE) { ++ size_t pagesize = static_cast(sysconf(_SC_PAGE_SIZE)); ++ if (cmsg_space >= pagesize) { + errno = ENOMEM; + return -1; + } +@@ -75,7 +76,8 @@ + fds->clear(); + + size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds); +- if (cmsg_space >= PAGE_SIZE) { ++ size_t pagesize = static_cast(sysconf(_SC_PAGE_SIZE)); ++ if (cmsg_space >= pagesize) { + errno = ENOMEM; + return -1; + } diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-gettid-exception-declaration.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-gettid-exception-declaration.patch new file mode 100644 index 0000000000..7fd228bff6 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-gettid-exception-declaration.patch @@ -0,0 +1,24 @@ +Description: get libcutils building +Forwarded: not-needed +--- a/system/core/libcutils/include/cutils/threads.h ++++ b/system/core/libcutils/include/cutils/threads.h +@@ -33,7 +33,7 @@ + // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. + // + +-extern pid_t gettid(); ++extern pid_t gettid(void) __THROW; + + // + // Deprecated: use `_Thread_local` in C or `thread_local` in C++. +--- a/system/core/libcutils/threads.cpp ++++ b/system/core/libcutils/threads.cpp +@@ -33,7 +33,7 @@ + + // No definition needed for Android because we'll just pick up bionic's copy. + #ifndef __ANDROID__ +-pid_t gettid() { ++pid_t gettid(void) __THROW { + #if defined(__APPLE__) + uint64_t tid; + pthread_threadid_np(NULL, &tid); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-standard-namespace-errors.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-standard-namespace-errors.patch new file mode 100644 index 0000000000..e41a3576ae --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/fix-standard-namespace-errors.patch @@ -0,0 +1,22 @@ +Description: Add missing 'std::' scope identifiers. +Forwarded: not-needed +--- a/system/core/libunwindstack/include/unwindstack/DwarfMemory.h ++++ b/system/core/libunwindstack/include/unwindstack/DwarfMemory.h +@@ -29,7 +29,7 @@ + DwarfMemory(Memory* memory) : memory_(memory) {} + virtual ~DwarfMemory() = default; + +- bool ReadBytes(void* dst, size_t num_bytes); ++ bool ReadBytes(void* dst, std::size_t num_bytes); + + template + bool ReadSigned(uint64_t* value); +@@ -39,7 +39,7 @@ + bool ReadSLEB128(int64_t* value); + + template +- size_t GetEncodedSize(uint8_t encoding); ++ std::size_t GetEncodedSize(uint8_t encoding); + + bool AdjustEncodedValue(uint8_t encoding, uint64_t* value); + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/hard-code-build-number.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/hard-code-build-number.patch new file mode 100644 index 0000000000..2a332eb689 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/hard-code-build-number.patch @@ -0,0 +1,44 @@ +Description: just hard code rather than deal with circular deps +Forwarded: not-needed +--- a/system/core/adb/adb.cpp ++++ b/system/core/adb/adb.cpp +@@ -44,8 +44,6 @@ + #include + #include + #include +-#include +-#include + + #include "adb_auth.h" + #include "adb_io.h" +@@ -69,7 +67,7 @@ + "Version %s-%s\n" + "Installed as %s\n", + ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, +- PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(), ++ PLATFORM_TOOLS_VERSION, "debian", + android::base::GetExecutablePath().c_str()); + } + +--- a/system/core/fastboot/fastboot.cpp ++++ b/system/core/fastboot/fastboot.cpp +@@ -59,10 +59,8 @@ + #include + #include + #include +-#include + #include + #include +-#include + #include + #include + +@@ -1680,7 +1678,7 @@ + setvbuf(stdout, nullptr, _IONBF, 0); + setvbuf(stderr, nullptr, _IONBF, 0); + } else if (name == "version") { +- fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str()); ++ fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, "debian"); + fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str()); + return 0; + #if !defined(_WIN32) diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/libusb-header-path.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/libusb-header-path.patch new file mode 100644 index 0000000000..1663aae465 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/libusb-header-path.patch @@ -0,0 +1,16 @@ +Description: libusb.h comes from different location +Author: Umang Parmar +Forwarded: not-needed +Last-Update: 2018-05-26 + +--- a/system/core/adb/client/usb_libusb.cpp ++++ b/system/core/adb/client/usb_libusb.cpp +@@ -30,7 +30,7 @@ + #include + #include + +-#include ++#include + + #include + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/move-log-file-to-proper-dir.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/move-log-file-to-proper-dir.patch new file mode 100644 index 0000000000..006564b024 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/move-log-file-to-proper-dir.patch @@ -0,0 +1,18 @@ +Description: Update log file directory. +Author: Umang Parmar +Last Updated: 2018-05-17 + +--- a/system/core/adb/adb_utils.cpp ++++ b/system/core/adb/adb_utils.cpp +@@ -339,6 +339,11 @@ + + return temp_path_utf8 + log_name; + #else ++ std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid()); ++ struct stat st = {0}; ++ if (stat(log_dir.c_str(), &st) == 0) { ++ return log_dir; ++ } + const char* tmp_dir = getenv("TMPDIR"); + if (tmp_dir == nullptr) tmp_dir = "/tmp"; + return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid()); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/simg_dump-python3.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/simg_dump-python3.patch new file mode 100644 index 0000000000..e6933ef145 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/simg_dump-python3.patch @@ -0,0 +1,62 @@ +Description: Port simg_dump to Python 3. +Author: Antonio Russo +Forwarded: not-needed +Last-Update: 2019-01-05 +Origin: https://bugs.debian.org/945646 + +--- +Index: android-platform-tools/system/core/libsparse/simg_dump.py +=================================================================== +--- android-platform-tools.orig/system/core/libsparse/simg_dump.py ++++ android-platform-tools/system/core/libsparse/simg_dump.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (C) 2012 The Android Open Source Project + # +@@ -14,7 +14,7 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-from __future__ import print_function ++ + import csv + import getopt + import hashlib +@@ -47,7 +47,7 @@ def main(): + opts, args = getopt.getopt(sys.argv[1:], + "vsc:", + ["verbose", "showhash", "csvfile"]) +- except getopt.GetoptError, e: ++ except getopt.GetoptError as e: + print(e) + usage(me) + for o, a in opts: +@@ -66,7 +66,7 @@ def main(): + usage(me) + + if csvfilename: +- csvfile = open(csvfilename, "wb") ++ csvfile = open(csvfilename, "w", newline='') + csvwriter = csv.writer(csvfile) + + output = verbose or csvfilename or showhash +@@ -121,7 +121,7 @@ def main(): + "output offset", "output blocks", "type", "hash"]) + + offset = 0 +- for i in xrange(1, total_chunks + 1): ++ for i in range(1, total_chunks + 1): + header_bin = FH.read(12) + header = struct.unpack("<2H2I", header_bin) + chunk_type = header[0] +@@ -160,7 +160,7 @@ def main(): + if showhash: + h = hashlib.sha1() + data = fill_bin * (blk_sz / 4); +- for block in xrange(chunk_sz): ++ for block in range(chunk_sz): + h.update(data) + curhash = h.hexdigest() + elif chunk_type == 0xCAC3: diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stdatomic.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stdatomic.patch new file mode 100644 index 0000000000..ea3711dfa2 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stdatomic.patch @@ -0,0 +1,64 @@ +Description: Fix incompatibility between and + This 2 headers combined will cause errors for both GCC and Clang. This patch + makes sure only one of them is present at any time. +Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 +Bug: https://reviews.llvm.org/D45470 +--- a/system/core/libcutils/include/cutils/trace.h ++++ b/system/core/libcutils/include/cutils/trace.h +@@ -18,7 +18,14 @@ + #define _LIBS_CUTILS_TRACE_H + + #include ++#ifdef __cplusplus ++#include ++using std::atomic_bool; ++using std::atomic_load_explicit; ++using std::memory_order_acquire; ++#else + #include ++#endif + #include + #include + #include +--- a/system/core/libcutils/include/cutils/atomic.h ++++ b/system/core/libcutils/include/cutils/atomic.h +@@ -19,7 +19,23 @@ + + #include + #include ++#ifdef __cplusplus ++#include ++using std::atomic_compare_exchange_strong_explicit; ++using std::atomic_fetch_add_explicit; ++using std::atomic_fetch_or_explicit; ++using std::atomic_fetch_sub_explicit; ++using std::atomic_int_least32_t; ++using std::atomic_load_explicit; ++using std::atomic_store_explicit; ++using std::atomic_thread_fence; ++using std::memory_order::memory_order_acquire; ++using std::memory_order::memory_order_relaxed; ++using std::memory_order::memory_order_release; ++using std::memory_order::memory_order_seq_cst; ++#else + #include ++#endif + + #ifndef ANDROID_ATOMIC_INLINE + #define ANDROID_ATOMIC_INLINE static inline +--- a/system/core/liblog/logger.h ++++ b/system/core/liblog/logger.h +@@ -16,7 +16,13 @@ + + #pragma once + ++#ifdef __cplusplus ++#include ++using std::atomic_int; ++using std::atomic_uintptr_t; ++#else + #include ++#endif + #include + + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stub-out-fastdeploy.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stub-out-fastdeploy.patch new file mode 100644 index 0000000000..d2426a781d --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/stub-out-fastdeploy.patch @@ -0,0 +1,93 @@ +Description: Defer packaging fastdeploy with adb for 29.x.x tags. +Forwarded: not-needed +--- a/system/core/adb/client/commandline.cpp ++++ b/system/core/adb/client/commandline.cpp +@@ -59,7 +59,6 @@ + #include "bugreport.h" + #include "client/file_sync_client.h" + #include "commandline.h" +-#include "fastdeploy.h" + #include "services.h" + #include "shell_protocol.h" + #include "sysdeps/chrono.h" +--- a/system/core/adb/client/adb_install.cpp ++++ b/system/core/adb/client/adb_install.cpp +@@ -35,7 +35,6 @@ + #include "adb_utils.h" + #include "client/file_sync_client.h" + #include "commandline.h" +-#include "fastdeploy.h" + + static constexpr int kFastDeployMinApi = 24; + +@@ -167,14 +166,6 @@ + } + + if (use_fastdeploy) { +- auto metadata = extract_metadata(file); +- if (metadata.has_value()) { +- // pass all but 1st (command) and last (apk path) parameters through to pm for +- // session creation +- std::vector pm_args{argv + 1, argv + argc - 1}; +- auto patchFd = install_patch(pm_args.size(), pm_args.data()); +- return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); +- } + } + + struct stat sb; +@@ -267,16 +258,6 @@ + argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ + + if (use_fastdeploy) { +- auto metadata = extract_metadata(apk_file[0]); +- if (metadata.has_value()) { +- auto patchFd = apply_patch_on_device(apk_dest.c_str()); +- int status = stream_patch(apk_file[0], std::move(metadata.value()), std::move(patchFd)); +- +- result = pm_command(argc, argv); +- delete_device_file(apk_dest); +- +- return status; +- } + } + + if (do_sync_push(apk_file, apk_dest.c_str(), false)) { +@@ -292,7 +273,6 @@ + InstallMode installMode = INSTALL_DEFAULT; + bool use_fastdeploy = false; + bool is_reinstall = false; +- FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; + + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--streaming")) { +@@ -313,13 +293,10 @@ + use_fastdeploy = false; + } else if (!strcmp(argv[i], "--force-agent")) { + processedArgIndicies.push_back(i); +- agent_update_strategy = FastDeploy_AgentUpdateAlways; + } else if (!strcmp(argv[i], "--date-check-agent")) { + processedArgIndicies.push_back(i); +- agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; + } else if (!strcmp(argv[i], "--version-check-agent")) { + processedArgIndicies.push_back(i); +- agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; + } + } + +@@ -331,13 +308,11 @@ + error_exit("Attempting to use streaming install on unsupported device"); + } + +- if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { +- printf("Fast Deploy is only compatible with devices of API version %d or higher, " +- "ignoring.\n", +- kFastDeployMinApi); ++ if (use_fastdeploy) { ++ printf("Fast Deploy is unavailable in this build of adb, " ++ "ignoring.\n"); + use_fastdeploy = false; + } +- fastdeploy_set_agent_update_strategy(agent_update_strategy); + + std::vector passthrough_argv; + for (int i = 0; i < argc; i++) { diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Add-riscv64-support.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Add-riscv64-support.patch new file mode 100644 index 0000000000..4669f89d07 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Add-riscv64-support.patch @@ -0,0 +1,651 @@ +From: Guo Ren +Date: Wed, 29 Jun 2022 16:46:46 +0800 +Subject: Add riscv64 support + +This patch contains the dwarf unwind support for 64bit risc-v. + + * DwarfCfa.cpp (cfa_def_cfa_register): setup register if CFA_REG is + not setup for riscv64 + * Elf.cpp (GetRelPc): convert offset to virtual address for riscv64. + * ElfInterface.cpp (GetVirtAddrFromOffset): New for riscv64. + * RegsRiscv64.cpp (StepIfSignalHandler): Fix signal frame check. + libunwindstack/include/unwindstack/ + * ElfInterface.h (GetVirtAddrFromOffset): New for riscv64. + libunwindstack/tests/ + * DwarfCfaTest.cpp (cfa_def_cfa_register): ok for riscv64. + * RegsStepIfSignalHandlerTest.cpp (riscv64_step_if_signal_handler): Fix + testcase for riscv64 + +Test: Builds. +Test: All unit tests pass. + +Signed-off-by: Guo Ren +Signed-off-by: Lifang Xia +Signed-off-by: Mao Han +Change-Id: Ib21ddf23cc83f332af202df7bffcaceec16063e0 +--- + system/core/libunwindstack/Android.bp | 1 + + system/core/libunwindstack/Elf.cpp | 2 + + system/core/libunwindstack/Regs.cpp | 10 ++ + system/core/libunwindstack/RegsRiscv64.cpp | 156 +++++++++++++++++++++ + .../core/libunwindstack/include/unwindstack/Elf.h | 5 + + .../include/unwindstack/MachineRiscv64.h | 59 ++++++++ + .../include/unwindstack/RegsGetLocal.h | 43 ++++++ + .../include/unwindstack/RegsRiscv64.h | 59 ++++++++ + .../include/unwindstack/UcontextRiscv64.h | 80 +++++++++++ + .../include/unwindstack/UserRiscv64.h | 37 +++++ + system/core/libunwindstack/tools/unwind.cpp | 3 + + .../core/libunwindstack/tools/unwind_symbols.cpp | 3 + + 12 files changed, 458 insertions(+) + create mode 100644 system/core/libunwindstack/RegsRiscv64.cpp + create mode 100644 system/core/libunwindstack/include/unwindstack/MachineRiscv64.h + create mode 100644 system/core/libunwindstack/include/unwindstack/RegsRiscv64.h + create mode 100644 system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h + create mode 100644 system/core/libunwindstack/include/unwindstack/UserRiscv64.h + +diff --git a/system/core/libunwindstack/Android.bp b/system/core/libunwindstack/Android.bp +index 3695f72..f1f9c68 100644 +--- a/system/core/libunwindstack/Android.bp ++++ b/system/core/libunwindstack/Android.bp +@@ -70,6 +70,7 @@ cc_library { + "RegsArm64.cpp", + "RegsX86.cpp", + "RegsX86_64.cpp", ++ "RegsRiscv64.cpp", + "RegsMips.cpp", + "RegsMips64.cpp", + "Unwinder.cpp", +diff --git a/system/core/libunwindstack/Elf.cpp b/system/core/libunwindstack/Elf.cpp +index f01b092..3c2088b 100644 +--- a/system/core/libunwindstack/Elf.cpp ++++ b/system/core/libunwindstack/Elf.cpp +@@ -290,6 +290,8 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { + arch_ = ARCH_X86_64; + } else if (e_machine == EM_MIPS) { + arch_ = ARCH_MIPS64; ++ } else if (e_machine == EM_RISCV) { ++ arch_ = ARCH_RISCV64; + } else { + // Unsupported. + ALOGI("64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = %d\n", +diff --git a/system/core/libunwindstack/Regs.cpp b/system/core/libunwindstack/Regs.cpp +index c7dec52..447a554 100644 +--- a/system/core/libunwindstack/Regs.cpp ++++ b/system/core/libunwindstack/Regs.cpp +@@ -27,12 +27,14 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include ++#include + #include + #include + +@@ -67,6 +69,8 @@ Regs* Regs::RemoteGet(pid_t pid) { + return RegsMips::Read(buffer.data()); + case sizeof(mips64_user_regs): + return RegsMips64::Read(buffer.data()); ++ case sizeof(riscv64_user_regs): ++ return RegsRiscv64::Read(buffer.data()); + } + return nullptr; + } +@@ -85,6 +89,8 @@ Regs* Regs::CreateFromUcontext(ArchEnum arch, void* ucontext) { + return RegsMips::CreateFromUcontext(ucontext); + case ARCH_MIPS64: + return RegsMips64::CreateFromUcontext(ucontext); ++ case ARCH_RISCV64: ++ return RegsRiscv64::CreateFromUcontext(ucontext); + case ARCH_UNKNOWN: + default: + return nullptr; +@@ -104,6 +110,8 @@ ArchEnum Regs::CurrentArch() { + return ARCH_MIPS; + #elif defined(__mips__) && defined(__LP64__) + return ARCH_MIPS64; ++#elif defined(__riscv) ++ return ARCH_RISCV64; + #else + abort(); + #endif +@@ -123,6 +131,8 @@ Regs* Regs::CreateFromLocal() { + regs = new RegsMips(); + #elif defined(__mips__) && defined(__LP64__) + regs = new RegsMips64(); ++#elif defined(__riscv) ++ regs = new RegsRiscv64(); + #else + abort(); + #endif +diff --git a/system/core/libunwindstack/RegsRiscv64.cpp b/system/core/libunwindstack/RegsRiscv64.cpp +new file mode 100644 +index 0000000..887762a +--- /dev/null ++++ b/system/core/libunwindstack/RegsRiscv64.cpp +@@ -0,0 +1,156 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace unwindstack { ++ ++RegsRiscv64::RegsRiscv64() ++ : RegsImpl(RISCV64_REG_MAX, Location(LOCATION_REGISTER, RISCV64_REG_RA)) {} ++ ++ArchEnum RegsRiscv64::Arch() { ++ return ARCH_RISCV64; ++} ++ ++uint64_t RegsRiscv64::pc() { ++ return regs_[RISCV64_REG_PC]; ++} ++ ++uint64_t RegsRiscv64::sp() { ++ return regs_[RISCV64_REG_SP]; ++} ++ ++void RegsRiscv64::set_pc(uint64_t pc) { ++ regs_[RISCV64_REG_PC] = pc; ++} ++ ++void RegsRiscv64::set_sp(uint64_t sp) { ++ regs_[RISCV64_REG_SP] = sp; ++} ++ ++uint64_t RegsRiscv64::GetPcAdjustment(uint64_t rel_pc, Elf*) { ++ if (rel_pc < 8) { ++ return 0; ++ } ++ // For now, just assume no compact branches ++ return 8; ++} ++ ++bool RegsRiscv64::SetPcFromReturnAddress(Memory*) { ++ uint64_t ra = regs_[RISCV64_REG_RA]; ++ if (regs_[RISCV64_REG_PC] == ra) { ++ return false; ++ } ++ ++ regs_[RISCV64_REG_PC] = ra; ++ return true; ++} ++ ++void RegsRiscv64::IterateRegisters(std::function fn) { ++ fn("pc", regs_[RISCV64_REG_PC]); ++ fn("ra", regs_[RISCV64_REG_RA]); ++ fn("sp", regs_[RISCV64_REG_SP]); ++ fn("gp", regs_[RISCV64_REG_GP]); ++ fn("tp", regs_[RISCV64_REG_TP]); ++ fn("t0", regs_[RISCV64_REG_T0]); ++ fn("t1", regs_[RISCV64_REG_T1]); ++ fn("t2", regs_[RISCV64_REG_T2]); ++ fn("t3", regs_[RISCV64_REG_T3]); ++ fn("t4", regs_[RISCV64_REG_T4]); ++ fn("t5", regs_[RISCV64_REG_T5]); ++ fn("t6", regs_[RISCV64_REG_T6]); ++ fn("s0", regs_[RISCV64_REG_S0]); ++ fn("s1", regs_[RISCV64_REG_S1]); ++ fn("s2", regs_[RISCV64_REG_S2]); ++ fn("s3", regs_[RISCV64_REG_S3]); ++ fn("s4", regs_[RISCV64_REG_S4]); ++ fn("s5", regs_[RISCV64_REG_S5]); ++ fn("s6", regs_[RISCV64_REG_S6]); ++ fn("s7", regs_[RISCV64_REG_S7]); ++ fn("s8", regs_[RISCV64_REG_S8]); ++ fn("s9", regs_[RISCV64_REG_S9]); ++ fn("s10", regs_[RISCV64_REG_S10]); ++ fn("s11", regs_[RISCV64_REG_S11]); ++ fn("a0", regs_[RISCV64_REG_A0]); ++ fn("a1", regs_[RISCV64_REG_A1]); ++ fn("a2", regs_[RISCV64_REG_A2]); ++ fn("a3", regs_[RISCV64_REG_A3]); ++ fn("a4", regs_[RISCV64_REG_A4]); ++ fn("a5", regs_[RISCV64_REG_A5]); ++ fn("a6", regs_[RISCV64_REG_A6]); ++ fn("a7", regs_[RISCV64_REG_A7]); ++} ++ ++Regs* RegsRiscv64::Read(void* remote_data) { ++ riscv64_user_regs* user = reinterpret_cast(remote_data); ++ ++ RegsRiscv64* regs = new RegsRiscv64(); ++ memcpy(regs->RawData(), &user->regs[0], RISCV64_REG_MAX * sizeof(uint64_t)); ++ // uint64_t* reg_data = reinterpret_cast(regs->RawData()); ++ return regs; ++} ++ ++Regs* RegsRiscv64::CreateFromUcontext(void* ucontext) { ++ riscv64_ucontext_t* riscv64_ucontext = reinterpret_cast(ucontext); ++ ++ RegsRiscv64* regs = new RegsRiscv64(); ++ memcpy(regs->RawData(), &riscv64_ucontext->uc_mcontext.__gregs[0], ++ RISCV64_REG_MAX * sizeof(uint64_t)); ++ return regs; ++} ++ ++bool RegsRiscv64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) { ++ uint64_t data; ++ Memory* elf_memory = elf->memory(); ++ // Read from elf memory since it is usually more expensive to read from ++ // process memory. ++ if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) { ++ return false; ++ } ++ // Look for the kernel sigreturn function. ++ // __kernel_rt_sigreturn: ++ // li a7, __NR_rt_sigreturn ++ // scall ++ ++ const uint8_t li_scall[] = {0x93, 0x08, 0xb0, 0x08, 0x73, 0x00, 0x00, 0x00}; ++ if (memcmp(&data, &li_scall, 8) != 0) { ++ return false; ++ } ++ ++ // SP + sizeof(siginfo_t) + uc_mcontext offset + PC offset. ++ if (!process_memory->ReadFully(regs_[RISCV64_REG_SP] + 0x80 + 0xb0 + 0x00, regs_.data(), ++ sizeof(uint64_t) * (RISCV64_REG_MAX))) { ++ return false; ++ } ++ return true; ++} ++ ++Regs* RegsRiscv64::Clone() { ++ return new RegsRiscv64(*this); ++} ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/include/unwindstack/Elf.h b/system/core/libunwindstack/include/unwindstack/Elf.h +index 472ed92..88fa0ff 100644 +--- a/system/core/libunwindstack/include/unwindstack/Elf.h ++++ b/system/core/libunwindstack/include/unwindstack/Elf.h +@@ -32,6 +32,10 @@ + #define EM_AARCH64 183 + #endif + ++#if !defined(EM_RISCV) ++#define EM_RISCV 243 ++#endif ++ + namespace unwindstack { + + // Forward declaration. +@@ -46,6 +50,7 @@ enum ArchEnum : uint8_t { + ARCH_X86_64, + ARCH_MIPS, + ARCH_MIPS64, ++ ARCH_RISCV64, + }; + + class Elf { +diff --git a/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h +new file mode 100644 +index 0000000..397e680 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h +@@ -0,0 +1,59 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#pragma once ++ ++#include ++ ++namespace unwindstack { ++ ++enum Riscv64Reg : uint16_t { ++ RISCV64_REG_PC, ++ RISCV64_REG_RA, ++ RISCV64_REG_SP, ++ RISCV64_REG_GP, ++ RISCV64_REG_TP, ++ RISCV64_REG_T0, ++ RISCV64_REG_T1, ++ RISCV64_REG_T2, ++ RISCV64_REG_S0, ++ RISCV64_REG_S1, ++ RISCV64_REG_A0, ++ RISCV64_REG_A1, ++ RISCV64_REG_A2, ++ RISCV64_REG_A3, ++ RISCV64_REG_A4, ++ RISCV64_REG_A5, ++ RISCV64_REG_A6, ++ RISCV64_REG_A7, ++ RISCV64_REG_S2, ++ RISCV64_REG_S3, ++ RISCV64_REG_S4, ++ RISCV64_REG_S5, ++ RISCV64_REG_S6, ++ RISCV64_REG_S7, ++ RISCV64_REG_S8, ++ RISCV64_REG_S9, ++ RISCV64_REG_S10, ++ RISCV64_REG_S11, ++ RISCV64_REG_T3, ++ RISCV64_REG_T4, ++ RISCV64_REG_T5, ++ RISCV64_REG_T6, ++ RISCV64_REG_MAX, ++}; ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h +index f0b5e3a..698eba2 100644 +--- a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h ++++ b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h +@@ -81,6 +81,49 @@ inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { + : "x12", "x13", "memory"); + } + ++#elif defined(__riscv) ++ ++inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { ++ asm volatile( ++ "1:\n" ++ "sd ra, 8(%[base])\n" ++ "sd sp, 16(%[base])\n" ++ "sd gp, 24(%[base])\n" ++ "sd tp, 32(%[base])\n" ++ "sd t0, 40(%[base])\n" ++ "sd t1, 48(%[base])\n" ++ "sd t2, 56(%[base])\n" ++ "sd s0, 64(%[base])\n" ++ "sd s1, 72(%[base])\n" ++ "sd a0, 80(%[base])\n" ++ "sd a1, 88(%[base])\n" ++ "sd a2, 96(%[base])\n" ++ "sd a3, 104(%[base])\n" ++ "sd a4, 112(%[base])\n" ++ "sd a5, 120(%[base])\n" ++ "sd a6, 128(%[base])\n" ++ "sd a7, 136(%[base])\n" ++ "sd s2, 144(%[base])\n" ++ "sd s3, 152(%[base])\n" ++ "sd s4, 160(%[base])\n" ++ "sd s5, 168(%[base])\n" ++ "sd s6, 176(%[base])\n" ++ "sd s7, 184(%[base])\n" ++ "sd s8, 192(%[base])\n" ++ "sd s9, 200(%[base])\n" ++ "sd s10, 208(%[base])\n" ++ "sd s11, 216(%[base])\n" ++ "sd t3, 224(%[base])\n" ++ "sd t4, 232(%[base])\n" ++ "sd t5, 240(%[base])\n" ++ "sd t6, 248(%[base])\n" ++ "la t1, 1b\n" ++ "sd t1, 0(%[base])\n" ++ : [base] "+r"(reg_data) ++ : ++ : "t1", "memory"); ++} ++ + #elif defined(__i386__) || defined(__x86_64__) || defined(__mips__) + + extern "C" void AsmGetRegs(void* regs); +diff --git a/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h +new file mode 100644 +index 0000000..eb09397 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h +@@ -0,0 +1,59 @@ ++/* ++ * Copyright (C) 2022 The Android Open Source Project ++ * ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#pragma once ++ ++#include ++ ++#include ++ ++#include ++#include ++ ++namespace unwindstack { ++ ++// Forward declarations. ++class Memory; ++ ++class RegsRiscv64 : public RegsImpl { ++ public: ++ RegsRiscv64(); ++ virtual ~RegsRiscv64() = default; ++ ++ ArchEnum Arch() override final; ++ ++ uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override; ++ ++ bool SetPcFromReturnAddress(Memory* process_memory) override; ++ ++ bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override; ++ ++ void IterateRegisters(std::function) override final; ++ ++ uint64_t pc() override; ++ uint64_t sp() override; ++ ++ void set_pc(uint64_t pc) override; ++ void set_sp(uint64_t sp) override; ++ ++ Regs* Clone() override final; ++ ++ static Regs* Read(void* data); ++ ++ static Regs* CreateFromUcontext(void* ucontext); ++}; ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h +new file mode 100644 +index 0000000..c6c82b1 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h +@@ -0,0 +1,80 @@ ++/* ++ * Copyright (C) 2014 The Android Open Source Project ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#pragma once ++ ++#include ++ ++typedef uint64_t __riscv_mc_gp_state[32]; // unsigned long ++ ++struct __riscv_mc_f_ext_state { ++ uint32_t __f[32]; ++ uint32_t __fcsr; ++}; ++ ++struct __riscv_mc_d_ext_state { ++ uint64_t __f[32]; ++ uint32_t __fcsr; ++}; ++ ++struct __riscv_mc_q_ext_state { ++ uint64_t __f[64] __attribute__((__aligned__(16))); ++ uint32_t __fcsr; ++ uint32_t __reserved[3]; ++}; ++ ++union __riscv_mc_fp_state { ++ struct __riscv_mc_f_ext_state __f; ++ struct __riscv_mc_d_ext_state __d; ++ struct __riscv_mc_q_ext_state __q; ++}; ++ ++struct __riscv_stack_t { ++ uint64_t ss_sp; ++ int32_t ss_flags; ++ uint64_t ss_size; ++}; ++ ++struct riscv64_sigset_t { ++ uint64_t sig; // unsigned long ++}; ++ ++struct riscv64_mcontext_t { ++ __riscv_mc_gp_state __gregs; ++ union __riscv_mc_fp_state __fpregs; ++}; ++ ++struct riscv64_ucontext_t { ++ uint64_t uc_flags; // unsigned long ++ struct riscv64_ucontext_t* uc_link; ++ __riscv_stack_t uc_stack; ++ riscv64_sigset_t uc_sigmask; ++ /* The kernel adds extra padding here to allow sigset_t to grow. */ ++ int8_t __padding[128 - sizeof(riscv64_sigset_t)]; // char ++ riscv64_mcontext_t uc_mcontext; ++}; +diff --git a/system/core/libunwindstack/include/unwindstack/UserRiscv64.h b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h +new file mode 100644 +index 0000000..1e91228 +--- /dev/null ++++ b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h +@@ -0,0 +1,37 @@ ++/* ++ * Copyright (C) 2016 The Android Open Source Project ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in ++ * the documentation and/or other materials provided with the ++ * distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ++ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ++ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ++ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, ++ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS ++ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ++ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#pragma once ++ ++namespace unwindstack { ++ ++struct riscv64_user_regs { ++ uint64_t regs[32]; ++}; ++ ++} // namespace unwindstack +diff --git a/system/core/libunwindstack/tools/unwind.cpp b/system/core/libunwindstack/tools/unwind.cpp +index 1812e50..ae20891 100644 +--- a/system/core/libunwindstack/tools/unwind.cpp ++++ b/system/core/libunwindstack/tools/unwind.cpp +@@ -83,6 +83,9 @@ void DoUnwind(pid_t pid) { + case unwindstack::ARCH_MIPS64: + printf("mips64"); + break; ++ case unwindstack::ARCH_RISCV64: ++ printf("riscv64"); ++ break; + default: + printf("unknown\n"); + return; +diff --git a/system/core/libunwindstack/tools/unwind_symbols.cpp b/system/core/libunwindstack/tools/unwind_symbols.cpp +index 8df2284..976db56 100644 +--- a/system/core/libunwindstack/tools/unwind_symbols.cpp ++++ b/system/core/libunwindstack/tools/unwind_symbols.cpp +@@ -77,6 +77,9 @@ int main(int argc, char** argv) { + case EM_AARCH64: + printf("ABI: arm64\n"); + break; ++ case EM_RISCV: ++ printf("ABI: riscv64\n"); ++ break; + case EM_386: + printf("ABI: x86\n"); + break; diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Added-missing-headers.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Added-missing-headers.patch new file mode 100644 index 0000000000..c07e93660f --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Added-missing-headers.patch @@ -0,0 +1,44 @@ +Description: Added missing headers causing compile errors +Author: Umang Parmar +Forwarded: not-needed + +--- a/system/core/adb/sysdeps/posix/network.cpp ++++ b/system/core/adb/sysdeps/posix/network.cpp +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include + #include +--- a/system/core/base/file.cpp ++++ b/system/core/base/file.cpp +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include + #include +--- a/system/core/libbacktrace/BacktraceMap.cpp ++++ b/system/core/libbacktrace/BacktraceMap.cpp +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include + +--- a/system/core/libbacktrace/UnwindStackMap.cpp ++++ b/system/core/libbacktrace/UnwindStackMap.cpp +@@ -20,6 +20,7 @@ + + #include + #include ++#include + + #include + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Nonnull.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Nonnull.patch new file mode 100644 index 0000000000..8d1408a48e --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Nonnull.patch @@ -0,0 +1,20 @@ +Description: Bring Clang's _Nonnull keyword to GCC +Author: Kai-Chung Yan +Forwarded: not-needed +--- a/system/core/adb/sysdeps.h ++++ b/system/core/adb/sysdeps.h +@@ -40,11 +40,12 @@ + #include "sysdeps/network.h" + #include "sysdeps/stat.h" + ++#define _Nonnull ++#define _Nullable ++ + #ifdef _WIN32 + + // Clang-only nullability specifiers +-#define _Nonnull +-#define _Nullable + + #include + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Vector-cast.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Vector-cast.patch new file mode 100644 index 0000000000..b32d5f6f54 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/Vector-cast.patch @@ -0,0 +1,14 @@ +Description: Fix the weird error by GCC7 that fails to match the correct parent method. +Author: Kai-Chung Yan +Forwarded: not-needed +--- a/system/core/libutils/include/utils/Vector.h ++++ b/system/core/libutils/include/utils/Vector.h +@@ -256,7 +256,7 @@ + + template inline + const Vector& Vector::operator = (const Vector& rhs) const { +- VectorImpl::operator = (static_cast(rhs)); ++ VectorImpl::operator = (rhs); + return *this; + } + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/add-missing-headers.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/add-missing-headers.patch new file mode 100644 index 0000000000..49d3ecefbb --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/add-missing-headers.patch @@ -0,0 +1,41 @@ +Forwarded: not-needed +--- a/system/core/fs_mgr/liblp/reader.cpp ++++ b/system/core/fs_mgr/liblp/reader.cpp +@@ -22,6 +22,7 @@ + #include + + #include ++#include + + #include + #include +--- a/system/core/fs_mgr/liblp/writer.cpp ++++ b/system/core/fs_mgr/liblp/writer.cpp +@@ -21,6 +21,7 @@ + #include + + #include ++#include + + #include + #include +--- a/system/core/liblog/logger_write.cpp ++++ b/system/core/liblog/logger_write.cpp +@@ -27,6 +27,7 @@ + #include + #endif + ++#include + #include + + #include +--- a/system/core/libziparchive/zip_archive_stream_entry.cc ++++ b/system/core/libziparchive/zip_archive_stream_entry.cc +@@ -23,6 +23,7 @@ + #include + #include + ++#include + #include + #include + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-attribute-issue-with-gcc.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-attribute-issue-with-gcc.patch new file mode 100644 index 0000000000..e0b4275579 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-attribute-issue-with-gcc.patch @@ -0,0 +1,17 @@ +Description: remove clang-ism +Forwarded: not-needed + +--- a/system/core/base/include/android-base/logging.h ++++ b/system/core/base/include/android-base/logging.h +@@ -451,10 +451,7 @@ + // -Wno-user-defined-warnings to CPPFLAGS. + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wgcc-compat" +-#define OSTREAM_STRING_POINTER_USAGE_WARNING \ +- __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) +-inline OSTREAM_STRING_POINTER_USAGE_WARNING +-std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { ++inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { + return stream << static_cast(string_pointer); + } + #pragma clang diagnostic pop diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-build-on-non-x86.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-build-on-non-x86.patch new file mode 100644 index 0000000000..98a5078244 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-build-on-non-x86.patch @@ -0,0 +1,24 @@ +Description: non-x86 arches do not have PAGE_SIZE +Forwarded: not-needed +--- a/system/core/base/cmsg.cpp ++++ b/system/core/base/cmsg.cpp +@@ -33,7 +33,8 @@ + const std::vector& fds) { + size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); + size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); +- if (cmsg_space >= PAGE_SIZE) { ++ size_t pagesize = static_cast(sysconf(_SC_PAGE_SIZE)); ++ if (cmsg_space >= pagesize) { + errno = ENOMEM; + return -1; + } +@@ -75,7 +76,8 @@ + fds->clear(); + + size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds); +- if (cmsg_space >= PAGE_SIZE) { ++ size_t pagesize = static_cast(sysconf(_SC_PAGE_SIZE)); ++ if (cmsg_space >= pagesize) { + errno = ENOMEM; + return -1; + } diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-gettid-exception-declaration.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-gettid-exception-declaration.patch new file mode 100644 index 0000000000..7fd228bff6 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-gettid-exception-declaration.patch @@ -0,0 +1,24 @@ +Description: get libcutils building +Forwarded: not-needed +--- a/system/core/libcutils/include/cutils/threads.h ++++ b/system/core/libcutils/include/cutils/threads.h +@@ -33,7 +33,7 @@ + // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. + // + +-extern pid_t gettid(); ++extern pid_t gettid(void) __THROW; + + // + // Deprecated: use `_Thread_local` in C or `thread_local` in C++. +--- a/system/core/libcutils/threads.cpp ++++ b/system/core/libcutils/threads.cpp +@@ -33,7 +33,7 @@ + + // No definition needed for Android because we'll just pick up bionic's copy. + #ifndef __ANDROID__ +-pid_t gettid() { ++pid_t gettid(void) __THROW { + #if defined(__APPLE__) + uint64_t tid; + pthread_threadid_np(NULL, &tid); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-standard-namespace-errors.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-standard-namespace-errors.patch new file mode 100644 index 0000000000..e41a3576ae --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/fix-standard-namespace-errors.patch @@ -0,0 +1,22 @@ +Description: Add missing 'std::' scope identifiers. +Forwarded: not-needed +--- a/system/core/libunwindstack/include/unwindstack/DwarfMemory.h ++++ b/system/core/libunwindstack/include/unwindstack/DwarfMemory.h +@@ -29,7 +29,7 @@ + DwarfMemory(Memory* memory) : memory_(memory) {} + virtual ~DwarfMemory() = default; + +- bool ReadBytes(void* dst, size_t num_bytes); ++ bool ReadBytes(void* dst, std::size_t num_bytes); + + template + bool ReadSigned(uint64_t* value); +@@ -39,7 +39,7 @@ + bool ReadSLEB128(int64_t* value); + + template +- size_t GetEncodedSize(uint8_t encoding); ++ std::size_t GetEncodedSize(uint8_t encoding); + + bool AdjustEncodedValue(uint8_t encoding, uint64_t* value); + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/hard-code-build-number.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/hard-code-build-number.patch new file mode 100644 index 0000000000..2a332eb689 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/hard-code-build-number.patch @@ -0,0 +1,44 @@ +Description: just hard code rather than deal with circular deps +Forwarded: not-needed +--- a/system/core/adb/adb.cpp ++++ b/system/core/adb/adb.cpp +@@ -44,8 +44,6 @@ + #include + #include + #include +-#include +-#include + + #include "adb_auth.h" + #include "adb_io.h" +@@ -69,7 +67,7 @@ + "Version %s-%s\n" + "Installed as %s\n", + ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, +- PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(), ++ PLATFORM_TOOLS_VERSION, "debian", + android::base::GetExecutablePath().c_str()); + } + +--- a/system/core/fastboot/fastboot.cpp ++++ b/system/core/fastboot/fastboot.cpp +@@ -59,10 +59,8 @@ + #include + #include + #include +-#include + #include + #include +-#include + #include + #include + +@@ -1680,7 +1678,7 @@ + setvbuf(stdout, nullptr, _IONBF, 0); + setvbuf(stderr, nullptr, _IONBF, 0); + } else if (name == "version") { +- fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str()); ++ fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, "debian"); + fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str()); + return 0; + #if !defined(_WIN32) diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/libusb-header-path.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/libusb-header-path.patch new file mode 100644 index 0000000000..1663aae465 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/libusb-header-path.patch @@ -0,0 +1,16 @@ +Description: libusb.h comes from different location +Author: Umang Parmar +Forwarded: not-needed +Last-Update: 2018-05-26 + +--- a/system/core/adb/client/usb_libusb.cpp ++++ b/system/core/adb/client/usb_libusb.cpp +@@ -30,7 +30,7 @@ + #include + #include + +-#include ++#include + + #include + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/move-log-file-to-proper-dir.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/move-log-file-to-proper-dir.patch new file mode 100644 index 0000000000..006564b024 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/move-log-file-to-proper-dir.patch @@ -0,0 +1,18 @@ +Description: Update log file directory. +Author: Umang Parmar +Last Updated: 2018-05-17 + +--- a/system/core/adb/adb_utils.cpp ++++ b/system/core/adb/adb_utils.cpp +@@ -339,6 +339,11 @@ + + return temp_path_utf8 + log_name; + #else ++ std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid()); ++ struct stat st = {0}; ++ if (stat(log_dir.c_str(), &st) == 0) { ++ return log_dir; ++ } + const char* tmp_dir = getenv("TMPDIR"); + if (tmp_dir == nullptr) tmp_dir = "/tmp"; + return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid()); diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/simg_dump-python3.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/simg_dump-python3.patch new file mode 100644 index 0000000000..e6933ef145 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/simg_dump-python3.patch @@ -0,0 +1,62 @@ +Description: Port simg_dump to Python 3. +Author: Antonio Russo +Forwarded: not-needed +Last-Update: 2019-01-05 +Origin: https://bugs.debian.org/945646 + +--- +Index: android-platform-tools/system/core/libsparse/simg_dump.py +=================================================================== +--- android-platform-tools.orig/system/core/libsparse/simg_dump.py ++++ android-platform-tools/system/core/libsparse/simg_dump.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + + # Copyright (C) 2012 The Android Open Source Project + # +@@ -14,7 +14,7 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + +-from __future__ import print_function ++ + import csv + import getopt + import hashlib +@@ -47,7 +47,7 @@ def main(): + opts, args = getopt.getopt(sys.argv[1:], + "vsc:", + ["verbose", "showhash", "csvfile"]) +- except getopt.GetoptError, e: ++ except getopt.GetoptError as e: + print(e) + usage(me) + for o, a in opts: +@@ -66,7 +66,7 @@ def main(): + usage(me) + + if csvfilename: +- csvfile = open(csvfilename, "wb") ++ csvfile = open(csvfilename, "w", newline='') + csvwriter = csv.writer(csvfile) + + output = verbose or csvfilename or showhash +@@ -121,7 +121,7 @@ def main(): + "output offset", "output blocks", "type", "hash"]) + + offset = 0 +- for i in xrange(1, total_chunks + 1): ++ for i in range(1, total_chunks + 1): + header_bin = FH.read(12) + header = struct.unpack("<2H2I", header_bin) + chunk_type = header[0] +@@ -160,7 +160,7 @@ def main(): + if showhash: + h = hashlib.sha1() + data = fill_bin * (blk_sz / 4); +- for block in xrange(chunk_sz): ++ for block in range(chunk_sz): + h.update(data) + curhash = h.hexdigest() + elif chunk_type == 0xCAC3: diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stdatomic.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stdatomic.patch new file mode 100644 index 0000000000..ea3711dfa2 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stdatomic.patch @@ -0,0 +1,64 @@ +Description: Fix incompatibility between and + This 2 headers combined will cause errors for both GCC and Clang. This patch + makes sure only one of them is present at any time. +Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 +Bug: https://reviews.llvm.org/D45470 +--- a/system/core/libcutils/include/cutils/trace.h ++++ b/system/core/libcutils/include/cutils/trace.h +@@ -18,7 +18,14 @@ + #define _LIBS_CUTILS_TRACE_H + + #include ++#ifdef __cplusplus ++#include ++using std::atomic_bool; ++using std::atomic_load_explicit; ++using std::memory_order_acquire; ++#else + #include ++#endif + #include + #include + #include +--- a/system/core/libcutils/include/cutils/atomic.h ++++ b/system/core/libcutils/include/cutils/atomic.h +@@ -19,7 +19,23 @@ + + #include + #include ++#ifdef __cplusplus ++#include ++using std::atomic_compare_exchange_strong_explicit; ++using std::atomic_fetch_add_explicit; ++using std::atomic_fetch_or_explicit; ++using std::atomic_fetch_sub_explicit; ++using std::atomic_int_least32_t; ++using std::atomic_load_explicit; ++using std::atomic_store_explicit; ++using std::atomic_thread_fence; ++using std::memory_order::memory_order_acquire; ++using std::memory_order::memory_order_relaxed; ++using std::memory_order::memory_order_release; ++using std::memory_order::memory_order_seq_cst; ++#else + #include ++#endif + + #ifndef ANDROID_ATOMIC_INLINE + #define ANDROID_ATOMIC_INLINE static inline +--- a/system/core/liblog/logger.h ++++ b/system/core/liblog/logger.h +@@ -16,7 +16,13 @@ + + #pragma once + ++#ifdef __cplusplus ++#include ++using std::atomic_int; ++using std::atomic_uintptr_t; ++#else + #include ++#endif + #include + + #include diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stub-out-fastdeploy.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stub-out-fastdeploy.patch new file mode 100644 index 0000000000..d2426a781d --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/stub-out-fastdeploy.patch @@ -0,0 +1,93 @@ +Description: Defer packaging fastdeploy with adb for 29.x.x tags. +Forwarded: not-needed +--- a/system/core/adb/client/commandline.cpp ++++ b/system/core/adb/client/commandline.cpp +@@ -59,7 +59,6 @@ + #include "bugreport.h" + #include "client/file_sync_client.h" + #include "commandline.h" +-#include "fastdeploy.h" + #include "services.h" + #include "shell_protocol.h" + #include "sysdeps/chrono.h" +--- a/system/core/adb/client/adb_install.cpp ++++ b/system/core/adb/client/adb_install.cpp +@@ -35,7 +35,6 @@ + #include "adb_utils.h" + #include "client/file_sync_client.h" + #include "commandline.h" +-#include "fastdeploy.h" + + static constexpr int kFastDeployMinApi = 24; + +@@ -167,14 +166,6 @@ + } + + if (use_fastdeploy) { +- auto metadata = extract_metadata(file); +- if (metadata.has_value()) { +- // pass all but 1st (command) and last (apk path) parameters through to pm for +- // session creation +- std::vector pm_args{argv + 1, argv + argc - 1}; +- auto patchFd = install_patch(pm_args.size(), pm_args.data()); +- return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); +- } + } + + struct stat sb; +@@ -267,16 +258,6 @@ + argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ + + if (use_fastdeploy) { +- auto metadata = extract_metadata(apk_file[0]); +- if (metadata.has_value()) { +- auto patchFd = apply_patch_on_device(apk_dest.c_str()); +- int status = stream_patch(apk_file[0], std::move(metadata.value()), std::move(patchFd)); +- +- result = pm_command(argc, argv); +- delete_device_file(apk_dest); +- +- return status; +- } + } + + if (do_sync_push(apk_file, apk_dest.c_str(), false)) { +@@ -292,7 +273,6 @@ + InstallMode installMode = INSTALL_DEFAULT; + bool use_fastdeploy = false; + bool is_reinstall = false; +- FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; + + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--streaming")) { +@@ -313,13 +293,10 @@ + use_fastdeploy = false; + } else if (!strcmp(argv[i], "--force-agent")) { + processedArgIndicies.push_back(i); +- agent_update_strategy = FastDeploy_AgentUpdateAlways; + } else if (!strcmp(argv[i], "--date-check-agent")) { + processedArgIndicies.push_back(i); +- agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; + } else if (!strcmp(argv[i], "--version-check-agent")) { + processedArgIndicies.push_back(i); +- agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; + } + } + +@@ -331,13 +308,11 @@ + error_exit("Attempting to use streaming install on unsupported device"); + } + +- if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { +- printf("Fast Deploy is only compatible with devices of API version %d or higher, " +- "ignoring.\n", +- kFastDeployMinApi); ++ if (use_fastdeploy) { ++ printf("Fast Deploy is unavailable in this build of adb, " ++ "ignoring.\n"); + use_fastdeploy = false; + } +- fastdeploy_set_agent_update_strategy(agent_update_strategy); + + std::vector passthrough_argv; + for (int i = 0; i < argc; i++) { diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/throw-exception-on-unknown-os.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/throw-exception-on-unknown-os.patch new file mode 100644 index 0000000000..6b07f17bfc --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/throw-exception-on-unknown-os.patch @@ -0,0 +1,16 @@ +Description: Turn #error into exceptions + So the library can be built on non-Linux platforms too, although can't + guarauntee its functionality regarding that piece of code. +Forwarded: not-needed +--- a/system/core/base/file.cpp ++++ b/system/core/base/file.cpp +@@ -422,7 +422,8 @@ + path[PATH_MAX - 1] = 0; + return path; + #else +-#error unknown OS ++#include ++ throw std::runtime_error(std::string("Unknown OS!")); + #endif + } + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/throw-exception-on-unknown-os.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/throw-exception-on-unknown-os.patch new file mode 100644 index 0000000000..6b07f17bfc --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/throw-exception-on-unknown-os.patch @@ -0,0 +1,16 @@ +Description: Turn #error into exceptions + So the library can be built on non-Linux platforms too, although can't + guarauntee its functionality regarding that piece of code. +Forwarded: not-needed +--- a/system/core/base/file.cpp ++++ b/system/core/base/file.cpp +@@ -422,7 +422,8 @@ + path[PATH_MAX - 1] = 0; + return path; + #else +-#error unknown OS ++#include ++ throw std::runtime_error(std::string("Unknown OS!")); + #endif + } + diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch deleted file mode 100644 index 668338d8b3..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libcrypto_utils_mk_change_out_dir.patch +++ /dev/null @@ -1,39 +0,0 @@ -libcrypto_utils.mk: modifications to make it build in yocto environment - -Adding an include file that is setting the common flags. -Changed the cppflag to include the headers from other components -of android-tools - -Modified LDflags so that the libraries that are coming from other android-tools -are searched in the output folder. - -Modified the build rule so that it outputs the binary and header to the OUT_DIR - -Signed-off-by: Nisha Parrakat - ---- git/debian/libcrypto_utils.mk 2021-04-30 14:18:54.071379767 +0200 -+++ git/debian/libcrypto_utils.mk 2021-04-30 14:22:46.179047308 +0200 -@@ -1,15 +1,17 @@ -+include ../../rules_yocto.mk - NAME:= libcrypto_utils - SOURCES := android_pubkey.c - SOURCES := $(foreach source, $(SOURCES), libcrypto_utils/$(source)) --CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -+CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -I$(OUT_DIR)/usr/include - LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -- -lcrypto -Wl,-z,defs -+ -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ -+ -l:libcrypto.so.0 -Wl,-z,defs - - build: $(SOURCES) -- $(CC) $^ -o $(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) -- ln -s $(NAME).so.0 $(NAME).so -+ $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) -+ ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so -+ cp -r libcrypto_utils/include/* $(OUT_DIR)/usr/include/ - - clean: -- $(RM) $(NAME).so* -+ $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch deleted file mode 100644 index cc1a8cb954..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch +++ /dev/null @@ -1,14 +0,0 @@ -Description: Fixes "20150704-CVE-2015-3239" -Index: pkg-libunwind/include/dwarf_i.h -=================================================================== ---- pkg-libunwind.orig/include/dwarf_i.h 2015-07-04 10:57:29.000000000 +0900 -+++ pkg-libunwind/include/dwarf_i.h 2015-07-04 11:06:08.675616821 +0900 -@@ -20,7 +20,7 @@ - extern const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH]; - /* REG is evaluated multiple times; it better be side-effects free! */ - # define dwarf_to_unw_regnum(reg) \ -- (((reg) <= DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0) -+ (((reg) < DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0) - #endif - - #ifdef UNW_LOCAL_ONLY diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch deleted file mode 100644 index 8d78faac14..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/legacy_built-in_sync_functions.patch +++ /dev/null @@ -1,25 +0,0 @@ -Description: Replace the legacy __sync built-in functions with __atomic ones - libunwind uses the built-in __sync_* functions which are deprecated by GCC and - should be replaced by __atomic_* ones. See the official manuals [1]. - . - The legacy __sync functions do not require to specify the memory order but - __atomic ones do, so we choose the strongest one: __ATOMIC_SEQ_CST. - . - We do this because __sync_fetch_and_add() is not supported on armel. - . - [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html -Author: Kai-Chung Yan () -Last-Update: 2016-10-04 ---- a/include/libunwind_i.h -+++ b/include/libunwind_i.h -@@ -155,8 +155,8 @@ - u.vp = addr; - return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new); - } --# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1) --# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value) -+# define fetch_and_add1(_ptr) __atomic_fetch_add(_ptr, 1, __ATOMIC_SEQ_CST) -+# define fetch_and_add(_ptr, value) __atomic_fetch_add(_ptr, value, __ATOMIC_SEQ_CST) - # define HAVE_CMPXCHG - # define HAVE_FETCH_AND_ADD - #endif diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/series b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/series deleted file mode 100644 index 9cac341b68..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/series +++ /dev/null @@ -1,3 +0,0 @@ -user_pt_regs.patch -legacy_built-in_sync_functions.patch -20150704-CVE-2015-3239_dwarf_i.h.patch diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/user_pt_regs.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/user_pt_regs.patch deleted file mode 100644 index 8051b6d185..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/libunwind-debian/user_pt_regs.patch +++ /dev/null @@ -1,23 +0,0 @@ -Author: Kai-Chung Yan -Last-Update: 2016-08-24 -Description: Manual definition of struct user_pt_regs - On ARM64, libunwind uses struct user_pt_regs which is not defined in - anywhere, which causes FTBFS. ---- a/src/ptrace/_UPT_access_reg.c -+++ b/src/ptrace/_UPT_access_reg.c -@@ -26,6 +26,15 @@ - - #include "_UPT_internal.h" - -+#if defined(__aarch64__) -+ struct user_pt_regs { -+ __u64 regs[31]; -+ __u64 sp; -+ __u64 pc; -+ __u64 pstate; -+ }; -+#endif -+ - #if UNW_TARGET_IA64 - # include - # ifdef HAVE_ASM_PTRACE_OFFSETS_H diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/remount b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/remount new file mode 100644 index 0000000000..751c3501ef --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/remount @@ -0,0 +1,2 @@ +#!/bin/sh +mount -o remount,rw / diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/rules_yocto.mk b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/rules_yocto.mk index 5e217f47fc..2c808d3c1e 100644 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/rules_yocto.mk +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/rules_yocto.mk @@ -1,4 +1 @@ CPPFLAGS += -fPIC -ifndef OUT_DIR -OUT_DIR = ../../debian/out -endif diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_10.0.0.r36.bb b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_10.0.0.r36.bb deleted file mode 100644 index 236d0c3d16..0000000000 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_10.0.0.r36.bb +++ /dev/null @@ -1,231 +0,0 @@ -DESCRIPTION = "Different utilities from Android" -SECTION = "console/utils" -LICENSE = "Apache-2.0 & GPL-2.0-only & BSD-2-Clause & BSD-3-Clause" -LIC_FILES_CHKSUM = " \ - file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ - file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ - file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \ - file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ -" -DEPENDS = "libbsd libpcre zlib libcap libusb squashfs-tools p7zip libselinux" - -ANDROID_MIRROR = "android.googlesource.com" - -# matches with 10.0.0+r36 -SRCREV_boringssl = "ae2dd49c7cb74d04bdba7c1c9bd62c1e9cdf98f6" -SRCREV_core = "5aa13b053182b758d7a19db0c83e1b9b5bf1ec2e" -SRCREV_extras = "d31740f9d0399f8b938e88e58843d966e1cccab6" -SRCREV_libhardware = "c6925520342a7d37758f85eb1cf3baa20a7b7a18" -SRCREV_build = "28768b3120f751583a2743101b892f210d4715cf" -SRCREV_libunwind = "03a963ecf6ea836b38b3537cbcda0ecfd7a77393" - -SRC_URI = " \ - git://salsa.debian.org/android-tools-team/android-platform-external-boringssl;name=boringssl;protocol=https;nobranch=1;destsuffix=git/external/boringssl \ - git://salsa.debian.org/android-tools-team/android-platform-system-core;name=core;protocol=https;nobranch=1;destsuffix=git/system/core \ - git://salsa.debian.org/android-tools-team/android-platform-system-extras;name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \ - git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \ - git://salsa.debian.org/android-tools-team/android-platform-build.git;name=build;protocol=https;nobranch=1;destsuffix=git/build \ - git://salsa.debian.org/android-tools-team/android-platform-external-libunwind.git;protocol=https;name=libunwind;nobranch=1;destsuffix=git/external/libunwind \ -" - -# Patches copied from android-platform-system-core/debian/patches -# and applied in the order defined by the "series" file -SRC_URI += " \ - file://core-debian/move-log-file-to-proper-dir.patch;patchdir=system/core \ - file://core-debian/Added-missing-headers.patch;patchdir=system/core \ - file://core-debian/libusb-header-path.patch;patchdir=system/core \ - file://core-debian/stdatomic.patch;patchdir=system/core \ - file://core-debian/Nonnull.patch;patchdir=system/core \ - file://core-debian/Vector-cast.patch;patchdir=system/core \ - file://core-debian/use-Python-3-for-mkbootimg.patch;patchdir=system/core \ - file://core-debian/throw-exception-on-unknown-os.patch;patchdir=system/core \ - file://core-debian/simg_dump-python3.patch;patchdir=system/core \ - file://core-debian/fix-attribute-issue-with-gcc.patch;patchdir=system/core \ - file://core-debian/workaround-error-expected-primary-expression-before-.-token.patch;patchdir=system/core \ - file://core-debian/fix-gettid-exception-declaration.patch;patchdir=system/core \ - file://core-debian/fix-build-on-non-x86.patch;patchdir=system/core \ - file://core-debian/add-missing-headers.patch;patchdir=system/core \ - file://core-debian/hard-code-build-number.patch;patchdir=system/core \ - file://core-debian/fix-gcc-11-ftbfs.patch;patchdir=system/core \ - file://core-debian/fix-gnu-hurd.patch;patchdir=system/core \ -" - -# Patches copied from android-platform-external-libunwind/debian/patches -# and applied in the order defined by the "series" file -SRC_URI += " \ - file://libunwind-debian/user_pt_regs.patch;patchdir=external/libunwind \ - file://libunwind-debian/legacy_built-in_sync_functions.patch;patchdir=external/libunwind \ - file://libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch;patchdir=external/libunwind \ -" - -# meta-openembedded specific patches + files: -SRC_URI += " \ - file://core/0001-patching-adb.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ - file://core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \ - file://core/0003-socket.h-removing-dependency-of-gtest.patch;patchdir=system/core \ - file://core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ - file://core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch;patchdir=system/core \ - file://core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch;patchdir=system/core \ - file://core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch;patchdir=system/core \ - file://core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \ - file://core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ - file://core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ - file://core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ - file://core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ - file://core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch;patchdir=system/core \ - file://core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch;patchdir=system/core \ - file://core/0015-Use-namespace-std-to-compile-libbacktrace.patch;patchdir=system/core \ - file://core/0016-Adapt-adbd-to-work-with-yocto.patch;patchdir=system/core \ - file://core/0017-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch;patchdir=system/core \ - file://core/0018-img2simg-Fix-wrong-rpath.patch;patchdir=system/core \ - file://core/0019-Fix-compilation-with-gcc.patch;patchdir=system/core \ - file://core/0020-adb-Fix-build-on-big-endian-systems.patch;patchdir=system/core \ - file://core/0021-adb-Allow-adbd-to-be-run-as-root.patch;patchdir=system/core \ - file://0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch;patchdir=external/boringssl \ - file://0001-patching-libundwind-to-build-in-yocto-environment.patch;patchdir=external/libunwind \ - file://0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch;patchdir=system/extras \ - file://0002-libfec-change-out_dir-in-makefile.patch;patchdir=system/extras \ - file://rules_yocto.mk;subdir=git \ - file://android-tools-adbd.service \ - file://adbd.mk;subdir=git/system/core/debian \ -" - -S = "${WORKDIR}/git" -B = "${WORKDIR}/${BPN}" - -# http://errors.yoctoproject.org/Errors/Details/1debian881/ -ARM_INSTRUCTION_SET:armv4 = "arm" -ARM_INSTRUCTION_SET:armv5 = "arm" - -COMPATIBLE_HOST:powerpc = "(null)" -COMPATIBLE_HOST:powerpc64 = "(null)" -COMPATIBLE_HOST:powerpc64le = "(null)" - -inherit systemd - -SYSTEMD_SERVICE:${PN} = "android-tools-adbd.service" - -# Find libbsd headers during native builds -CC:append:class-native = " -I${STAGING_INCDIR}" -CC:append:class-nativesdk = " -I${STAGING_INCDIR}" - -PREREQUISITE_core = "libbase libsparse liblog libcutils" -TOOLS_TO_BUILD = "libcrypto_utils libadb libziparchive fastboot adb img2simg simg2img libbacktrace" -TOOLS_TO_BUILD:append:class-target = " adbd" - -do_compile() { - - case "${HOST_ARCH}" in - arm) - export android_arch=linux-arm - cpu=arm - deb_host_arch=arm - ;; - aarch64) - export android_arch=linux-arm64 - cpu=arm64 - deb_host_arch=arm64 - ;; - riscv64) - export android_arch=linux-riscv64 - ;; - mips|mipsel) - export android_arch=linux-mips - cpu=mips - deb_host_arch=mips - ;; - mips64|mips64el) - export android_arch=linux-mips64 - cpu=mips64 - deb_host_arch=mips64 - ;; - powerpc|powerpc64) - export android_arch=linux-ppc - ;; - i586|i686|x86_64) - export android_arch=linux-x86 - cpu=x86_64 - deb_host_arch=amd64 - ;; - esac - - export SRCDIR=${S} - - oe_runmake -f ${S}/external/boringssl/debian/libcrypto.mk -C ${S}/external/boringssl - oe_runmake -f ${S}/external/libunwind/debian/libunwind.mk -C ${S}/external/libunwind CPU=${cpu} - - for tool in ${PREREQUISITE_core}; do - oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core - done - - for i in `find ${S}/system/extras/debian/ -name "*.mk"`; do - oe_runmake -f $i -C ${S}/system/extras - done - - for tool in ${TOOLS_TO_BUILD}; do - if [ "$tool" = "libbacktrace" ]; then - oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core DEB_HOST_ARCH=${deb_host_arch} - else - oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core - fi - done - -} - -do_install() { - for tool in img2simg simg2img fastboot; do - if echo ${TOOLS_TO_BUILD} | grep -q "$tool" ; then - install -D -p -m0755 ${S}/debian/out/usr/bin/$tool ${D}${bindir}/$tool - fi - done - - if echo ${TOOLS_TO_BUILD} | grep -q "adb " ; then - install -d ${D}${bindir} - install -m0755 ${S}/debian/out/usr/lib/android/adb/adb ${D}${bindir} - fi - - if echo ${TOOLS_TO_BUILD} | grep -q "adbd" ; then - install -d ${D}${bindir} - install -m0755 ${B}/adbd/adbd ${D}${bindir} - fi - - # Outside the if statement to avoid errors during do_package - install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ - ${D}${systemd_unitdir}/system/android-tools-adbd.service - - install -d ${D}${libdir}/android/ - install -m0755 ${S}/debian/out/usr/lib/android/*.so.* ${D}${libdir}/android/ - if echo ${TOOLS_TO_BUILD} | grep -q "mkbootimg" ; then - install -d ${D}${bindir} - install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} - fi -} - -PACKAGES =+ "${PN}-fstools ${PN}-adbd" - -RDEPENDS:${BPN} = "${BPN}-conf p7zip" - -FILES:${PN}-adbd = "\ - ${bindir}/adbd \ - ${systemd_unitdir}/system/android-tools-adbd.service \ -" - -FILES:${PN}-fstools = "\ - ${bindir}/ext2simg \ - ${bindir}/ext4fixup \ - ${bindir}/img2simg \ - ${bindir}/make_ext4fs \ - ${bindir}/simg2img \ - ${bindir}/simg2simg \ - ${bindir}/simg_dump \ - ${bindir}/mkuserimg \ -" -FILES:${PN} += "${libdir}/android ${libdir}/android/*" - -BBCLASSEXTEND = "native" - -android_tools_enable_devmode() { - touch ${IMAGE_ROOTFS}/var/usb-debugging-enabled -} - -ROOTFS_POSTPROCESS_COMMAND_${PN}-adbd += "${@bb.utils.contains("USB_DEBUGGING_ENABLED", "1", "android_tools_enable_devmode;", "", d)}" diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb new file mode 100644 index 0000000000..75e837f49e --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb @@ -0,0 +1,194 @@ +DESCRIPTION = "Various utilities from Android" +SECTION = "console/utils" +LICENSE = "Apache-2.0 & GPL-2.0-only & BSD-2-Clause & BSD-3-Clause" +LIC_FILES_CHKSUM = " \ + file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ + file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ + file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \ + file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ +" +DEPENDS = "libbsd libpcre zlib libcap libusb squashfs-tools p7zip libselinux googletest" + +SRCREV_core = "abfd66fafcbb691d7860df059f1df1c9b1ef29da" + +SRC_URI = " \ + git://salsa.debian.org/android-tools-team/android-platform-tools;name=core;protocol=https;nobranch=1 \ +" + +# Patches copied from android-platform-tools/debian/patches +# and applied in the order defined by the file debian/patches/series +SRC_URI += " \ + file://debian/external/libunwind/user_pt_regs.patch \ + file://debian/external/libunwind/legacy_built-in_sync_functions.patch \ + file://debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch \ + \ + file://debian/system/core/move-log-file-to-proper-dir.patch \ + file://debian/system/core/Added-missing-headers.patch \ + file://debian/system/core/libusb-header-path.patch \ + file://debian/system/core/stdatomic.patch \ + file://debian/system/core/Nonnull.patch \ + file://debian/system/core/Vector-cast.patch \ + file://debian/system/core/throw-exception-on-unknown-os.patch \ + file://debian/system/core/simg_dump-python3.patch \ + file://debian/system/core/fix-attribute-issue-with-gcc.patch \ + file://debian/system/core/fix-gettid-exception-declaration.patch \ + file://debian/system/core/fix-build-on-non-x86.patch \ + file://debian/system/core/add-missing-headers.patch \ + file://debian/system/core/hard-code-build-number.patch \ + file://debian/system/core/stub-out-fastdeploy.patch \ + file://debian/system/core/fix-standard-namespace-errors.patch \ + file://debian/system/core/Add-riscv64-support.patch \ + \ +" + +# patches which don't come from debian +SRC_URI += " \ + file://rules_yocto.mk;subdir=git \ + file://android-tools-adbd.service \ + file://adbd.mk;subdir=git/debian/system/core \ + file://remount \ + file://0001-Fixes-for-yocto-build.patch \ + file://0002-android-tools-modifications-to-make-it-build-in-yoct.patch \ + file://0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch \ + file://0004-adb-Fix-build-on-big-endian-systems.patch \ + file://0005-adb-Allow-adbd-to-be-run-as-root.patch \ +" + +S = "${WORKDIR}/git" +B = "${WORKDIR}/${BPN}" + +# http://errors.yoctoproject.org/Errors/Details/1debian881/ +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" + +COMPATIBLE_HOST:powerpc = "(null)" +COMPATIBLE_HOST:powerpc64 = "(null)" +COMPATIBLE_HOST:powerpc64le = "(null)" + +inherit systemd + +SYSTEMD_SERVICE:${PN} = "android-tools-adbd.service" + +# Find libbsd headers during native builds +CC:append:class-native = " -I${STAGING_INCDIR}" +CC:append:class-nativesdk = " -I${STAGING_INCDIR}" + +PREREQUISITE_core = "liblog libbase libsparse liblog libcutils" +TOOLS_TO_BUILD = "libcrypto_utils libadb libziparchive fastboot adb img2simg simg2img libbacktrace" +TOOLS_TO_BUILD:append:class-target = " adbd" + +do_compile() { + + case "${HOST_ARCH}" in + arm) + export android_arch=linux-arm + cpu=arm + deb_host_arch=arm + ;; + aarch64) + export android_arch=linux-arm64 + cpu=arm64 + deb_host_arch=arm64 + ;; + riscv64) + export android_arch=linux-riscv64 + ;; + mips|mipsel) + export android_arch=linux-mips + cpu=mips + deb_host_arch=mips + ;; + mips64|mips64el) + export android_arch=linux-mips64 + cpu=mips64 + deb_host_arch=mips64 + ;; + powerpc|powerpc64) + export android_arch=linux-ppc + ;; + i586|i686|x86_64) + export android_arch=linux-x86 + cpu=x86_64 + deb_host_arch=amd64 + ;; + esac + + export SRCDIR=${S} + + oe_runmake -f ${S}/debian/external/boringssl/libcrypto.mk -C ${S} + oe_runmake -f ${S}/debian/external/libunwind/libunwind.mk -C ${S} CPU=${cpu} + + for tool in ${PREREQUISITE_core}; do + oe_runmake -f ${S}/debian/system/core/${tool}.mk -C ${S} + done + + for i in `find ${S}/debian/system/extras/ -name "*.mk"`; do + oe_runmake -f $i -C ${S} + done + + for tool in ${TOOLS_TO_BUILD}; do + if [ "$tool" = "libbacktrace" ]; then + oe_runmake -f ${S}/debian/system/core/${tool}.mk -C ${S} DEB_HOST_ARCH=${deb_host_arch} + else + oe_runmake -f ${S}/debian/system/core/${tool}.mk -C ${S} + fi + done + +} + +do_install() { + install -d ${D}${base_sbindir} + install -m 0755 ${S}/../remount -D ${D}${base_sbindir}/remount + + for tool in img2simg simg2img fastboot adbd; do + if echo ${TOOLS_TO_BUILD} | grep -q "$tool" ; then + install -D -p -m0755 ${S}/debian/out/system/core/$tool ${D}${bindir}/$tool + fi + done + + # grep adb also matches adbd, so handle adb separately from other tools + if echo ${TOOLS_TO_BUILD} | grep -q "adb " ; then + install -d ${D}${bindir} + install -m0755 ${S}/debian/out/system/core/adb ${D}${bindir} + fi + + # Outside the if statement to avoid errors during do_package + install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ + ${D}${systemd_unitdir}/system/android-tools-adbd.service + + install -d ${D}${libdir}/android/ + install -m0755 ${S}/debian/out/system/core/*.so.* ${D}${libdir}/android/ + if echo ${TOOLS_TO_BUILD} | grep -q "mkbootimg" ; then + install -d ${D}${bindir} + install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} + fi +} + +PACKAGES =+ "${PN}-fstools ${PN}-adbd" + +RDEPENDS:${BPN} = "${BPN}-conf p7zip" + +FILES:${PN}-adbd = "\ + ${bindir}/adbd \ + ${systemd_unitdir}/system/android-tools-adbd.service \ +" + +FILES:${PN}-fstools = "\ + ${bindir}/ext2simg \ + ${bindir}/ext4fixup \ + ${bindir}/img2simg \ + ${bindir}/make_ext4fs \ + ${bindir}/simg2img \ + ${bindir}/simg2simg \ + ${bindir}/simg_dump \ + ${bindir}/mkuserimg \ +" +FILES:${PN} += "${libdir}/android ${libdir}/android/*" + +BBCLASSEXTEND = "native" + +android_tools_enable_devmode() { + touch ${IMAGE_ROOTFS}/var/usb-debugging-enabled +} + +ROOTFS_POSTPROCESS_COMMAND_${PN}-adbd += "${@bb.utils.contains("USB_DEBUGGING_ENABLED", "1", "android_tools_enable_devmode;", "", d)}" -- cgit v1.2.3-54-g00ecf