diff options
75 files changed, 2857 insertions, 2084 deletions
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 @@ | |||
| 1 | DESCRIPTION = "Different utilities from Android - corressponding configuration files for using ConfigFS" | 1 | DESCRIPTION = "Various utilities from Android - corresponding configuration files for using ConfigFS" |
| 2 | SECTION = "console/utils" | 2 | SECTION = "console/utils" |
| 3 | LICENSE = "MIT" | 3 | LICENSE = "MIT" |
| 4 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | 4 | 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 @@ | |||
| 1 | From 5de85f8273c7284aa93e35c40f025d4d43d42df9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Thu, 16 Mar 2023 18:59:35 +0100 | ||
| 4 | Subject: [PATCH] Fixes for yocto build | ||
| 5 | |||
| 6 | Signed-off-by: JJ Robertson <jrobertson@snapchat.com> | ||
| 7 | [rebased on version 29] | ||
| 8 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 9 | |||
| 10 | --- | ||
| 11 | system/core/adb/daemon/file_sync_service.cpp | 4 ++-- | ||
| 12 | system/core/adb/daemon/framebuffer_service.h | 2 -- | ||
| 13 | system/core/adb/daemon/main.cpp | 5 +++-- | ||
| 14 | system/core/adb/daemon/restart_service.h | 2 -- | ||
| 15 | system/core/adb/daemon/services.cpp | 6 ++---- | ||
| 16 | system/core/adb/daemon/shell_service.cpp | 5 ++++- | ||
| 17 | system/core/adb/types.h | 1 + | ||
| 18 | 7 files changed, 12 insertions(+), 13 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/system/core/adb/daemon/file_sync_service.cpp b/system/core/adb/daemon/file_sync_service.cpp | ||
| 21 | index d6af7087..92e7087a 100644 | ||
| 22 | --- a/system/core/adb/daemon/file_sync_service.cpp | ||
| 23 | +++ b/system/core/adb/daemon/file_sync_service.cpp | ||
| 24 | @@ -111,7 +111,7 @@ static bool secure_mkdirs(const std::string& path) { | ||
| 25 | partial_path += path_component; | ||
| 26 | |||
| 27 | if (should_use_fs_config(partial_path)) { | ||
| 28 | - fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); | ||
| 29 | + // fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); | ||
| 30 | } | ||
| 31 | if (adb_mkdir(partial_path.c_str(), mode) == -1) { | ||
| 32 | if (errno != EEXIST) { | ||
| 33 | @@ -469,7 +469,7 @@ static bool do_send(int s, const std::string& spec, std::vector<char>& buffer) { | ||
| 34 | uint64_t capabilities = 0; | ||
| 35 | if (should_use_fs_config(path)) { | ||
| 36 | unsigned int broken_api_hack = mode; | ||
| 37 | - fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); | ||
| 38 | + // fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); | ||
| 39 | mode = broken_api_hack; | ||
| 40 | } | ||
| 41 | |||
| 42 | diff --git a/system/core/adb/daemon/framebuffer_service.h b/system/core/adb/daemon/framebuffer_service.h | ||
| 43 | index bab44be3..264da597 100644 | ||
| 44 | --- a/system/core/adb/daemon/framebuffer_service.h | ||
| 45 | +++ b/system/core/adb/daemon/framebuffer_service.h | ||
| 46 | @@ -18,6 +18,4 @@ | ||
| 47 | |||
| 48 | #include "adb_unique_fd.h" | ||
| 49 | |||
| 50 | -#if defined(__ANDROID__) | ||
| 51 | void framebuffer_service(unique_fd fd); | ||
| 52 | -#endif | ||
| 53 | diff --git a/system/core/adb/daemon/main.cpp b/system/core/adb/daemon/main.cpp | ||
| 54 | index 3322574c..e807d13d 100644 | ||
| 55 | --- a/system/core/adb/daemon/main.cpp | ||
| 56 | +++ b/system/core/adb/daemon/main.cpp | ||
| 57 | @@ -208,6 +208,9 @@ int adbd_main(int server_port) { | ||
| 58 | umask(0); | ||
| 59 | |||
| 60 | signal(SIGPIPE, SIG_IGN); | ||
| 61 | + signal(SIGINT, SIG_DFL); | ||
| 62 | + signal(SIGQUIT, SIG_DFL); | ||
| 63 | + | ||
| 64 | |||
| 65 | #if defined(__BIONIC__) | ||
| 66 | auto fdsan_level = android_fdsan_get_error_level(); | ||
| 67 | @@ -254,13 +257,11 @@ int adbd_main(int server_port) { | ||
| 68 | |||
| 69 | bool is_usb = false; | ||
| 70 | |||
| 71 | -#if defined(__ANDROID__) | ||
| 72 | if (access(USB_FFS_ADB_EP0, F_OK) == 0) { | ||
| 73 | // Listen on USB. | ||
| 74 | usb_init(); | ||
| 75 | is_usb = true; | ||
| 76 | } | ||
| 77 | -#endif | ||
| 78 | |||
| 79 | // If one of these properties is set, also listen on that port. | ||
| 80 | // If one of the properties isn't set and we couldn't listen on usb, listen | ||
| 81 | diff --git a/system/core/adb/daemon/restart_service.h b/system/core/adb/daemon/restart_service.h | ||
| 82 | index 19840bd5..7a97614b 100644 | ||
| 83 | --- a/system/core/adb/daemon/restart_service.h | ||
| 84 | +++ b/system/core/adb/daemon/restart_service.h | ||
| 85 | @@ -18,9 +18,7 @@ | ||
| 86 | |||
| 87 | #include "adb_unique_fd.h" | ||
| 88 | |||
| 89 | -#if defined(__ANDROID__) | ||
| 90 | void restart_root_service(unique_fd fd); | ||
| 91 | void restart_unroot_service(unique_fd fd); | ||
| 92 | void restart_tcp_service(unique_fd fd, int port); | ||
| 93 | void restart_usb_service(unique_fd fd); | ||
| 94 | -#endif | ||
| 95 | diff --git a/system/core/adb/daemon/services.cpp b/system/core/adb/daemon/services.cpp | ||
| 96 | index 4ec90d27..d8541c23 100644 | ||
| 97 | --- a/system/core/adb/daemon/services.cpp | ||
| 98 | +++ b/system/core/adb/daemon/services.cpp | ||
| 99 | @@ -156,7 +156,7 @@ static void spin_service(unique_fd fd) { | ||
| 100 | } | ||
| 101 | #endif | ||
| 102 | // Fall through | ||
| 103 | - std::string cmd = "/system/bin/reboot "; | ||
| 104 | + std::string cmd = "/sbin/reboot "; | ||
| 105 | cmd += name; | ||
| 106 | return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone); | ||
| 107 | } | ||
| 108 | @@ -265,11 +265,10 @@ unique_fd daemon_service_to_fd(std::string_view name, atransport* transport) { | ||
| 109 | } | ||
| 110 | #endif | ||
| 111 | |||
| 112 | -#if defined(__ANDROID__) | ||
| 113 | if (name.starts_with("framebuffer:")) { | ||
| 114 | return create_service_thread("fb", framebuffer_service); | ||
| 115 | } else if (android::base::ConsumePrefix(&name, "remount:")) { | ||
| 116 | - std::string cmd = "/system/bin/remount "; | ||
| 117 | + std::string cmd = "/sbin/remount "; | ||
| 118 | cmd += name; | ||
| 119 | return StartSubprocess(cmd, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone); | ||
| 120 | } else if (android::base::ConsumePrefix(&name, "reboot:")) { | ||
| 121 | @@ -303,7 +302,6 @@ unique_fd daemon_service_to_fd(std::string_view name, atransport* transport) { | ||
| 122 | } else if (name.starts_with("usb:")) { | ||
| 123 | return create_service_thread("usb", restart_usb_service); | ||
| 124 | } | ||
| 125 | -#endif | ||
| 126 | |||
| 127 | if (android::base::ConsumePrefix(&name, "dev:")) { | ||
| 128 | return unique_fd{unix_open(name, O_RDWR | O_CLOEXEC)}; | ||
| 129 | diff --git a/system/core/adb/daemon/shell_service.cpp b/system/core/adb/daemon/shell_service.cpp | ||
| 130 | index f62032d0..ebcfe18d 100644 | ||
| 131 | --- a/system/core/adb/daemon/shell_service.cpp | ||
| 132 | +++ b/system/core/adb/daemon/shell_service.cpp | ||
| 133 | @@ -273,13 +273,16 @@ bool Subprocess::ForkAndExec(std::string* error) { | ||
| 134 | env["HOSTNAME"] = GetHostName(); | ||
| 135 | env["LOGNAME"] = pw->pw_name; | ||
| 136 | env["SHELL"] = pw->pw_shell; | ||
| 137 | - env["TMPDIR"] = "/data/local/tmp"; | ||
| 138 | env["USER"] = pw->pw_name; | ||
| 139 | } | ||
| 140 | |||
| 141 | if (!terminal_type_.empty()) { | ||
| 142 | env["TERM"] = terminal_type_; | ||
| 143 | } | ||
| 144 | + if (env.find("PS1") == env.end()) { | ||
| 145 | + env["PS1"] = "\\h:\\w\\$ "; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | |||
| 149 | std::vector<std::string> joined_env; | ||
| 150 | for (const auto& it : env) { | ||
| 151 | diff --git a/system/core/adb/types.h b/system/core/adb/types.h | ||
| 152 | index c619fffc..f8e0f521 100644 | ||
| 153 | --- a/system/core/adb/types.h | ||
| 154 | +++ b/system/core/adb/types.h | ||
| 155 | @@ -22,6 +22,7 @@ | ||
| 156 | #include <memory> | ||
| 157 | #include <utility> | ||
| 158 | #include <vector> | ||
| 159 | +#include <string.h> | ||
| 160 | |||
| 161 | #include <android-base/logging.h> | ||
| 162 | |||
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 @@ | |||
| 1 | From 30193c177138551a9aa269ae249ed2800811b223 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:24:11 +0100 | ||
| 4 | Subject: [PATCH] libcrypto.mk: modifications to make it build in yocto | ||
| 5 | environment | ||
| 6 | |||
| 7 | Adding an include file that is setting the common flags. | ||
| 8 | |||
| 9 | Modified the build rule so that it outputs the binary and include | ||
| 10 | to the OUT_DIR | ||
| 11 | |||
| 12 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 13 | --- | ||
| 14 | debian/libcrypto.mk | 9 ++++++--- | ||
| 15 | 1 file changed, 6 insertions(+), 3 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/debian/libcrypto.mk b/debian/libcrypto.mk | ||
| 18 | index 4c0268e..8b41056 100644 | ||
| 19 | --- a/debian/libcrypto.mk | ||
| 20 | +++ b/debian/libcrypto.mk | ||
| 21 | @@ -1,3 +1,4 @@ | ||
| 22 | +include ../../rules_yocto.mk | ||
| 23 | include sources.mk | ||
| 24 | |||
| 25 | NAME = libcrypto | ||
| 26 | @@ -26,6 +27,8 @@ CPPFLAGS += -Isrc/include -Isrc/crypto | ||
| 27 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread | ||
| 28 | |||
| 29 | build: $(SOURCES) | ||
| 30 | - mkdir --parents debian/out | ||
| 31 | - $(CC) $^ -o debian/out/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 32 | - ln -s $(NAME).so.0 debian/out/$(NAME).so | ||
| 33 | \ No newline at end of file | ||
| 34 | + mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ | ||
| 35 | + mkdir --parents $(OUT_DIR)/usr/include | ||
| 36 | + $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DOPENSSL_NO_ASM | ||
| 37 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 38 | + cp -r include/openssl $(OUT_DIR)/usr/include | ||
| 39 | -- | ||
| 40 | 2.36.1.vfs.0.0 | ||
| 41 | |||
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 @@ | |||
| 1 | From e284ceac2b10133ca916bbae8055f040607b506c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:21:49 +0100 | ||
| 4 | Subject: [PATCH 1/2] libext4_utils.mk: modifications to make it build in yocto | ||
| 5 | environment | ||
| 6 | |||
| 7 | Adding an include file that is setting the common flags. | ||
| 8 | Changed the cppflag to include the headers from other components | ||
| 9 | of android-tools | ||
| 10 | |||
| 11 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 12 | are searched in the output folder. | ||
| 13 | |||
| 14 | Modified the build rule so that it outputs the binary and header to the OUT_DIR | ||
| 15 | |||
| 16 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 17 | --- | ||
| 18 | debian/libext4_utils.mk | 13 ++++++++----- | ||
| 19 | 1 file changed, 8 insertions(+), 5 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/debian/libext4_utils.mk b/debian/libext4_utils.mk | ||
| 22 | index 868e790..2e93158 100644 | ||
| 23 | --- a/debian/libext4_utils.mk | ||
| 24 | +++ b/debian/libext4_utils.mk | ||
| 25 | @@ -1,3 +1,4 @@ | ||
| 26 | +include ../../rules_yocto.mk | ||
| 27 | NAME = libext4_utils | ||
| 28 | |||
| 29 | ext4_utils_SOURCES := \ | ||
| 30 | @@ -17,14 +18,16 @@ CPPFLAGS += \ | ||
| 31 | -Iext4_utils/include \ | ||
| 32 | -Ilibfec/include \ | ||
| 33 | -Isquashfs_utils \ | ||
| 34 | - -I/usr/include/android \ | ||
| 35 | + -I/usr/include/android -I$(OUT_DIR)/usr/include \ | ||
| 36 | -D_GNU_SOURCE -DFEC_NO_KLOG -DSQUASHFS_NO_KLOG -D_LARGEFILE64_SOURCE | ||
| 37 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 38 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 39 | - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 40 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ | ||
| 41 | -lbase -lsparse -lselinux | ||
| 42 | |||
| 43 | build: $(SOURCES) | ||
| 44 | - mkdir --parents $(OUT_DIR) | ||
| 45 | - $(CC) $^ -o $(OUT_DIR)/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 46 | - ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so | ||
| 47 | + mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ | ||
| 48 | + $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 49 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 50 | + cp -r ext4_utils/include/* $(OUT_DIR)/usr/include/ | ||
| 51 | + | ||
| 52 | -- | ||
| 53 | 2.36.1.vfs.0.0 | ||
| 54 | |||
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 @@ | |||
| 1 | From d5fb34aef65b5c5472544e4f42ad777d8fa16ba9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:41:52 +0100 | ||
| 4 | Subject: [PATCH] patching libundwind to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Passing the architecture details($CPU)from the recipe. | ||
| 20 | |||
| 21 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 22 | |||
| 23 | Upstream-Status: Pending | ||
| 24 | --- | ||
| 25 | debian/libunwind.mk | 14 ++++++++------ | ||
| 26 | 1 file changed, 8 insertions(+), 6 deletions(-) | ||
| 27 | |||
| 28 | diff --git a/debian/libunwind.mk b/debian/libunwind.mk | ||
| 29 | index 738b205..ada4ef9 100644 | ||
| 30 | --- a/debian/libunwind.mk | ||
| 31 | +++ b/debian/libunwind.mk | ||
| 32 | @@ -1,4 +1,4 @@ | ||
| 33 | -include debian/detect_arch.mk | ||
| 34 | +include ../../rules_yocto.mk | ||
| 35 | |||
| 36 | ARCH_SOURCES = is_fpreg.c \ | ||
| 37 | regname.c \ | ||
| 38 | @@ -131,10 +131,12 @@ CFLAGS += -DHAVE_CONFIG_H -DNDEBUG -D_GNU_SOURCE -Werror -Wno-unused-parameter - | ||
| 39 | CPPFLAGS += -Iinclude -Isrc $($(CPU)_INCLUDES) -Idebian/include | ||
| 40 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 41 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 42 | - -lpthread -nostdlib -lc -lgcc -Ldebian/out -l7z | ||
| 43 | + -lpthread -nostdlib -lc -lgcc -l7z | ||
| 44 | |||
| 45 | build: $(SOURCES) | ||
| 46 | - mkdir --parents debian/out | ||
| 47 | - ln -s /usr/lib/p7zip/7z.so debian/out/lib7z.so | ||
| 48 | - $(CC) $^ -o debian/out/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 49 | - ln -s $(NAME).so.0 debian/out/$(NAME).so | ||
| 50 | + mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ | ||
| 51 | + mkdir --parents $(OUT_DIR)/usr/include/android/libunwind | ||
| 52 | + $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -Wno-header-guard -Wno-absolute-value | ||
| 53 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 54 | + cp -r include/* debian/include/* $(OUT_DIR)/usr/include/android/libunwind/ | ||
| 55 | + | ||
| 56 | -- | ||
| 57 | 2.36.1.vfs.0.0 | ||
| 58 | |||
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 @@ | |||
| 1 | From fe211cbc305a9316c1d4da2f086d6a50f1c92188 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 17 Mar 2023 10:33:11 +0100 | ||
| 4 | Subject: [PATCH] android-tools: modifications to make it build in yocto | ||
| 5 | |||
| 6 | - Fix relocation errors on aarch64, e.g.: | ||
| 7 | "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" | ||
| 8 | |||
| 9 | - use ln -f to avoid error "File exists" on incremental builds | ||
| 10 | |||
| 11 | - fix missing headers | ||
| 12 | |||
| 13 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 14 | |||
| 15 | --- | ||
| 16 | debian/external/boringssl/libcrypto.mk | 1 + | ||
| 17 | debian/system/core/append2simg.mk | 2 +- | ||
| 18 | debian/system/core/fastboot.mk | 2 +- | ||
| 19 | debian/system/core/img2simg.mk | 2 +- | ||
| 20 | debian/system/core/libbacktrace.mk | 8 ++++---- | ||
| 21 | debian/system/core/libbase.mk | 5 +++-- | ||
| 22 | debian/system/core/libcutils.mk | 5 +++-- | ||
| 23 | debian/system/core/liblog.mk | 3 ++- | ||
| 24 | debian/system/core/libsparse.mk | 5 +++-- | ||
| 25 | debian/system/core/libutils.mk | 2 +- | ||
| 26 | debian/system/core/libziparchive.mk | 5 +++-- | ||
| 27 | debian/system/core/simg2img.mk | 2 +- | ||
| 28 | debian/system/core/simg2simg.mk | 2 +- | ||
| 29 | frameworks/native/libs/adbd_auth/adbd_auth.cpp | 2 ++ | ||
| 30 | system/core/adb/adb_listeners.cpp | 12 ++++++------ | ||
| 31 | system/core/adb/transport_local.cpp | 2 +- | ||
| 32 | 16 files changed, 34 insertions(+), 26 deletions(-) | ||
| 33 | |||
| 34 | diff --git a/debian/external/boringssl/libcrypto.mk b/debian/external/boringssl/libcrypto.mk | ||
| 35 | index c0ea54f4..b3a77bfd 100644 | ||
| 36 | --- a/debian/external/boringssl/libcrypto.mk | ||
| 37 | +++ b/debian/external/boringssl/libcrypto.mk | ||
| 38 | @@ -27,6 +27,7 @@ CPPFLAGS += \ | ||
| 39 | -DBORINGSSL_IMPLEMENTATION \ | ||
| 40 | -DBORINGSSL_SHARED_LIBRARY \ | ||
| 41 | -DOPENSSL_SMALL \ | ||
| 42 | + -DOPENSSL_NO_ASM \ | ||
| 43 | -Iexternal/boringssl/src/crypto \ | ||
| 44 | -Iexternal/boringssl/src/include \ | ||
| 45 | |||
| 46 | diff --git a/debian/system/core/append2simg.mk b/debian/system/core/append2simg.mk | ||
| 47 | index 1599bdb8..598c751d 100644 | ||
| 48 | --- a/debian/system/core/append2simg.mk | ||
| 49 | +++ b/debian/system/core/append2simg.mk | ||
| 50 | @@ -11,7 +11,7 @@ CPPFLAGS += \ | ||
| 51 | |||
| 52 | LDFLAGS += \ | ||
| 53 | -Ldebian/out/system/core \ | ||
| 54 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 55 | + -Wl,-rpath='$$ORIGIN/../lib/android' \ | ||
| 56 | -lbase \ | ||
| 57 | -llog \ | ||
| 58 | -lpthread \ | ||
| 59 | diff --git a/debian/system/core/fastboot.mk b/debian/system/core/fastboot.mk | ||
| 60 | index d5c9a285..a59ba1a4 100644 | ||
| 61 | --- a/debian/system/core/fastboot.mk | ||
| 62 | +++ b/debian/system/core/fastboot.mk | ||
| 63 | @@ -49,7 +49,7 @@ CPPFLAGS += \ | ||
| 64 | |||
| 65 | LDFLAGS += \ | ||
| 66 | -Ldebian/out/system/core \ | ||
| 67 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 68 | + -Wl,-rpath='$$ORIGIN/../lib/android' \ | ||
| 69 | -fuse-ld=gold \ | ||
| 70 | -lbase \ | ||
| 71 | -lcutils \ | ||
| 72 | diff --git a/debian/system/core/img2simg.mk b/debian/system/core/img2simg.mk | ||
| 73 | index 11adf014..8baf5ba5 100644 | ||
| 74 | --- a/debian/system/core/img2simg.mk | ||
| 75 | +++ b/debian/system/core/img2simg.mk | ||
| 76 | @@ -11,7 +11,7 @@ CPPFLAGS += \ | ||
| 77 | |||
| 78 | LDFLAGS += \ | ||
| 79 | -Ldebian/out/system/core \ | ||
| 80 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 81 | + -Wl,-rpath='$$ORIGIN/../lib/android' \ | ||
| 82 | -lbase \ | ||
| 83 | -llog \ | ||
| 84 | -lpthread \ | ||
| 85 | diff --git a/debian/system/core/libbacktrace.mk b/debian/system/core/libbacktrace.mk | ||
| 86 | index e3411d76..86e69874 100644 | ||
| 87 | --- a/debian/system/core/libbacktrace.mk | ||
| 88 | +++ b/debian/system/core/libbacktrace.mk | ||
| 89 | @@ -1,3 +1,4 @@ | ||
| 90 | +include rules_yocto.mk | ||
| 91 | include /usr/share/dpkg/architecture.mk | ||
| 92 | |||
| 93 | NAME = libbacktrace | ||
| 94 | @@ -83,10 +84,9 @@ CPPFLAGS += \ | ||
| 95 | LDFLAGS += \ | ||
| 96 | -L/usr/lib/p7zip \ | ||
| 97 | -Ldebian/out/system/core \ | ||
| 98 | - -Wl,-rpath=/usr/lib/p7zip \ | ||
| 99 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 100 | + -Wl,-rpath='$$ORIGIN' \ | ||
| 101 | -Wl,-soname,$(NAME).so.0 \ | ||
| 102 | - -l:7z.so \ | ||
| 103 | + -l7z \ | ||
| 104 | -lbase \ | ||
| 105 | -llog \ | ||
| 106 | -lpthread \ | ||
| 107 | @@ -101,7 +101,7 @@ endif | ||
| 108 | build: $(OBJECTS_CXX) $(OBJECTS_ASSEMBLY) debian/out/external/libunwind/libunwind.a | ||
| 109 | mkdir -p debian/out/system/core | ||
| 110 | $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) | ||
| 111 | - cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so | ||
| 112 | + cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so | ||
| 113 | |||
| 114 | $(OBJECTS_CXX): %.o: %.cpp | ||
| 115 | $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) | ||
| 116 | diff --git a/debian/system/core/libbase.mk b/debian/system/core/libbase.mk | ||
| 117 | index d2b074ba..8a90d6de 100644 | ||
| 118 | --- a/debian/system/core/libbase.mk | ||
| 119 | +++ b/debian/system/core/libbase.mk | ||
| 120 | @@ -1,3 +1,4 @@ | ||
| 121 | +include rules_yocto.mk | ||
| 122 | NAME = libbase | ||
| 123 | |||
| 124 | SOURCES = \ | ||
| 125 | @@ -30,7 +31,7 @@ CPPFLAGS += \ | ||
| 126 | |||
| 127 | LDFLAGS += \ | ||
| 128 | -Ldebian/out/system/core \ | ||
| 129 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 130 | + -Wl,-rpath='$$ORIGIN' \ | ||
| 131 | -Wl,-soname,$(NAME).so.0 \ | ||
| 132 | -llog \ | ||
| 133 | -lpthread \ | ||
| 134 | @@ -44,7 +45,7 @@ endif | ||
| 135 | |||
| 136 | build: $(OBJECTS) | ||
| 137 | $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) | ||
| 138 | - cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so | ||
| 139 | + cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so | ||
| 140 | |||
| 141 | $(OBJECTS): %.o: %.cpp | ||
| 142 | $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) | ||
| 143 | diff --git a/debian/system/core/libcutils.mk b/debian/system/core/libcutils.mk | ||
| 144 | index 9d928b56..c22b0965 100644 | ||
| 145 | --- a/debian/system/core/libcutils.mk | ||
| 146 | +++ b/debian/system/core/libcutils.mk | ||
| 147 | @@ -1,3 +1,4 @@ | ||
| 148 | +include rules_yocto.mk | ||
| 149 | NAME = libcutils | ||
| 150 | |||
| 151 | libcutils_nonwindows_sources = \ | ||
| 152 | @@ -47,7 +48,7 @@ CPPFLAGS += \ | ||
| 153 | |||
| 154 | LDFLAGS += \ | ||
| 155 | -Ldebian/out/system/core \ | ||
| 156 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 157 | + -Wl,-rpath='$$ORIGIN' \ | ||
| 158 | -Wl,-soname,$(NAME).so.0 \ | ||
| 159 | -lbase \ | ||
| 160 | -llog \ | ||
| 161 | @@ -56,7 +57,7 @@ LDFLAGS += \ | ||
| 162 | |||
| 163 | build: $(OBJECTS_C) $(OBJECTS_CXX) | ||
| 164 | $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) | ||
| 165 | - cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so | ||
| 166 | + cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so | ||
| 167 | |||
| 168 | $(OBJECTS_C): %.o: %.c | ||
| 169 | $(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) | ||
| 170 | diff --git a/debian/system/core/liblog.mk b/debian/system/core/liblog.mk | ||
| 171 | index f8c3d7fe..34a07341 100644 | ||
| 172 | --- a/debian/system/core/liblog.mk | ||
| 173 | +++ b/debian/system/core/liblog.mk | ||
| 174 | @@ -1,3 +1,4 @@ | ||
| 175 | +include rules_yocto.mk | ||
| 176 | NAME = liblog | ||
| 177 | |||
| 178 | liblog_sources = \ | ||
| 179 | @@ -35,7 +36,7 @@ LDFLAGS += \ | ||
| 180 | build: $(OBJECTS) | ||
| 181 | mkdir -p debian/out/system/core | ||
| 182 | $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) | ||
| 183 | - cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so | ||
| 184 | + cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so | ||
| 185 | |||
| 186 | $(OBJECTS): %.o: %.cpp | ||
| 187 | $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) | ||
| 188 | diff --git a/debian/system/core/libsparse.mk b/debian/system/core/libsparse.mk | ||
| 189 | index c2b2694c..2da12b8e 100644 | ||
| 190 | --- a/debian/system/core/libsparse.mk | ||
| 191 | +++ b/debian/system/core/libsparse.mk | ||
| 192 | @@ -1,3 +1,4 @@ | ||
| 193 | +include rules_yocto.mk | ||
| 194 | NAME = libsparse | ||
| 195 | |||
| 196 | SOURCES = \ | ||
| 197 | @@ -19,7 +20,7 @@ CPPFLAGS += \ | ||
| 198 | |||
| 199 | LDFLAGS += \ | ||
| 200 | -Ldebian/out/system/core \ | ||
| 201 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 202 | + -Wl,-rpath='$$ORIGIN' \ | ||
| 203 | -Wl,-soname,$(NAME).so.0 \ | ||
| 204 | -lbase \ | ||
| 205 | -lz \ | ||
| 206 | @@ -27,7 +28,7 @@ LDFLAGS += \ | ||
| 207 | |||
| 208 | build: $(OBJECTS) | ||
| 209 | $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) | ||
| 210 | - cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so | ||
| 211 | + cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so | ||
| 212 | |||
| 213 | $(OBJECTS): %.o: %.cpp | ||
| 214 | $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) | ||
| 215 | diff --git a/debian/system/core/libutils.mk b/debian/system/core/libutils.mk | ||
| 216 | index c37b1d2d..332492c1 100644 | ||
| 217 | --- a/debian/system/core/libutils.mk | ||
| 218 | +++ b/debian/system/core/libutils.mk | ||
| 219 | @@ -41,7 +41,7 @@ CPPFLAGS += \ | ||
| 220 | |||
| 221 | LDFLAGS += \ | ||
| 222 | -Ldebian/out/system/core \ | ||
| 223 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 224 | + -Wl,-rpath='$$ORIGIN' \ | ||
| 225 | -Wl,-soname,$(NAME).so.0 \ | ||
| 226 | -lbacktrace \ | ||
| 227 | -lcutils \ | ||
| 228 | diff --git a/debian/system/core/libziparchive.mk b/debian/system/core/libziparchive.mk | ||
| 229 | index 1b286b4e..1b7499be 100644 | ||
| 230 | --- a/debian/system/core/libziparchive.mk | ||
| 231 | +++ b/debian/system/core/libziparchive.mk | ||
| 232 | @@ -1,3 +1,4 @@ | ||
| 233 | +include rules_yocto.mk | ||
| 234 | NAME = libziparchive | ||
| 235 | |||
| 236 | SOURCES = \ | ||
| 237 | @@ -19,7 +20,7 @@ CPPFLAGS += \ | ||
| 238 | |||
| 239 | LDFLAGS += \ | ||
| 240 | -Ldebian/out/system/core \ | ||
| 241 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 242 | + -Wl,-rpath='$$ORIGIN' \ | ||
| 243 | -Wl,-soname,$(NAME).so.0 \ | ||
| 244 | -lbase \ | ||
| 245 | -llog \ | ||
| 246 | @@ -29,7 +30,7 @@ LDFLAGS += \ | ||
| 247 | |||
| 248 | build: $(OBJECTS) | ||
| 249 | $(CXX) $^ -o debian/out/system/core/$(NAME).so.0 $(LDFLAGS) | ||
| 250 | - cd debian/out/system/core && ln -s $(NAME).so.0 $(NAME).so | ||
| 251 | + cd debian/out/system/core && ln -sf $(NAME).so.0 $(NAME).so | ||
| 252 | |||
| 253 | $(OBJECTS): %.o: %.cc | ||
| 254 | $(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) | ||
| 255 | diff --git a/debian/system/core/simg2img.mk b/debian/system/core/simg2img.mk | ||
| 256 | index f6e3f59d..df4f44f3 100644 | ||
| 257 | --- a/debian/system/core/simg2img.mk | ||
| 258 | +++ b/debian/system/core/simg2img.mk | ||
| 259 | @@ -13,7 +13,7 @@ CPPFLAGS += \ | ||
| 260 | |||
| 261 | LDFLAGS += \ | ||
| 262 | -Ldebian/out/system/core \ | ||
| 263 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 264 | + -Wl,-rpath='$$ORIGIN/../lib/android' \ | ||
| 265 | -lbase \ | ||
| 266 | -llog \ | ||
| 267 | -lpthread \ | ||
| 268 | diff --git a/debian/system/core/simg2simg.mk b/debian/system/core/simg2simg.mk | ||
| 269 | index ed53b04c..646ab030 100644 | ||
| 270 | --- a/debian/system/core/simg2simg.mk | ||
| 271 | +++ b/debian/system/core/simg2simg.mk | ||
| 272 | @@ -13,7 +13,7 @@ CPPFLAGS += \ | ||
| 273 | |||
| 274 | LDFLAGS += \ | ||
| 275 | -Ldebian/out/system/core \ | ||
| 276 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 277 | + -Wl,-rpath='$$ORIGIN/../lib/android' \ | ||
| 278 | -lbase \ | ||
| 279 | -llog \ | ||
| 280 | -lpthread \ | ||
| 281 | diff --git a/frameworks/native/libs/adbd_auth/adbd_auth.cpp b/frameworks/native/libs/adbd_auth/adbd_auth.cpp | ||
| 282 | index a9c23110..6ca334ba 100644 | ||
| 283 | --- a/frameworks/native/libs/adbd_auth/adbd_auth.cpp | ||
| 284 | +++ b/frameworks/native/libs/adbd_auth/adbd_auth.cpp | ||
| 285 | @@ -23,8 +23,10 @@ | ||
| 286 | #include <sys/eventfd.h> | ||
| 287 | #include <sys/uio.h> | ||
| 288 | |||
| 289 | +#include <atomic> | ||
| 290 | #include <chrono> | ||
| 291 | #include <deque> | ||
| 292 | +#include <optional> | ||
| 293 | #include <string> | ||
| 294 | #include <string_view> | ||
| 295 | #include <tuple> | ||
| 296 | diff --git a/system/core/adb/adb_listeners.cpp b/system/core/adb/adb_listeners.cpp | ||
| 297 | index 29909a55..440cdbd4 100644 | ||
| 298 | --- a/system/core/adb/adb_listeners.cpp | ||
| 299 | +++ b/system/core/adb/adb_listeners.cpp | ||
| 300 | @@ -109,7 +109,7 @@ static void listener_event_func(int _fd, unsigned ev, void* _l) | ||
| 301 | } | ||
| 302 | |||
| 303 | // Called as a transport disconnect function. |arg| is the raw alistener*. | ||
| 304 | -static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_mutex) { | ||
| 305 | +static void listener_disconnect(void* arg, atransport*) { | ||
| 306 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 307 | for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { | ||
| 308 | if (iter->get() == arg) { | ||
| 309 | @@ -121,7 +121,7 @@ static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_m | ||
| 310 | } | ||
| 311 | |||
| 312 | // Write the list of current listeners (network redirections) into a string. | ||
| 313 | -std::string format_listeners() EXCLUDES(listener_list_mutex) { | ||
| 314 | +std::string format_listeners() { | ||
| 315 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 316 | std::string result; | ||
| 317 | for (auto& l : listener_list) { | ||
| 318 | @@ -140,7 +140,7 @@ std::string format_listeners() EXCLUDES(listener_list_mutex) { | ||
| 319 | } | ||
| 320 | |||
| 321 | InstallStatus remove_listener(const char* local_name, atransport* transport) | ||
| 322 | - EXCLUDES(listener_list_mutex) { | ||
| 323 | +{ | ||
| 324 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 325 | for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { | ||
| 326 | if (local_name == (*iter)->local_name) { | ||
| 327 | @@ -151,7 +151,7 @@ InstallStatus remove_listener(const char* local_name, atransport* transport) | ||
| 328 | return INSTALL_STATUS_LISTENER_NOT_FOUND; | ||
| 329 | } | ||
| 330 | |||
| 331 | -void remove_all_listeners() EXCLUDES(listener_list_mutex) { | ||
| 332 | +void remove_all_listeners() { | ||
| 333 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 334 | auto iter = listener_list.begin(); | ||
| 335 | while (iter != listener_list.end()) { | ||
| 336 | @@ -164,7 +164,7 @@ void remove_all_listeners() EXCLUDES(listener_list_mutex) { | ||
| 337 | } | ||
| 338 | } | ||
| 339 | |||
| 340 | -void close_smartsockets() EXCLUDES(listener_list_mutex) { | ||
| 341 | +void close_smartsockets() { | ||
| 342 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 343 | auto pred = [](const std::unique_ptr<alistener>& listener) { | ||
| 344 | return listener->local_name == "*smartsocket*"; | ||
| 345 | @@ -174,7 +174,7 @@ void close_smartsockets() EXCLUDES(listener_list_mutex) { | ||
| 346 | |||
| 347 | InstallStatus install_listener(const std::string& local_name, const char* connect_to, | ||
| 348 | atransport* transport, int no_rebind, int* resolved_tcp_port, | ||
| 349 | - std::string* error) EXCLUDES(listener_list_mutex) { | ||
| 350 | + std::string* error) { | ||
| 351 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 352 | for (auto& l : listener_list) { | ||
| 353 | if (local_name == l->local_name) { | ||
| 354 | diff --git a/system/core/adb/transport_local.cpp b/system/core/adb/transport_local.cpp | ||
| 355 | index c7261860..5988ec4d 100644 | ||
| 356 | --- a/system/core/adb/transport_local.cpp | ||
| 357 | +++ b/system/core/adb/transport_local.cpp | ||
| 358 | @@ -333,7 +333,7 @@ struct EmulatorConnection : public FdConnection { | ||
| 359 | |||
| 360 | /* Only call this function if you already hold local_transports_lock. */ | ||
| 361 | static atransport* find_emulator_transport_by_adb_port_locked(int adb_port) | ||
| 362 | - REQUIRES(local_transports_lock) { | ||
| 363 | +{ | ||
| 364 | auto it = local_transports.find(adb_port); | ||
| 365 | if (it == local_transports.end()) { | ||
| 366 | 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 @@ | |||
| 1 | From 3be070a1fe2efa2877684f95c6a5643f76ee8bbc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:32:11 +0100 | ||
| 4 | Subject: [PATCH 2/2] libfec: change out_dir in makefile | ||
| 5 | |||
| 6 | --- | ||
| 7 | debian/libfec.mk | 14 ++++++++------ | ||
| 8 | 1 file changed, 8 insertions(+), 6 deletions(-) | ||
| 9 | |||
| 10 | diff --git a/debian/libfec.mk b/debian/libfec.mk | ||
| 11 | index 1d48392..dea9316 100644 | ||
| 12 | --- a/debian/libfec.mk | ||
| 13 | +++ b/debian/libfec.mk | ||
| 14 | @@ -1,3 +1,4 @@ | ||
| 15 | +include ../../rules_yocto.mk | ||
| 16 | NAME = libfec | ||
| 17 | |||
| 18 | # copied from libfec/Android.bp | ||
| 19 | @@ -12,20 +13,21 @@ CXXSOURCES := $(foreach source, $(filter %.cpp, $(SOURCES)), libfec/$(source)) | ||
| 20 | CXXFLAGS += -fno-strict-aliasing -std=g++17 | ||
| 21 | CPPFLAGS += \ | ||
| 22 | -Iext4_utils/include \ | ||
| 23 | - -Ilibfec/include \ | ||
| 24 | + -Ilibfec/include -I $(OUT_DIR)/usr/include \ | ||
| 25 | -D_GNU_SOURCE -DFEC_NO_KLOG -D_LARGEFILE64_SOURCE | ||
| 26 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 27 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 28 | - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 29 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 30 | -lbase -lsparse -lselinux | ||
| 31 | |||
| 32 | build: $(COBJECTS) $(CXXOBJECTS) | ||
| 33 | - mkdir -p $(OUT_DIR) | ||
| 34 | - $(CXX) $^ -o $(OUT_DIR)/$(NAME).so.0 $(LDFLAGS) | ||
| 35 | - ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so | ||
| 36 | + mkdir -p $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android | ||
| 37 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) | ||
| 38 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 39 | + cp -r libfec/include/* $(OUT_DIR)/usr/include/ | ||
| 40 | |||
| 41 | clean: | ||
| 42 | - $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so* | ||
| 43 | + $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 44 | |||
| 45 | $(COBJECTS): %.o: %.c | ||
| 46 | $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) | ||
| 47 | -- | ||
| 48 | 2.36.1.vfs.0.0 | ||
| 49 | |||
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/0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch index 7209e626b7..7ea040c68a 100644 --- 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/0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From 0dac14385d9c79089f8026e2764b75fa111adb8a Mon Sep 17 00:00:00 2001 | 1 | From 02b6b6977d80af4b9b806054fadb5a06cedf011d Mon Sep 17 00:00:00 2001 |
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | 2 | From: Etienne Cordonnier <ecordonnier@snap.com> |
| 3 | Date: Tue, 14 Mar 2023 11:33:50 +0100 | 3 | Date: Tue, 14 Mar 2023 11:33:50 +0100 |
| 4 | Subject: [PATCH] Update usage of usbdevfs_urb to match new kernel UAPI | 4 | Subject: [PATCH] Update usage of usbdevfs_urb to match new kernel UAPI |
| @@ -35,14 +35,15 @@ Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com> | |||
| 35 | 35 | ||
| 36 | [Backported on version 10] | 36 | [Backported on version 10] |
| 37 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | 37 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> |
| 38 | |||
| 38 | --- | 39 | --- |
| 39 | adb/client/usb_linux.cpp | 24 ++++++++++++++---------- | 40 | system/core/adb/client/usb_linux.cpp | 24 ++++++++++++++---------- |
| 40 | 1 file changed, 14 insertions(+), 10 deletions(-) | 41 | 1 file changed, 14 insertions(+), 10 deletions(-) |
| 41 | 42 | ||
| 42 | diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp | 43 | diff --git a/system/core/adb/client/usb_linux.cpp b/system/core/adb/client/usb_linux.cpp |
| 43 | index 81b83064..7d55ec5b 100644 | 44 | index 343e7b59..6a4479f3 100644 |
| 44 | --- a/adb/client/usb_linux.cpp | 45 | --- a/system/core/adb/client/usb_linux.cpp |
| 45 | +++ b/adb/client/usb_linux.cpp | 46 | +++ b/system/core/adb/client/usb_linux.cpp |
| 46 | @@ -71,8 +71,8 @@ struct usb_handle : public ::usb_handle { | 47 | @@ -71,8 +71,8 @@ struct usb_handle : public ::usb_handle { |
| 47 | unsigned zero_mask; | 48 | unsigned zero_mask; |
| 48 | unsigned writeable = 1; | 49 | unsigned writeable = 1; |
| @@ -90,7 +91,7 @@ index 81b83064..7d55ec5b 100644 | |||
| 90 | D("[ reap urb - OUT compelete ]"); | 91 | D("[ reap urb - OUT compelete ]"); |
| 91 | h->urb_out_busy = false; | 92 | h->urb_out_busy = false; |
| 92 | h->cv.notify_all(); | 93 | h->cv.notify_all(); |
| 93 | @@ -483,10 +483,10 @@ void usb_kick(usb_handle* h) { | 94 | @@ -502,10 +502,10 @@ void usb_kick(usb_handle* h) { |
| 94 | ** but this ensures that a reader blocked on REAPURB | 95 | ** but this ensures that a reader blocked on REAPURB |
| 95 | ** will get unblocked | 96 | ** will get unblocked |
| 96 | */ | 97 | */ |
| @@ -105,7 +106,7 @@ index 81b83064..7d55ec5b 100644 | |||
| 105 | h->urb_in_busy = false; | 106 | h->urb_in_busy = false; |
| 106 | h->urb_out_busy = false; | 107 | h->urb_out_busy = false; |
| 107 | h->cv.notify_all(); | 108 | h->cv.notify_all(); |
| 108 | @@ -502,6 +502,8 @@ int usb_close(usb_handle* h) { | 109 | @@ -521,6 +521,8 @@ int usb_close(usb_handle* h) { |
| 109 | 110 | ||
| 110 | D("-- usb close %p (fd = %d) --", h, h->fd); | 111 | D("-- usb close %p (fd = %d) --", h, h->fd); |
| 111 | 112 | ||
| @@ -114,7 +115,7 @@ index 81b83064..7d55ec5b 100644 | |||
| 114 | delete h; | 115 | delete h; |
| 115 | 116 | ||
| 116 | return 0; | 117 | return 0; |
| 117 | @@ -537,6 +539,8 @@ static void register_device(const char* dev_name, const char* dev_path, unsigned | 118 | @@ -556,6 +558,8 @@ static void register_device(const char* dev_name, const char* dev_path, unsigned |
| 118 | usb->ep_out = ep_out; | 119 | usb->ep_out = ep_out; |
| 119 | usb->zero_mask = zero_mask; | 120 | usb->zero_mask = zero_mask; |
| 120 | usb->max_packet_size = max_packet_size; | 121 | usb->max_packet_size = max_packet_size; |
| @@ -123,6 +124,3 @@ index 81b83064..7d55ec5b 100644 | |||
| 123 | 124 | ||
| 124 | // Initialize mark so we don't get garbage collected after the device scan. | 125 | // Initialize mark so we don't get garbage collected after the device scan. |
| 125 | usb->mark = true; | 126 | usb->mark = true; |
| 126 | -- | ||
| 127 | 2.36.1.vfs.0.0 | ||
| 128 | |||
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/0004-adb-Fix-build-on-big-endian-systems.patch index a2c490bfe4..83fe4475c3 100644 --- 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/0004-adb-Fix-build-on-big-endian-systems.patch | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | From f9fe8163cd759c21dd5ec0711b56dccd79ff1c4a Mon Sep 17 00:00:00 2001 | 1 | From e4a29888cb52c1eafd3ab57a6e220b38147ecfbe Mon Sep 17 00:00:00 2001 |
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | 2 | From: Etienne Cordonnier <ecordonnier@snap.com> |
| 3 | Date: Tue, 14 Mar 2023 13:39:23 +0100 | 3 | Date: Tue, 14 Mar 2023 13:39:23 +0100 |
| 4 | Subject: [PATCH] adb: Fix build on big endian systems | 4 | Subject: [PATCH] adb: Fix build on big endian systems |
| @@ -17,19 +17,20 @@ To solve this, we simply open-code cpu_to_le16/32 in a way that allows | |||
| 17 | them to be used when initializing structures. | 17 | them to be used when initializing structures. |
| 18 | 18 | ||
| 19 | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 19 | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> |
| 20 | [Forward-ported to version 10] | 20 | [Forward-ported to version 29] |
| 21 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | 21 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> |
| 22 | |||
| 22 | --- | 23 | --- |
| 23 | adb/daemon/usb_ffs.cpp | 11 +++++++++-- | 24 | system/core/adb/daemon/usb_ffs.cpp | 11 +++++++++-- |
| 24 | 1 file changed, 9 insertions(+), 2 deletions(-) | 25 | 1 file changed, 9 insertions(+), 2 deletions(-) |
| 25 | 26 | ||
| 26 | diff --git a/adb/daemon/usb_ffs.cpp b/adb/daemon/usb_ffs.cpp | 27 | diff --git a/system/core/adb/daemon/usb_ffs.cpp b/system/core/adb/daemon/usb_ffs.cpp |
| 27 | index 07b4ba89..25f30352 100644 | 28 | index b19fa5d5..ef2291ca 100644 |
| 28 | --- a/adb/daemon/usb_ffs.cpp | 29 | --- a/system/core/adb/daemon/usb_ffs.cpp |
| 29 | +++ b/adb/daemon/usb_ffs.cpp | 30 | +++ b/system/core/adb/daemon/usb_ffs.cpp |
| 30 | @@ -37,8 +37,15 @@ | 31 | @@ -39,8 +39,15 @@ |
| 31 | // Number of buffers needed to fit MAX_PAYLOAD, with an extra for ZLPs. | 32 | |
| 32 | #define USB_FFS_NUM_BUFS ((4 * MAX_PAYLOAD / USB_FFS_BULK_SIZE) + 1) | 33 | #define USB_EXT_PROP_UNICODE 1 |
| 33 | 34 | ||
| 34 | -#define cpu_to_le16(x) htole16(x) | 35 | -#define cpu_to_le16(x) htole16(x) |
| 35 | -#define cpu_to_le32(x) htole32(x) | 36 | -#define cpu_to_le32(x) htole32(x) |
| @@ -43,8 +44,5 @@ index 07b4ba89..25f30352 100644 | |||
| 43 | + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) | 44 | + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) |
| 44 | +#endif | 45 | +#endif |
| 45 | 46 | ||
| 47 | // clang-format off | ||
| 46 | struct func_desc { | 48 | struct func_desc { |
| 47 | struct usb_interface_descriptor intf; | ||
| 48 | -- | ||
| 49 | 2.36.1.vfs.0.0 | ||
| 50 | |||
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/0005-adb-Allow-adbd-to-be-run-as-root.patch index dbb12849c7..3fbdcd4bac 100644 --- 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/0005-adb-Allow-adbd-to-be-run-as-root.patch | |||
| @@ -1,18 +1,19 @@ | |||
| 1 | From 0bc94c83b9d846416613f9c8831cae6caf1713e5 Mon Sep 17 00:00:00 2001 | 1 | From 4ef35041ba5c02df48c31f2382e7c3c4316ad936 Mon Sep 17 00:00:00 2001 |
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | 2 | From: Etienne Cordonnier <ecordonnier@snap.com> |
| 3 | Date: Tue, 14 Mar 2023 13:53:51 +0100 | 3 | Date: Tue, 14 Mar 2023 13:53:51 +0100 |
| 4 | Subject: [PATCH] adb: Allow adbd to be run as root | 4 | Subject: [PATCH] adb: Allow adbd to be run as root |
| 5 | 5 | ||
| 6 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | 6 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> |
| 7 | |||
| 7 | --- | 8 | --- |
| 8 | adb/daemon/main.cpp | 1 + | 9 | system/core/adb/daemon/main.cpp | 1 + |
| 9 | 1 file changed, 1 insertion(+) | 10 | 1 file changed, 1 insertion(+) |
| 10 | 11 | ||
| 11 | diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp | 12 | diff --git a/system/core/adb/daemon/main.cpp b/system/core/adb/daemon/main.cpp |
| 12 | index c75263c4..d27f6996 100644 | 13 | index e807d13d..309663a2 100644 |
| 13 | --- a/adb/daemon/main.cpp | 14 | --- a/system/core/adb/daemon/main.cpp |
| 14 | +++ b/adb/daemon/main.cpp | 15 | +++ b/system/core/adb/daemon/main.cpp |
| 15 | @@ -72,6 +72,7 @@ static bool should_drop_capabilities_bounding_set() { | 16 | @@ -75,6 +75,7 @@ static bool should_drop_capabilities_bounding_set() { |
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | static bool should_drop_privileges() { | 19 | static bool should_drop_privileges() { |
| @@ -20,6 +21,3 @@ index c75263c4..d27f6996 100644 | |||
| 20 | // "adb root" not allowed, always drop privileges. | 21 | // "adb root" not allowed, always drop privileges. |
| 21 | if (!ALLOW_ADBD_ROOT && !is_device_unlocked()) return true; | 22 | if (!ALLOW_ADBD_ROOT && !is_device_unlocked()) return true; |
| 22 | 23 | ||
| 23 | -- | ||
| 24 | 2.36.1.vfs.0.0 | ||
| 25 | |||
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 @@ | |||
| 1 | include ../../rules_yocto.mk | 1 | include rules_yocto.mk |
| 2 | NAME = adbd | 2 | NAME = adbd |
| 3 | 3 | ||
| 4 | SOURCES = \ | 4 | SOURCES = \ |
| 5 | adb/daemon/main.cpp \ | 5 | adb/adbconnection/adbconnection_server.cpp \ |
| 6 | adb/daemon/auth.cpp \ | 6 | adb/daemon/auth.cpp \ |
| 7 | adb/daemon/jdwp_service.cpp \ | ||
| 8 | adb/daemon/file_sync_service.cpp \ | 7 | adb/daemon/file_sync_service.cpp \ |
| 8 | adb/daemon/file_sync_service.h \ | ||
| 9 | adb/daemon/framebuffer_service.cpp \ | ||
| 10 | adb/daemon/framebuffer_service.h \ | ||
| 11 | adb/daemon/jdwp_service.cpp \ | ||
| 12 | adb/daemon/main.cpp \ | ||
| 13 | adb/daemon/restart_service.cpp \ | ||
| 14 | adb/daemon/restart_service.h \ | ||
| 9 | adb/daemon/services.cpp \ | 15 | adb/daemon/services.cpp \ |
| 10 | adb/daemon/shell_service.cpp \ | 16 | adb/daemon/shell_service.cpp \ |
| 11 | adb/daemon/remount_service.cpp \ | 17 | adb/daemon/shell_service.h \ |
| 12 | adb/daemon/restart_service.cpp \ | 18 | adb/daemon/usb_ffs.cpp \ |
| 13 | adb/daemon/reboot_service.cpp \ | 19 | adb/daemon/usb_legacy.cpp \ |
| 14 | adb/daemon/framebuffer_service.cpp \ | 20 | adb/daemon/usb.cpp \ |
| 15 | adb/daemon/set_verity_enable_state_service.cpp \ | ||
| 16 | adb/shell_service_protocol.cpp \ | 21 | adb/shell_service_protocol.cpp \ |
| 17 | adb/adb.cpp \ | 22 | adb/adb.cpp \ |
| 18 | adb/adb_io.cpp \ | 23 | adb/adb_io.cpp \ |
| @@ -20,41 +25,51 @@ SOURCES = \ | |||
| 20 | adb/adb_trace.cpp \ | 25 | adb/adb_trace.cpp \ |
| 21 | adb/adb_unique_fd.cpp \ | 26 | adb/adb_unique_fd.cpp \ |
| 22 | adb/adb_utils.cpp \ | 27 | adb/adb_utils.cpp \ |
| 23 | adb/fdevent.cpp \ | 28 | adb/fdevent/fdevent.cpp \ |
| 29 | adb/fdevent/fdevent_epoll.cpp \ | ||
| 24 | adb/services.cpp \ | 30 | adb/services.cpp \ |
| 25 | adb/sockets.cpp \ | 31 | adb/sockets.cpp \ |
| 26 | adb/socket_spec.cpp \ | 32 | adb/socket_spec.cpp \ |
| 27 | adb/sysdeps/errno.cpp \ | 33 | adb/sysdeps/errno.cpp \ |
| 34 | adb/sysdeps/posix/network.cpp \ | ||
| 35 | adb/sysdeps_unix.cpp \ | ||
| 28 | adb/transport.cpp \ | 36 | adb/transport.cpp \ |
| 29 | adb/transport_fd.cpp \ | 37 | adb/transport_fd.cpp \ |
| 30 | adb/transport_local.cpp \ | 38 | adb/transport_local.cpp \ |
| 31 | adb/transport_usb.cpp \ | 39 | adb/transport_usb.cpp \ |
| 32 | adb/sysdeps_unix.cpp \ | 40 | adb/types.cpp \ |
| 33 | adb/sysdeps/posix/network.cpp \ | ||
| 34 | adb/daemon/usb_legacy.cpp \ | ||
| 35 | adb/daemon/usb_ffs.cpp \ | ||
| 36 | adb/daemon/usb.cpp \ | ||
| 37 | diagnose_usb/diagnose_usb.cpp \ | 41 | diagnose_usb/diagnose_usb.cpp \ |
| 38 | libasyncio/AsyncIO.cpp \ | 42 | libasyncio/AsyncIO.cpp \ |
| 39 | 43 | ||
| 44 | SOURCES := $(foreach source, $(SOURCES), system/core/$(source)) | ||
| 45 | |||
| 46 | SOURCES += \ | ||
| 47 | frameworks/native/libs/adbd_auth/adbd_auth.cpp | ||
| 48 | |||
| 40 | CXXFLAGS += -std=gnu++20 | 49 | CXXFLAGS += -std=gnu++20 |
| 41 | CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ -Imkbootimg/include/bootimg -Ifs_mgr/include \ | 50 | CPPFLAGS += -Isystem/coreinclude -Isystem/core/adb -Isystem/core/base/include -Idebian/out/system/core -Isystem/tools/mkbootimg/include/bootimg -Isystem/core/fs_mgr/include \ |
| 42 | -Ifs_mgr/include_fstab \ | 51 | -Isystem/core/fs_mgr/include_fstab \ |
| 43 | -DADB_VERSION='"$(DEB_VERSION)"' -D_GNU_SOURCE | 52 | -DADB_VERSION='"$(DEB_VERSION)"' -D_GNU_SOURCE |
| 44 | LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ | 53 | LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib/android' -Wl,-rpath-link='$$ORIGIN/../lib/android' \ |
| 45 | -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lbase -lcrypto_utils -lcrypto -lcutils -llog -lresolv | 54 | -lpthread -Ldebian/out/system/core -Ldebian/out/external/boringssl -lbase -lcrypto_utils -l:libcrypto.a -lcutils -llog -lresolv |
| 46 | 55 | ||
| 47 | PAGE_SIZE ?= 4096 | 56 | PAGE_SIZE ?= 4096 |
| 48 | 57 | ||
| 49 | CXXFLAGS += -UADB_HOST | 58 | CXXFLAGS += -UADB_HOST |
| 50 | CXXFLAGS += -DADB_HOST=0 | 59 | CXXFLAGS += -DADB_HOST=0 |
| 51 | CXXFLAGS += -DALLOW_ADBD_DISABLE_VERITY | 60 | CXXFLAGS += -DALLOW_ADBD_DISABLE_VERITY |
| 52 | CXXFLAGS += -DALLOW_ADBD_NO_AUTH | 61 | CXXFLAGS += -DALLOW_ADBD_NO_AUTH |
| 53 | CXXFLAGS += -DPLATFORM_TOOLS_VERSION='"28.0.2"' | 62 | CXXFLAGS += -DPLATFORM_TOOLS_VERSION='"28.0.2"' |
| 54 | CXXFLAGS += -Idiagnose_usb/include | 63 | CXXFLAGS += -Isystem/core/diagnose_usb/include |
| 55 | CXXFLAGS += -Iadb/daemon/include | 64 | CXXFLAGS += -Isystem/core/adb/daemon/include |
| 56 | CXXFLAGS += -Ilibasyncio/include | 65 | CXXFLAGS += -Isystem/core/adb/adbconnection/include |
| 57 | CXXFLAGS += -Wno-c++11-narrowing | 66 | CXXFLAGS += -Isystem/core/libasyncio/include |
| 67 | CXXFLAGS += -Isystem/core/libcutils/include | ||
| 68 | CXXFLAGS += -Isystem/core/libcrypto_utils/include | ||
| 69 | CXXFLAGS += -Isystem/core/liblog/include/ | ||
| 70 | CXXFLAGS += -Isystem/core/libutils/include | ||
| 71 | CXXFLAGS += -Iframeworks/native/libs/adbd_auth/include | ||
| 72 | CXXFLAGS += -Wno-c++11-narrowing | ||
| 58 | CXXFLAGS += -DPAGE_SIZE=$(PAGE_SIZE) | 73 | CXXFLAGS += -DPAGE_SIZE=$(PAGE_SIZE) |
| 59 | 74 | ||
| 60 | 75 | ||
| @@ -65,8 +80,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) | |||
| 65 | endif | 80 | endif |
| 66 | 81 | ||
| 67 | build: $(SOURCES) | 82 | build: $(SOURCES) |
| 68 | mkdir --parents ../../../android-tools/adbd | 83 | mkdir --parents debian/out/system/core |
| 69 | $(CXX) $^ -o ../../../android-tools/adbd/adbd $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | 84 | $(CXX) $^ -o debian/out/system/core/adbd $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) |
| 70 | 85 | ||
| 71 | clean: | 86 | clean: |
| 72 | $(RM) $(OUT_DIR)/usr/bin/$(NAME) | 87 | $(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 @@ | |||
| 1 | Description: Added missing headers causing compile errors | ||
| 2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
| 3 | Forwarded: not-needed | ||
| 4 | |||
| 5 | --- a/adb/sysdeps/posix/network.cpp | ||
| 6 | +++ b/adb/sysdeps/posix/network.cpp | ||
| 7 | @@ -22,6 +22,7 @@ | ||
| 8 | #include <sys/socket.h> | ||
| 9 | |||
| 10 | #include <string> | ||
| 11 | +#include <cstring> | ||
| 12 | |||
| 13 | #include <android-base/logging.h> | ||
| 14 | #include <android-base/stringprintf.h> | ||
| 15 | --- a/base/errors_unix.cpp | ||
| 16 | +++ b/base/errors_unix.cpp | ||
| 17 | @@ -17,6 +17,7 @@ | ||
| 18 | #include "android-base/errors.h" | ||
| 19 | |||
| 20 | #include <errno.h> | ||
| 21 | +#include <cstring> | ||
| 22 | |||
| 23 | namespace android { | ||
| 24 | namespace base { | ||
| 25 | --- a/base/file.cpp | ||
| 26 | +++ b/base/file.cpp | ||
| 27 | @@ -26,6 +26,7 @@ | ||
| 28 | #include <sys/stat.h> | ||
| 29 | #include <sys/types.h> | ||
| 30 | #include <unistd.h> | ||
| 31 | +#include <cstring> | ||
| 32 | |||
| 33 | #include <memory> | ||
| 34 | #include <mutex> | ||
| 35 | --- a/base/logging.cpp | ||
| 36 | +++ b/base/logging.cpp | ||
| 37 | @@ -24,6 +24,7 @@ | ||
| 38 | #include <inttypes.h> | ||
| 39 | #include <libgen.h> | ||
| 40 | #include <time.h> | ||
| 41 | +#include <cstring> | ||
| 42 | |||
| 43 | // For getprogname(3) or program_invocation_short_name. | ||
| 44 | #if defined(__ANDROID__) || defined(__APPLE__) | ||
| 45 | --- a/libcutils/include/cutils/jstring.h | ||
| 46 | +++ b/libcutils/include/cutils/jstring.h | ||
| 47 | @@ -19,6 +19,7 @@ | ||
| 48 | |||
| 49 | #include <stdint.h> | ||
| 50 | #include <stddef.h> | ||
| 51 | +#include <uchar.h> | ||
| 52 | |||
| 53 | #ifdef __cplusplus | ||
| 54 | extern "C" { | ||
| 55 | --- a/libbacktrace/BacktraceMap.cpp | ||
| 56 | +++ b/libbacktrace/BacktraceMap.cpp | ||
| 57 | @@ -21,6 +21,7 @@ | ||
| 58 | #include <stdint.h> | ||
| 59 | #include <sys/types.h> | ||
| 60 | #include <unistd.h> | ||
| 61 | +#include <algorithm> | ||
| 62 | |||
| 63 | #include <log/log.h> | ||
| 64 | |||
| 65 | --- a/demangle/Demangler.cpp | ||
| 66 | +++ b/demangle/Demangler.cpp | ||
| 67 | @@ -20,6 +20,7 @@ | ||
| 68 | #include <stack> | ||
| 69 | #include <string> | ||
| 70 | #include <vector> | ||
| 71 | +#include <cstring> | ||
| 72 | |||
| 73 | #include "Demangler.h" | ||
| 74 | |||
| 75 | --- a/libbacktrace/UnwindStackMap.cpp | ||
| 76 | +++ b/libbacktrace/UnwindStackMap.cpp | ||
| 77 | @@ -20,6 +20,7 @@ | ||
| 78 | |||
| 79 | #include <string> | ||
| 80 | #include <vector> | ||
| 81 | +#include <algorithm> | ||
| 82 | |||
| 83 | #include <backtrace/BacktraceMap.h> | ||
| 84 | #include <unwindstack/Elf.h> | ||
| 85 | --- a/adb/types.h | ||
| 86 | +++ b/adb/types.h | ||
| 87 | @@ -17,6 +17,7 @@ | ||
| 88 | #pragma once | ||
| 89 | |||
| 90 | #include <algorithm> | ||
| 91 | +#include <cstring> | ||
| 92 | #include <deque> | ||
| 93 | #include <memory> | ||
| 94 | #include <type_traits> | ||
diff --git a/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 @@ | |||
| 1 | --- a/fs_mgr/liblp/reader.cpp | ||
| 2 | +++ b/fs_mgr/liblp/reader.cpp | ||
| 3 | @@ -21,6 +21,7 @@ | ||
| 4 | #include <unistd.h> | ||
| 5 | |||
| 6 | #include <functional> | ||
| 7 | +#include <cstring> | ||
| 8 | |||
| 9 | #include <android-base/file.h> | ||
| 10 | #include <android-base/unique_fd.h> | ||
| 11 | --- a/fs_mgr/liblp/writer.cpp | ||
| 12 | +++ b/fs_mgr/liblp/writer.cpp | ||
| 13 | @@ -20,6 +20,7 @@ | ||
| 14 | #include <unistd.h> | ||
| 15 | |||
| 16 | #include <string> | ||
| 17 | +#include <cstring> | ||
| 18 | |||
| 19 | #include <android-base/file.h> | ||
| 20 | #include <android-base/unique_fd.h> | ||
diff --git a/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 @@ | |||
| 1 | From: Roger Shimizu <rosh@debian.org> | ||
| 2 | Date: Sun, 10 Jan 2021 19:03:17 +0900 | ||
| 3 | Subject: Fix GNU/Hurd | ||
| 4 | |||
| 5 | Reference: | ||
| 6 | - https://www.gnu.org/software/hurd/hurd/porting/guidelines.html | ||
| 7 | |||
| 8 | Closes: #915762 | ||
| 9 | --- | ||
| 10 | base/cmsg.cpp | 2 ++ | ||
| 11 | base/threads.cpp | 2 +- | ||
| 12 | libcutils/ashmem-host.cpp | 20 +++++++++++++++++--- | ||
| 13 | libcutils/canned_fs_config.cpp | 2 +- | ||
| 14 | libcutils/fs.cpp | 20 ++++++++++++++++---- | ||
| 15 | 5 files changed, 37 insertions(+), 9 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/base/cmsg.cpp b/base/cmsg.cpp | ||
| 18 | index ae5bb16..e5ec321 100644 | ||
| 19 | --- a/base/cmsg.cpp | ||
| 20 | +++ b/base/cmsg.cpp | ||
| 21 | @@ -20,7 +20,9 @@ | ||
| 22 | #include <fcntl.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include <sys/socket.h> | ||
| 25 | +#ifndef __GNU__ | ||
| 26 | #include <sys/user.h> | ||
| 27 | +#endif | ||
| 28 | |||
| 29 | #include <memory> | ||
| 30 | |||
| 31 | diff --git a/base/threads.cpp b/base/threads.cpp | ||
| 32 | index 48f6197..19cc293 100644 | ||
| 33 | --- a/base/threads.cpp | ||
| 34 | +++ b/base/threads.cpp | ||
| 35 | @@ -47,7 +47,7 @@ uint64_t GetThreadId() { | ||
| 36 | } // namespace base | ||
| 37 | } // namespace android | ||
| 38 | |||
| 39 | -#if defined(__GLIBC__) | ||
| 40 | +#if defined(__GLIBC__) && !defined(__GNU__) | ||
| 41 | int tgkill(int tgid, int tid, int sig) { | ||
| 42 | return syscall(__NR_tgkill, tgid, tid, sig); | ||
| 43 | } | ||
| 44 | diff --git a/libcutils/ashmem-host.cpp b/libcutils/ashmem-host.cpp | ||
| 45 | index 32446d4..83dd622 100644 | ||
| 46 | --- a/libcutils/ashmem-host.cpp | ||
| 47 | +++ b/libcutils/ashmem-host.cpp | ||
| 48 | @@ -31,16 +31,30 @@ | ||
| 49 | #include <sys/types.h> | ||
| 50 | #include <time.h> | ||
| 51 | #include <unistd.h> | ||
| 52 | +#include <stdint.h> | ||
| 53 | |||
| 54 | #include <utils/Compat.h> | ||
| 55 | |||
| 56 | int ashmem_create_region(const char* /*ignored*/, size_t size) { | ||
| 57 | - char pattern[PATH_MAX]; | ||
| 58 | - snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); | ||
| 59 | + char *pattern; | ||
| 60 | + size_t pattern_size = 128; | ||
| 61 | + while(1) { | ||
| 62 | + pattern = (char*) malloc(pattern_size); | ||
| 63 | + if(snprintf(pattern, strlen(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()) < pattern_size) | ||
| 64 | + break; | ||
| 65 | + free(pattern); | ||
| 66 | + pattern_size *= 2; | ||
| 67 | + if(pattern_size >= INT_LEAST16_MAX) | ||
| 68 | + return -1; | ||
| 69 | + } | ||
| 70 | int fd = mkstemp(pattern); | ||
| 71 | - if (fd == -1) return -1; | ||
| 72 | + if (fd == -1) { | ||
| 73 | + free(pattern); | ||
| 74 | + return -1; | ||
| 75 | + } | ||
| 76 | |||
| 77 | unlink(pattern); | ||
| 78 | + free(pattern); | ||
| 79 | |||
| 80 | if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) { | ||
| 81 | close(fd); | ||
| 82 | diff --git a/libcutils/canned_fs_config.cpp b/libcutils/canned_fs_config.cpp | ||
| 83 | index 2772ef0..1e41f37 100644 | ||
| 84 | --- a/libcutils/canned_fs_config.cpp | ||
| 85 | +++ b/libcutils/canned_fs_config.cpp | ||
| 86 | @@ -42,7 +42,7 @@ static int path_compare(const void* a, const void* b) { | ||
| 87 | } | ||
| 88 | |||
| 89 | int load_canned_fs_config(const char* fn) { | ||
| 90 | - char buf[PATH_MAX + 200]; | ||
| 91 | + char buf[1024]; | ||
| 92 | FILE* f; | ||
| 93 | |||
| 94 | f = fopen(fn, "r"); | ||
| 95 | diff --git a/libcutils/fs.cpp b/libcutils/fs.cpp | ||
| 96 | index ef85acc..2884835 100644 | ||
| 97 | --- a/libcutils/fs.cpp | ||
| 98 | +++ b/libcutils/fs.cpp | ||
| 99 | @@ -33,6 +33,7 @@ | ||
| 100 | #include <sys/stat.h> | ||
| 101 | #include <sys/types.h> | ||
| 102 | #include <unistd.h> | ||
| 103 | +#include <stdint.h> | ||
| 104 | |||
| 105 | #include <log/log.h> | ||
| 106 | |||
| 107 | @@ -150,15 +151,24 @@ fail: | ||
| 108 | } | ||
| 109 | |||
| 110 | int fs_write_atomic_int(const char* path, int value) { | ||
| 111 | - char temp[PATH_MAX]; | ||
| 112 | - if (snprintf(temp, PATH_MAX, "%s.XXXXXX", path) >= PATH_MAX) { | ||
| 113 | - ALOGE("Path too long"); | ||
| 114 | - return -1; | ||
| 115 | + char *temp; | ||
| 116 | + size_t temp_size = 128; | ||
| 117 | + while(1) { | ||
| 118 | + temp = (char*) malloc(temp_size); | ||
| 119 | + if(snprintf(temp, strlen(temp), "%s.XXXXXX", path) < temp_size) | ||
| 120 | + break; | ||
| 121 | + free(temp); | ||
| 122 | + temp_size *= 2; | ||
| 123 | + if(temp_size >= INT_LEAST16_MAX) { | ||
| 124 | + ALOGE("Path too long"); | ||
| 125 | + return -1; | ||
| 126 | + } | ||
| 127 | } | ||
| 128 | |||
| 129 | int fd = TEMP_FAILURE_RETRY(mkstemp(temp)); | ||
| 130 | if (fd == -1) { | ||
| 131 | ALOGE("Failed to open %s: %s", temp, strerror(errno)); | ||
| 132 | + free(temp); | ||
| 133 | return -1; | ||
| 134 | } | ||
| 135 | |||
| 136 | @@ -182,12 +192,14 @@ int fs_write_atomic_int(const char* path, int value) { | ||
| 137 | goto fail_closed; | ||
| 138 | } | ||
| 139 | |||
| 140 | + free(temp); | ||
| 141 | return 0; | ||
| 142 | |||
| 143 | fail: | ||
| 144 | close(fd); | ||
| 145 | fail_closed: | ||
| 146 | unlink(temp); | ||
| 147 | + free(temp); | ||
| 148 | return -1; | ||
| 149 | } | ||
| 150 | |||
diff --git a/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 @@ | |||
| 1 | Description: Use Python 3 for `mkbootimg` | ||
| 2 | Bug: https://android.googlesource.com/platform/system/core/+/c434cf82d526f07cd3dcebf53582eeddf12b0a74 | ||
| 3 | --- a/mkbootimg/mkbootimg.py | ||
| 4 | +++ b/mkbootimg/mkbootimg.py | ||
| 5 | @@ -1,4 +1,4 @@ | ||
| 6 | -#!/usr/bin/env python | ||
| 7 | +#!/usr/bin/python3 | ||
| 8 | # Copyright 2015, The Android Open Source Project | ||
| 9 | # | ||
| 10 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 11 | --- a/mkbootimg/unpack_bootimg.py | ||
| 12 | +++ b/mkbootimg/unpack_bootimg.py | ||
| 13 | @@ -1,4 +1,4 @@ | ||
| 14 | -#!/usr/bin/env python | ||
| 15 | +#!/usr/bin/python3 | ||
| 16 | # Copyright 2018, The Android Open Source Project | ||
| 17 | # | ||
| 18 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
diff --git a/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 @@ | |||
| 1 | Description: code uses C99/C++20 constructs that g++ does not support | ||
| 2 | $ g++ liblog/fake_writer.cpp -o liblog/fake_writer.o -c -std=c++17 -fPIC -Iliblog/include -Iinclude -DLIBLOG_LOG_TAG=1006 -DFAKE_LOG_DEVICE=1 -DSNET_EVENT_LOG_TAG=1397638484 | ||
| 3 | liblog/fake_writer.cpp:36:5: error: expected primary-expression before ‘.’ token | ||
| 4 | .context.priv = &logFds, | ||
| 5 | ^ | ||
| 6 | This is an ugly hack. The actual fix is probably to compile using | ||
| 7 | clang. Otherwise, these .context.priv elements shuld be initialized | ||
| 8 | in a different way. | ||
| 9 | |||
| 10 | Forwarded: not-needed | ||
| 11 | |||
| 12 | --- a/liblog/fake_writer.cpp | ||
| 13 | +++ b/liblog/fake_writer.cpp | ||
| 14 | @@ -33,7 +33,6 @@ | ||
| 15 | |||
| 16 | struct android_log_transport_write fakeLoggerWrite = { | ||
| 17 | .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node}, | ||
| 18 | - .context.priv = &logFds, | ||
| 19 | .name = "fake", | ||
| 20 | .available = NULL, | ||
| 21 | .open = fakeOpen, | ||
| 22 | --- a/liblog/stderr_write.cpp | ||
| 23 | +++ b/liblog/stderr_write.cpp | ||
| 24 | @@ -56,7 +56,6 @@ | ||
| 25 | |||
| 26 | struct android_log_transport_write stderrLoggerWrite = { | ||
| 27 | .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node}, | ||
| 28 | - .context.priv = NULL, | ||
| 29 | .name = "stderr", | ||
| 30 | .available = stderrAvailable, | ||
| 31 | .open = stderrOpen, | ||
diff --git a/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 @@ | |||
| 1 | From d133fc2c71fb6b0358af453b03bcb6d1874e902a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 12:25:40 +0100 | ||
| 4 | Subject: [PATCH 01/15] patching adb.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/adb.mk | 12 +++++++----- | ||
| 24 | 1 file changed, 7 insertions(+), 5 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/adb.mk b/debian/adb.mk | ||
| 27 | index 8dbacf9a..97c9d6ca 100644 | ||
| 28 | --- a/debian/adb.mk | ||
| 29 | +++ b/debian/adb.mk | ||
| 30 | @@ -1,3 +1,4 @@ | ||
| 31 | +include ../../rules_yocto.mk | ||
| 32 | NAME = adb | ||
| 33 | |||
| 34 | SOURCES = client/adb_client.cpp \ | ||
| 35 | @@ -12,10 +13,10 @@ SOURCES = client/adb_client.cpp \ | ||
| 36 | |||
| 37 | SOURCES := $(foreach source, $(SOURCES), adb/$(source)) | ||
| 38 | CXXFLAGS += -std=gnu++2a | ||
| 39 | -CPPFLAGS += -Iinclude -Iadb -Ibase/include \ | ||
| 40 | +CPPFLAGS += -Iinclude -Iadb -Ibase/include -I$(OUT_DIR)/usr/include/ \ | ||
| 41 | -DADB_VERSION='"$(DEB_VERSION)"' -DADB_HOST=1 -D_GNU_SOURCE | ||
| 42 | -LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=. \ | ||
| 43 | - -lpthread -L. -ladb -lbase | ||
| 44 | +LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ | ||
| 45 | + -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -ladb -lbase | ||
| 46 | |||
| 47 | # -latomic should be the last library specified | ||
| 48 | # https://github.com/android/ndk/issues/589 | ||
| 49 | @@ -24,7 +25,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) | ||
| 50 | endif | ||
| 51 | |||
| 52 | build: $(SOURCES) | ||
| 53 | - $(CXX) $^ -o adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 54 | + mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb | ||
| 55 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 56 | |||
| 57 | clean: | ||
| 58 | - $(RM) adb/$(NAME) | ||
| 59 | + $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) | ||
| 60 | -- | ||
| 61 | 2.36.1.vfs.0.0 | ||
| 62 | |||
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 @@ | |||
| 1 | From f802e7685cfbdd66d74da2975b3a1c6d77f1a2de Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 12:28:10 +0100 | ||
| 4 | Subject: [PATCH 02/15] libadb.mk: modifications to make it build in yocto | ||
| 5 | environment | ||
| 6 | |||
| 7 | Adding an include file that is setting the common flags. | ||
| 8 | Changed the cppflag to include the headers from other components | ||
| 9 | of android-tools | ||
| 10 | |||
| 11 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 12 | are searched in the output folder. | ||
| 13 | |||
| 14 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 15 | |||
| 16 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 17 | --- | ||
| 18 | debian/libadb.mk | 11 ++++++----- | ||
| 19 | 1 file changed, 6 insertions(+), 5 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/debian/libadb.mk b/debian/libadb.mk | ||
| 22 | index ae240c98..db5da353 100644 | ||
| 23 | --- a/debian/libadb.mk | ||
| 24 | +++ b/debian/libadb.mk | ||
| 25 | @@ -1,3 +1,4 @@ | ||
| 26 | +include ../../rules_yocto.mk | ||
| 27 | NAME := libadb | ||
| 28 | |||
| 29 | LIBADB_SRC_FILES := \ | ||
| 30 | @@ -43,18 +44,18 @@ CPPFLAGS += \ | ||
| 31 | -Ibase/include \ | ||
| 32 | -Idiagnose_usb/include \ | ||
| 33 | -Ilibcrypto_utils/include \ | ||
| 34 | - -Iinclude \ | ||
| 35 | + -Iinclude -I$(OUT_DIR)/usr/include \ | ||
| 36 | -DPLATFORM_TOOLS_VERSION='"$(PLATFORM_TOOLS_VERSION)"' \ | ||
| 37 | -DADB_HOST=1 -DADB_VERSION='"$(DEB_VERSION)"' | ||
| 38 | |||
| 39 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 40 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 41 | - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android -lcrypto \ | ||
| 42 | - -lpthread -L. -lbase -lcutils -lcrypto_utils -lusb-1.0 | ||
| 43 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lcrypto \ | ||
| 44 | + -lpthread -lbase -lcutils -lcrypto_utils -lusb-1.0 | ||
| 45 | |||
| 46 | $(NAME).so: $(SOURCES) | ||
| 47 | - $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 48 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 49 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 50 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 51 | |||
| 52 | transport_mdns_unsupported.cpp: | ||
| 53 | echo 'void init_mdns_transport_discovery(void) {}' > transport_mdns_unsupported.cpp | ||
| 54 | -- | ||
| 55 | 2.36.1.vfs.0.0 | ||
| 56 | |||
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 @@ | |||
| 1 | From 4fdd086c2e9c85bc5a367a861696191e190cebc9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 3 | Date: Thu, 2 Mar 2023 17:20:48 +0100 | ||
| 4 | Subject: [PATCH 03/15] socket.h: removing dependency of gtest | ||
| 5 | |||
| 6 | Removed the dependency of gtest on the build of fastboot binary. | ||
| 7 | Fixes below error | ||
| 8 | |||
| 9 | In file included from fastboot/fastboot.cpp:70: | ||
| 10 | | In file included from fastboot/tcp.h:36: | ||
| 11 | | fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found | ||
| 12 | | #include <gtest/gtest_prod.h> | ||
| 13 | | ^~~~~~~~~~~~~~~~~~~~ | ||
| 14 | | 1 error generated. | ||
| 15 | | In file included from fastboot/socket.cpp:29: | ||
| 16 | | fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found | ||
| 17 | | #include <gtest/gtest_prod.h> | ||
| 18 | | ^~~~~~~~~~~~~~~~~~~~ | ||
| 19 | | 1 error generated. | ||
| 20 | | In file included from fastboot/tcp.cpp:29: | ||
| 21 | | In file included from fastboot/tcp.h:36: | ||
| 22 | | fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found | ||
| 23 | | #include <gtest/gtest_prod.h> | ||
| 24 | | ^~~~~~~~~~~~~~~~~~~~ | ||
| 25 | | 1 error generated. | ||
| 26 | | In file included from fastboot/udp.cpp:31: | ||
| 27 | | In file included from fastboot/udp.h:34: | ||
| 28 | | fastboot/socket.h:43:10: fatal error: 'gtest/gtest_prod.h' file not found | ||
| 29 | | #include <gtest/gtest_prod.h> | ||
| 30 | | ^~~~~~~~~~~~~~~~~~~~ | ||
| 31 | | 1 error generated. | ||
| 32 | |||
| 33 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 34 | --- | ||
| 35 | fastboot/socket.h | 3 --- | ||
| 36 | 1 file changed, 3 deletions(-) | ||
| 37 | |||
| 38 | diff --git a/fastboot/socket.h b/fastboot/socket.h | ||
| 39 | index e791f2c8..671fc115 100644 | ||
| 40 | --- a/fastboot/socket.h | ||
| 41 | +++ b/fastboot/socket.h | ||
| 42 | @@ -40,7 +40,6 @@ | ||
| 43 | |||
| 44 | #include <android-base/macros.h> | ||
| 45 | #include <cutils/sockets.h> | ||
| 46 | -#include <gtest/gtest_prod.h> | ||
| 47 | |||
| 48 | // Socket interface to be implemented for each platform. | ||
| 49 | class Socket { | ||
| 50 | @@ -119,8 +118,6 @@ class Socket { | ||
| 51 | socket_send_buffers_function_ = &socket_send_buffers; | ||
| 52 | |||
| 53 | private: | ||
| 54 | - FRIEND_TEST(SocketTest, TestTcpSendBuffers); | ||
| 55 | - FRIEND_TEST(SocketTest, TestUdpSendBuffers); | ||
| 56 | |||
| 57 | DISALLOW_COPY_AND_ASSIGN(Socket); | ||
| 58 | }; | ||
| 59 | -- | ||
| 60 | 2.36.1.vfs.0.0 | ||
| 61 | |||
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 @@ | |||
| 1 | From e826f68c68e05b0f5cc3b3c10d7d9e4deb135114 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:14:15 +0100 | ||
| 4 | Subject: [PATCH 04/15] patching fastboot.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/fastboot.mk | 12 +++++++----- | ||
| 24 | 1 file changed, 7 insertions(+), 5 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/fastboot.mk b/debian/fastboot.mk | ||
| 27 | index d1aba626..e75fa87c 100644 | ||
| 28 | --- a/debian/fastboot.mk | ||
| 29 | +++ b/debian/fastboot.mk | ||
| 30 | @@ -1,3 +1,4 @@ | ||
| 31 | +include ../../rules_yocto.mk | ||
| 32 | NAME = fastboot | ||
| 33 | fastboot_SOURCES = \ | ||
| 34 | bootimg_utils.cpp \ | ||
| 35 | @@ -38,11 +39,11 @@ CPPFLAGS += \ | ||
| 36 | -Ifs_mgr/liblp/include \ | ||
| 37 | -I/usr/include/android/openssl \ | ||
| 38 | -Ilibsparse/include \ | ||
| 39 | - -Ilibziparchive/include | ||
| 40 | + -Ilibziparchive/include -I$(OUT_DIR)/usr/include/ | ||
| 41 | LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 42 | -fuse-ld=gold \ | ||
| 43 | - -Wl,-rpath-link=. \ | ||
| 44 | - -L. -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \ | ||
| 45 | + -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 46 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \ | ||
| 47 | -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 48 | -l7z \ | ||
| 49 | |||
| 50 | @@ -53,7 +54,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),) | ||
| 51 | endif | ||
| 52 | |||
| 53 | build: $(SOURCES) | ||
| 54 | - $(CXX) $^ -o fastboot/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 55 | + mkdir --parents $(OUT_DIR)/usr/bin/ | ||
| 56 | + $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 57 | |||
| 58 | clean: | ||
| 59 | - $(RM) fastboot/$(NAME) | ||
| 60 | + $(RM) $(OUT_DIR)/usr/bin/$(NAME) | ||
| 61 | -- | ||
| 62 | 2.36.1.vfs.0.0 | ||
| 63 | |||
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 @@ | |||
| 1 | From a4839f29e1286b0c53208a45b9c237d81021f829 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:15:47 +0100 | ||
| 4 | Subject: [PATCH 05/15] fastboot: don't use sparse_file_import_auto() in | ||
| 5 | load_buf_fd() | ||
| 6 | |||
| 7 | upstream commit taken as below Original Issue link https://android-review.googlesource.com/c/platform/system/core/+/1123485 | ||
| 8 | |||
| 9 | Commit taken below: | ||
| 10 | |||
| 11 | fastboot: don't use sparse_file_import_auto() in load_buf_fd() | ||
| 12 | |||
| 13 | load_buf_fd() attempts to find the size of the file that it is about | ||
| 14 | to load by first calling sparse_file_import_auto() then using | ||
| 15 | sparse_file_len() upon success or falling back to the file size on the | ||
| 16 | filesystem on failure. | ||
| 17 | |||
| 18 | This is problematic however as sparse_file_import_auto() creates a | ||
| 19 | sparse_file out of the normal file, but does not resparse it, so an | ||
| 20 | assertion fails during the sparse_file_len() call. | ||
| 21 | |||
| 22 | This is fixed by using sparse_file_import() instead. This will fail | ||
| 23 | in the case that the file is not sparse and the call to | ||
| 24 | sparse_file_len() will be properly skipped. | ||
| 25 | |||
| 26 | Bug: 140538105 | ||
| 27 | Test: flash blueline factory image with assertions enabled in | ||
| 28 | libsparse/sparse.cpp | ||
| 29 | |||
| 30 | Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c | ||
| 31 | |||
| 32 | https://android.googlesource.com/platform/system/core/+/fbb9535aaea5ae4011f3c3edf4c00b27452f57ec | ||
| 33 | Upstream-Status: Backport [commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec] | ||
| 34 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 35 | --- | ||
| 36 | fastboot/fastboot.cpp | 2 +- | ||
| 37 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 38 | |||
| 39 | diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp | ||
| 40 | index 3b7b5571..0ae9402e 100644 | ||
| 41 | --- a/fastboot/fastboot.cpp | ||
| 42 | +++ b/fastboot/fastboot.cpp | ||
| 43 | @@ -869,7 +869,7 @@ static bool load_buf_fd(int fd, struct fastboot_buffer* buf) { | ||
| 44 | return false; | ||
| 45 | } | ||
| 46 | |||
| 47 | - if (sparse_file* s = sparse_file_import_auto(fd, false, false)) { | ||
| 48 | + if (sparse_file* s = sparse_file_import(fd, false, false)) { | ||
| 49 | buf->image_size = sparse_file_len(s, false, false); | ||
| 50 | sparse_file_destroy(s); | ||
| 51 | } else { | ||
| 52 | -- | ||
| 53 | 2.36.1.vfs.0.0 | ||
| 54 | |||
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 @@ | |||
| 1 | From 22c7140dc170ecb26bde33fed4c9249b164f8d3c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:19:08 +0100 | ||
| 4 | Subject: [PATCH 06/15] libbase.mk: modifications to make it build in yocto | ||
| 5 | environment | ||
| 6 | |||
| 7 | Adding an include file that is setting the common flags. | ||
| 8 | Changed the cppflag to include the headers from other components | ||
| 9 | of android-tools | ||
| 10 | |||
| 11 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 12 | are searched in the output folder. | ||
| 13 | |||
| 14 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 15 | |||
| 16 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 17 | --- | ||
| 18 | debian/libbase.mk | 8 +++++--- | ||
| 19 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/debian/libbase.mk b/debian/libbase.mk | ||
| 22 | index 80da48f3..e6c3e365 100644 | ||
| 23 | --- a/debian/libbase.mk | ||
| 24 | +++ b/debian/libbase.mk | ||
| 25 | @@ -1,3 +1,4 @@ | ||
| 26 | +include ../../rules_yocto.mk | ||
| 27 | NAME = libbase | ||
| 28 | SOURCES = \ | ||
| 29 | chrono_utils.cpp \ | ||
| 30 | @@ -20,8 +21,9 @@ CPPFLAGS += -Iinclude -Ibase/include | ||
| 31 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 | ||
| 32 | |||
| 33 | build: $(SOURCES) | ||
| 34 | - $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 35 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 36 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 37 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 38 | + cp -r base/include/* $(OUT_DIR)/usr/include/ | ||
| 39 | |||
| 40 | clean: | ||
| 41 | - $(RM) $(NAME).so* | ||
| 42 | + $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 43 | -- | ||
| 44 | 2.36.1.vfs.0.0 | ||
| 45 | |||
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 @@ | |||
| 1 | From cae154ec12a864ada8372b393fceb1d682c78c60 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 14:38:05 +0100 | ||
| 4 | Subject: [PATCH 07/15] libcrypto_utils.mk: modifications to make it build in | ||
| 5 | yocto environment | ||
| 6 | |||
| 7 | Adding an include file that is setting the common flags. | ||
| 8 | Changed the cppflag to include the headers from other components | ||
| 9 | of android-tools | ||
| 10 | |||
| 11 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 12 | are searched in the output folder. | ||
| 13 | |||
| 14 | Modified the build rule so that it outputs the binary and header to the OUT_DIR | ||
| 15 | |||
| 16 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 17 | --- | ||
| 18 | debian/libcrypto_utils.mk | 14 ++++++++------ | ||
| 19 | 1 file changed, 8 insertions(+), 6 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/debian/libcrypto_utils.mk b/debian/libcrypto_utils.mk | ||
| 22 | index 3afd4124..80c52f30 100644 | ||
| 23 | --- a/debian/libcrypto_utils.mk | ||
| 24 | +++ b/debian/libcrypto_utils.mk | ||
| 25 | @@ -1,15 +1,17 @@ | ||
| 26 | +include ../../rules_yocto.mk | ||
| 27 | NAME:= libcrypto_utils | ||
| 28 | SOURCES := android_pubkey.c | ||
| 29 | SOURCES := $(foreach source, $(SOURCES), libcrypto_utils/$(source)) | ||
| 30 | -CPPFLAGS += -Ilibcrypto_utils/include -Iinclude | ||
| 31 | +CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -I$(OUT_DIR)/usr/include | ||
| 32 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 33 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 34 | - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 35 | - -lcrypto -Wl,-z,defs | ||
| 36 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 37 | + -l:libcrypto.so.0 -Wl,-z,defs | ||
| 38 | |||
| 39 | build: $(SOURCES) | ||
| 40 | - $(CC) $^ -o $(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) | ||
| 41 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 42 | + $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) | ||
| 43 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 44 | + cp -r libcrypto_utils/include/* $(OUT_DIR)/usr/include/ | ||
| 45 | |||
| 46 | clean: | ||
| 47 | - $(RM) $(NAME).so* | ||
| 48 | + $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 49 | -- | ||
| 50 | 2.36.1.vfs.0.0 | ||
| 51 | |||
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 @@ | |||
| 1 | From 4af9cc9e93e5cb09583c0fedeccae3fa195dbe7b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:26:08 +0100 | ||
| 4 | Subject: [PATCH 08/15] libcutils: modifications to make it build in yocto | ||
| 5 | environment | ||
| 6 | --- | ||
| 7 | debian/libcutils.mk | 10 ++++++---- | ||
| 8 | 1 file changed, 6 insertions(+), 4 deletions(-) | ||
| 9 | |||
| 10 | diff --git a/debian/libcutils.mk b/debian/libcutils.mk | ||
| 11 | index 7cd18d87..bb45fb57 100644 | ||
| 12 | --- a/debian/libcutils.mk | ||
| 13 | +++ b/debian/libcutils.mk | ||
| 14 | @@ -1,3 +1,4 @@ | ||
| 15 | +include ../../rules_yocto.mk | ||
| 16 | NAME = libcutils | ||
| 17 | |||
| 18 | # copied from libcutils/Android.bp | ||
| 19 | @@ -50,14 +51,15 @@ CPPFLAGS += \ | ||
| 20 | -Iinclude \ | ||
| 21 | |||
| 22 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 23 | - -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -lpthread -L. -llog -lbase | ||
| 24 | + -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -llog -lbase | ||
| 25 | |||
| 26 | build: $(COBJECTS) $(CXXOBJECTS) | ||
| 27 | - $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) | ||
| 28 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 29 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) | ||
| 30 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 31 | + cp -r libcutils/include/cutils $(OUT_DIR)/usr/include/ | ||
| 32 | |||
| 33 | clean: | ||
| 34 | - $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so* | ||
| 35 | + $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 36 | |||
| 37 | $(COBJECTS): %.o: %.c | ||
| 38 | $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) | ||
| 39 | -- | ||
| 40 | 2.36.1.vfs.0.0 | ||
| 41 | |||
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 @@ | |||
| 1 | From bea40821d787ca31b38d5879fbf751be1dbea622 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:33:30 +0100 | ||
| 4 | Subject: [PATCH 09/15] patching img2simg.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/img2simg.mk | 11 ++++++----- | ||
| 24 | 1 file changed, 6 insertions(+), 5 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/img2simg.mk b/debian/img2simg.mk | ||
| 27 | index f1036cef..94772381 100644 | ||
| 28 | --- a/debian/img2simg.mk | ||
| 29 | +++ b/debian/img2simg.mk | ||
| 30 | @@ -1,13 +1,15 @@ | ||
| 31 | +include ../../rules_yocto.mk | ||
| 32 | NAME = img2simg | ||
| 33 | SOURCES = img2simg.cpp | ||
| 34 | SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) | ||
| 35 | CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 | ||
| 36 | -LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 37 | - -Wl,-rpath-link=. \ | ||
| 38 | - -L. -lsparse | ||
| 39 | +LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 40 | + -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ | ||
| 41 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lsparse | ||
| 42 | |||
| 43 | build: $(SOURCES) | ||
| 44 | - $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS) | ||
| 45 | + mkdir --parents $(OUT_DIR)/usr/bin | ||
| 46 | + $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS) | ||
| 47 | |||
| 48 | clean: | ||
| 49 | - $(RM) libsparse/$(NAME) | ||
| 50 | + $(RM) $(OUT_DIR)/usr/bin/$(NAME) | ||
| 51 | -- | ||
| 52 | 2.36.1.vfs.0.0 | ||
| 53 | |||
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 @@ | |||
| 1 | From 08441cf4334b911dba8c493dca3b1e2166c7d322 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:34:34 +0100 | ||
| 4 | Subject: [PATCH 10/15] patching simg2img.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/simg2img.mk | 11 ++++++----- | ||
| 24 | 1 file changed, 6 insertions(+), 5 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/simg2img.mk b/debian/simg2img.mk | ||
| 27 | index 07fb56b4..d319c87e 100644 | ||
| 28 | --- a/debian/simg2img.mk | ||
| 29 | +++ b/debian/simg2img.mk | ||
| 30 | @@ -1,13 +1,15 @@ | ||
| 31 | +include ../../rules_yocto.mk | ||
| 32 | NAME = simg2img | ||
| 33 | SOURCES = simg2img.cpp sparse_crc32.cpp | ||
| 34 | SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) | ||
| 35 | CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 | ||
| 36 | -LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 37 | - -Wl,-rpath-link=. \ | ||
| 38 | - -L. -lsparse | ||
| 39 | +LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 40 | + -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 41 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lsparse | ||
| 42 | |||
| 43 | build: $(SOURCES) | ||
| 44 | - $(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS) | ||
| 45 | + mkdir --parents $(OUT_DIR)/usr/bin | ||
| 46 | + $(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS) | ||
| 47 | |||
| 48 | clean: | ||
| 49 | - $(RM) libsparse/$(NAME) | ||
| 50 | + $(RM) $(OUT_DIR)/usr/bin/$(NAME) | ||
| 51 | -- | ||
| 52 | 2.36.1.vfs.0.0 | ||
| 53 | |||
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 @@ | |||
| 1 | From 99e46ec157e6fb912258ac6506896196e53d790b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:35:44 +0100 | ||
| 4 | Subject: [PATCH 11/15] patching liblog.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/liblog.mk | 8 +++++--- | ||
| 24 | 1 file changed, 5 insertions(+), 3 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/liblog.mk b/debian/liblog.mk | ||
| 27 | index eb1909b9..3b40d710 100644 | ||
| 28 | --- a/debian/liblog.mk | ||
| 29 | +++ b/debian/liblog.mk | ||
| 30 | @@ -1,3 +1,4 @@ | ||
| 31 | +include ../../rules_yocto.mk | ||
| 32 | NAME = liblog | ||
| 33 | |||
| 34 | # copied from liblog/Android.bp | ||
| 35 | @@ -39,11 +40,12 @@ CPPFLAGS += \ | ||
| 36 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 -lpthread | ||
| 37 | |||
| 38 | build: $(COBJECTS) $(CXXOBJECTS) | ||
| 39 | - $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) | ||
| 40 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 41 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) | ||
| 42 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 43 | + cp -r liblog/include/* $(OUT_DIR)/usr/include/ | ||
| 44 | |||
| 45 | clean: | ||
| 46 | - $(RM) $(COBJECTS) $(CXXOBJECTS) $(NAME).so* | ||
| 47 | + $(RM) $(COBJECTS) $(CXXOBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 48 | |||
| 49 | $(COBJECTS): %.o: %.c | ||
| 50 | $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) | ||
| 51 | -- | ||
| 52 | 2.36.1.vfs.0.0 | ||
| 53 | |||
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 @@ | |||
| 1 | From 65ddf7ea7daae721b2d331164155542820ed3e33 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:36:58 +0100 | ||
| 4 | Subject: [PATCH 12/15] patching libsparse.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/libsparse.mk | 9 +++++---- | ||
| 24 | 1 file changed, 5 insertions(+), 4 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/libsparse.mk b/debian/libsparse.mk | ||
| 27 | index de280def..64caa45f 100644 | ||
| 28 | --- a/debian/libsparse.mk | ||
| 29 | +++ b/debian/libsparse.mk | ||
| 30 | @@ -1,3 +1,4 @@ | ||
| 31 | +include ../../rules_yocto.mk | ||
| 32 | NAME = libsparse | ||
| 33 | SOURCES = \ | ||
| 34 | backed_block.cpp \ | ||
| 35 | @@ -18,16 +19,16 @@ LDFLAGS += \ | ||
| 36 | -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 37 | -lz \ | ||
| 38 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 39 | - -L. \ | ||
| 40 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ | ||
| 41 | -lbase | ||
| 42 | |||
| 43 | |||
| 44 | build: $(COBJECTS) $(CXXOBJECTS) | ||
| 45 | - $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) | ||
| 46 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 47 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) | ||
| 48 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 49 | |||
| 50 | clean: | ||
| 51 | - $(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so* | ||
| 52 | + $(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 53 | |||
| 54 | $(COBJECTS): %.o: %.c | ||
| 55 | $(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS) | ||
| 56 | -- | ||
| 57 | 2.36.1.vfs.0.0 | ||
| 58 | |||
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 @@ | |||
| 1 | From ae2bf1925fe02ea040005df27842c77c6d02b051 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:39:24 +0100 | ||
| 4 | Subject: [PATCH 13/15] patching libziparchive.mk to build in yocto | ||
| 5 | environment. | ||
| 6 | |||
| 7 | Changes include: | ||
| 8 | Introduced an output folder which will keep all the outputs from the | ||
| 9 | android-tools. | ||
| 10 | |||
| 11 | Adding an include file that is setting the common flags. | ||
| 12 | Changed the cppflag to include the headers from other components | ||
| 13 | of android-tools | ||
| 14 | |||
| 15 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 16 | are searched in the output folder. | ||
| 17 | |||
| 18 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 19 | |||
| 20 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 21 | |||
| 22 | Upstream-Status: Pending | ||
| 23 | --- | ||
| 24 | debian/libziparchive.mk | 12 +++++++----- | ||
| 25 | 1 file changed, 7 insertions(+), 5 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/debian/libziparchive.mk b/debian/libziparchive.mk | ||
| 28 | index 803ea58e..6a697059 100644 | ||
| 29 | --- a/debian/libziparchive.mk | ||
| 30 | +++ b/debian/libziparchive.mk | ||
| 31 | @@ -1,3 +1,4 @@ | ||
| 32 | +include ../../rules_yocto.mk | ||
| 33 | NAME = libziparchive | ||
| 34 | SOURCES = zip_archive.cc \ | ||
| 35 | zip_archive_stream_entry.cc\ | ||
| 36 | @@ -5,14 +6,15 @@ SOURCES = zip_archive.cc \ | ||
| 37 | SOURCES := $(foreach source, $(SOURCES), libziparchive/$(source)) | ||
| 38 | CXXFLAGS += -std=gnu++17 | ||
| 39 | CPPFLAGS += -DZLIB_CONST -D_FILE_OFFSET_BITS=64 \ | ||
| 40 | - -Iinclude -Ibase/include -Ilibziparchive/include | ||
| 41 | + -Iinclude -Ibase/include -Ilibziparchive/include -I$(OUT_DIR)/usr/include/ | ||
| 42 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 43 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 44 | - -lz -L. -llog -lbase | ||
| 45 | + -lz -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -llog -lbase | ||
| 46 | |||
| 47 | build: $(SOURCES) | ||
| 48 | - $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 49 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 50 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) | ||
| 51 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 52 | + cp -r libziparchive/include/* $(OUT_DIR)/usr/include/ | ||
| 53 | |||
| 54 | clean: | ||
| 55 | - $(RM) $(NAME).so* | ||
| 56 | + $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 57 | -- | ||
| 58 | 2.36.1.vfs.0.0 | ||
| 59 | |||
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 @@ | |||
| 1 | From a99b74f25c7f786e26b5400218090d86596d4541 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:40:32 +0100 | ||
| 4 | Subject: [PATCH 14/15] patching libbacktrace.mk to build in yocto environment. | ||
| 5 | |||
| 6 | Changes include: | ||
| 7 | Introduced an output folder which will keep all the outputs from the | ||
| 8 | android-tools. | ||
| 9 | |||
| 10 | Adding an include file that is setting the common flags. | ||
| 11 | Changed the cppflag to include the headers from other components | ||
| 12 | of android-tools | ||
| 13 | |||
| 14 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 15 | are searched in the output folder. | ||
| 16 | |||
| 17 | Modified the build rule so that it outputs the binary to the OUT_DIR | ||
| 18 | |||
| 19 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 20 | |||
| 21 | Upstream-Status: Pending | ||
| 22 | --- | ||
| 23 | debian/libbacktrace.mk | 14 +++++++------- | ||
| 24 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/debian/libbacktrace.mk b/debian/libbacktrace.mk | ||
| 27 | index 330d211c..229b39d9 100644 | ||
| 28 | --- a/debian/libbacktrace.mk | ||
| 29 | +++ b/debian/libbacktrace.mk | ||
| 30 | @@ -1,5 +1,5 @@ | ||
| 31 | |||
| 32 | -include /usr/share/dpkg/architecture.mk | ||
| 33 | +include ../../rules_yocto.mk | ||
| 34 | |||
| 35 | NAME = libbacktrace | ||
| 36 | |||
| 37 | @@ -88,11 +88,11 @@ CPPFLAGS += \ | ||
| 38 | -Ilibprocinfo/include \ | ||
| 39 | -Ilibunwindstack/include \ | ||
| 40 | -I/usr/include/android/lzma \ | ||
| 41 | - -I/usr/include/android/unwind | ||
| 42 | + -I$(OUT_DIR)/usr/include/android/libunwind | ||
| 43 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 44 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 45 | - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android -lunwind \ | ||
| 46 | - -L. -lbase -llog -lpthread -l7z | ||
| 47 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lunwind \ | ||
| 48 | + -lbase -llog -lpthread -l7z | ||
| 49 | |||
| 50 | # -latomic should be the last library specified | ||
| 51 | # https://github.com/android/ndk/issues/589 | ||
| 52 | @@ -104,11 +104,11 @@ ifeq ($(DEB_HOST_ARCH), mipsel) | ||
| 53 | endif | ||
| 54 | |||
| 55 | build: $(COBJECTS) $(CXXOBJECTS) $(OBJECTS_ASSEMBLY) | ||
| 56 | - $(CXX) $^ -o $(NAME).so.0 $(LDFLAGS) | ||
| 57 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 58 | + $(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS) | ||
| 59 | + ln -sf $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(NAME).so | ||
| 60 | |||
| 61 | clean: | ||
| 62 | - $(RM) $(COBJECTS) $(CXXOBJECTS) $(NAME).so* | ||
| 63 | + $(RM) $(COBJECTS) $(CXXOBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
| 64 | |||
| 65 | $(CXXOBJECTS): %.o: %.cpp | ||
| 66 | $(CXX) $< -o $@ $(CXXFLAGS) $(CPPFLAGS) | ||
| 67 | -- | ||
| 68 | 2.36.1.vfs.0.0 | ||
| 69 | |||
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 @@ | |||
| 1 | From 19a16829ef7b7ffd6466b9b90585d667a1663969 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Fri, 3 Mar 2023 13:43:50 +0100 | ||
| 4 | Subject: [PATCH 15/15] Use namespace std to compile libbacktrace | ||
| 5 | |||
| 6 | To Fix the below error | ||
| 7 | |||
| 8 | In file included from libunwindstack/DwarfSection.cpp:21: | ||
| 9 | | libunwindstack/include/unwindstack/DwarfMemory.h:32:29: error: unknown type name 'size_t'; did you mean 'std::size_t'? | ||
| 10 | | bool ReadBytes(void* dst, size_t num_bytes); | ||
| 11 | | ^~~~~~ | ||
| 12 | | std::size_t | ||
| 13 | --- | ||
| 14 | libunwindstack/include/unwindstack/DwarfMemory.h | 2 +- | ||
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/libunwindstack/include/unwindstack/DwarfMemory.h b/libunwindstack/include/unwindstack/DwarfMemory.h | ||
| 18 | index 244c0e12..0a3fefeb 100644 | ||
| 19 | --- a/libunwindstack/include/unwindstack/DwarfMemory.h | ||
| 20 | +++ b/libunwindstack/include/unwindstack/DwarfMemory.h | ||
| 21 | @@ -23,7 +23,7 @@ namespace unwindstack { | ||
| 22 | |||
| 23 | // Forward declarations. | ||
| 24 | class Memory; | ||
| 25 | - | ||
| 26 | +using namespace std; | ||
| 27 | class DwarfMemory { | ||
| 28 | public: | ||
| 29 | DwarfMemory(Memory* memory) : memory_(memory) {} | ||
| 30 | -- | ||
| 31 | 2.36.1.vfs.0.0 | ||
| 32 | |||
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 @@ | |||
| 1 | From fbbcb1a9359b5bf0c09bcf56b149594473f91e3a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Wed, 8 Mar 2023 15:21:49 +0100 | ||
| 4 | Subject: [PATCH] Adapt adbd to work with yocto | ||
| 5 | |||
| 6 | - remove TMPDIR which is used by commands like mktemp (set to /data/local/tmp in android | ||
| 7 | but vanilla linux uses /tmp per default) | ||
| 8 | - define PS1 which was missing | ||
| 9 | - remove android header-files and make adbd compile with yocto | ||
| 10 | |||
| 11 | Co-authored-by: JJ Robertson <jrobertson@snap.com> | ||
| 12 | Co-authored-by: Wejdene Smida <wsmida@snap.com> | ||
| 13 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 14 | |||
| 15 | --- | ||
| 16 | adb/daemon/file_sync_service.cpp | 4 ++-- | ||
| 17 | adb/daemon/main.cpp | 4 ++-- | ||
| 18 | adb/daemon/reboot_service.cpp | 5 ++++- | ||
| 19 | adb/daemon/set_verity_enable_state_service.cpp | 6 +++++- | ||
| 20 | adb/daemon/shell_service.cpp | 5 ++++- | ||
| 21 | adb/types.h | 1 + | ||
| 22 | 6 files changed, 18 insertions(+), 7 deletions(-) | ||
| 23 | |||
| 24 | diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp | ||
| 25 | index e82a51f2..ba112cbe 100644 | ||
| 26 | --- a/adb/daemon/file_sync_service.cpp | ||
| 27 | +++ b/adb/daemon/file_sync_service.cpp | ||
| 28 | @@ -111,7 +111,7 @@ static bool secure_mkdirs(const std::string& path) { | ||
| 29 | partial_path += path_component; | ||
| 30 | |||
| 31 | if (should_use_fs_config(partial_path)) { | ||
| 32 | - fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); | ||
| 33 | + // fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities); | ||
| 34 | } | ||
| 35 | if (adb_mkdir(partial_path.c_str(), mode) == -1) { | ||
| 36 | if (errno != EEXIST) { | ||
| 37 | @@ -434,7 +434,7 @@ static bool do_send(int s, const std::string& spec, std::vector<char>& buffer) { | ||
| 38 | uint64_t capabilities = 0; | ||
| 39 | if (should_use_fs_config(path)) { | ||
| 40 | unsigned int broken_api_hack = mode; | ||
| 41 | - fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); | ||
| 42 | + // fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities); | ||
| 43 | mode = broken_api_hack; | ||
| 44 | } | ||
| 45 | |||
| 46 | diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp | ||
| 47 | index e5a49171..c75263c4 100644 | ||
| 48 | --- a/adb/daemon/main.cpp | ||
| 49 | +++ b/adb/daemon/main.cpp | ||
| 50 | @@ -191,6 +191,8 @@ int adbd_main(int server_port) { | ||
| 51 | umask(0); | ||
| 52 | |||
| 53 | signal(SIGPIPE, SIG_IGN); | ||
| 54 | + signal(SIGINT, SIG_DFL); | ||
| 55 | + signal(SIGQUIT, SIG_DFL); | ||
| 56 | |||
| 57 | #if defined(__BIONIC__) | ||
| 58 | auto fdsan_level = android_fdsan_get_error_level(); | ||
| 59 | @@ -232,13 +234,11 @@ int adbd_main(int server_port) { | ||
| 60 | |||
| 61 | bool is_usb = false; | ||
| 62 | |||
| 63 | -#if defined(__ANDROID__) | ||
| 64 | if (access(USB_FFS_ADB_EP0, F_OK) == 0) { | ||
| 65 | // Listen on USB. | ||
| 66 | usb_init(); | ||
| 67 | is_usb = true; | ||
| 68 | } | ||
| 69 | -#endif | ||
| 70 | |||
| 71 | // If one of these properties is set, also listen on that port. | ||
| 72 | // If one of the properties isn't set and we couldn't listen on usb, listen | ||
| 73 | diff --git a/adb/daemon/reboot_service.cpp b/adb/daemon/reboot_service.cpp | ||
| 74 | index a5a11b86..6bd069d4 100644 | ||
| 75 | --- a/adb/daemon/reboot_service.cpp | ||
| 76 | +++ b/adb/daemon/reboot_service.cpp | ||
| 77 | @@ -28,7 +28,9 @@ | ||
| 78 | #include <android-base/logging.h> | ||
| 79 | #include <android-base/properties.h> | ||
| 80 | #include <android-base/stringprintf.h> | ||
| 81 | -#include <bootloader_message/bootloader_message.h> | ||
| 82 | +// #include <bootloader_message/bootloader_message.h> | ||
| 83 | +#include <linux/reboot.h> | ||
| 84 | +#include <sys/signal.h> | ||
| 85 | #include <cutils/android_reboot.h> | ||
| 86 | |||
| 87 | #include "adb_io.h" | ||
| 88 | @@ -76,6 +78,7 @@ void reboot_service(unique_fd fd, const std::string& arg) { | ||
| 89 | return; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | + syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_arg.c_str()); | ||
| 93 | // Don't return early. Give the reboot command time to take effect | ||
| 94 | // to avoid messing up scripts which do "adb reboot && adb wait-for-device" | ||
| 95 | while (true) { | ||
| 96 | diff --git a/adb/daemon/set_verity_enable_state_service.cpp b/adb/daemon/set_verity_enable_state_service.cpp | ||
| 97 | index 889229fe..51e9be93 100644 | ||
| 98 | --- a/adb/daemon/set_verity_enable_state_service.cpp | ||
| 99 | +++ b/adb/daemon/set_verity_enable_state_service.cpp | ||
| 100 | @@ -22,7 +22,7 @@ | ||
| 101 | #include <errno.h> | ||
| 102 | #include <fcntl.h> | ||
| 103 | #include <inttypes.h> | ||
| 104 | -#include <libavb_user/libavb_user.h> | ||
| 105 | +// #include <libavb_user/libavb_user.h> | ||
| 106 | #include <stdarg.h> | ||
| 107 | #include <stdio.h> | ||
| 108 | #include <sys/mount.h> | ||
| 109 | @@ -65,6 +65,7 @@ static bool make_block_device_writable(const std::string& dev) { | ||
| 110 | /* Turn verity on/off */ | ||
| 111 | static bool set_verity_enabled_state(int fd, const char* block_device, const char* mount_point, | ||
| 112 | bool enable) { | ||
| 113 | +#if defined(__ANDROID__) | ||
| 114 | if (!make_block_device_writable(block_device)) { | ||
| 115 | WriteFdFmt(fd, "Could not make block device %s writable (%s).\n", | ||
| 116 | block_device, strerror(errno)); | ||
| 117 | @@ -115,6 +116,7 @@ static bool set_verity_enabled_state(int fd, const char* block_device, const cha | ||
| 118 | mount_point, strerror(errno)); | ||
| 119 | } | ||
| 120 | WriteFdFmt(fd, "Verity %s on %s\n", enable ? "enabled" : "disabled", mount_point); | ||
| 121 | +#endif | ||
| 122 | return true; | ||
| 123 | } | ||
| 124 | |||
| 125 | @@ -126,6 +128,7 @@ static std::string get_ab_suffix() { | ||
| 126 | return android::base::GetProperty("ro.boot.slot_suffix", ""); | ||
| 127 | } | ||
| 128 | |||
| 129 | +#if defined(__ANDROID__) | ||
| 130 | static bool is_avb_device_locked() { | ||
| 131 | return android::base::GetProperty("ro.boot.vbmeta.device_state", "") == "locked"; | ||
| 132 | } | ||
| 133 | @@ -245,3 +248,4 @@ void set_verity_enabled_state_service(unique_fd fd, bool enable) { | ||
| 134 | WriteFdExactly(fd.get(), "Now reboot your device for settings to take effect\n"); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | +#endif | ||
| 138 | diff --git a/adb/daemon/shell_service.cpp b/adb/daemon/shell_service.cpp | ||
| 139 | index 3c8f3939..355c1a1c 100644 | ||
| 140 | --- a/adb/daemon/shell_service.cpp | ||
| 141 | +++ b/adb/daemon/shell_service.cpp | ||
| 142 | @@ -261,9 +261,12 @@ bool Subprocess::ForkAndExec(std::string* error) { | ||
| 143 | env["HOSTNAME"] = GetHostName(); | ||
| 144 | env["LOGNAME"] = pw->pw_name; | ||
| 145 | env["SHELL"] = pw->pw_shell; | ||
| 146 | - env["TMPDIR"] = "/data/local/tmp"; | ||
| 147 | env["USER"] = pw->pw_name; | ||
| 148 | } | ||
| 149 | + if (env.find("PS1") == env.end()) { | ||
| 150 | + env["PS1"] = "\\h:\\w\\$ "; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | |||
| 154 | if (!terminal_type_.empty()) { | ||
| 155 | env["TERM"] = terminal_type_; | ||
| 156 | diff --git a/adb/types.h b/adb/types.h | ||
| 157 | index 6af4a150..9efe223b 100644 | ||
| 158 | --- a/adb/types.h | ||
| 159 | +++ b/adb/types.h | ||
| 160 | @@ -20,6 +20,7 @@ | ||
| 161 | #include <cstring> | ||
| 162 | #include <deque> | ||
| 163 | #include <memory> | ||
| 164 | +#include <string> | ||
| 165 | #include <type_traits> | ||
| 166 | #include <utility> | ||
| 167 | #include <vector> | ||
| 168 | -- | ||
| 169 | 2.36.1.vfs.0.0 | ||
| 170 | |||
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 @@ | |||
| 1 | From 25bd3456dcd539b89648273152e405314287f4f8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Mon, 13 Mar 2023 13:46:14 +0100 | ||
| 4 | Subject: [PATCH 2/2] img2simg: Fix wrong rpath and re-add libbase | ||
| 5 | |||
| 6 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 7 | --- | ||
| 8 | debian/img2simg.mk | 2 +- | ||
| 9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 10 | |||
| 11 | diff --git a/debian/img2simg.mk b/debian/img2simg.mk | ||
| 12 | index d1b9b927..459af454 100644 | ||
| 13 | --- a/debian/img2simg.mk | ||
| 14 | +++ b/debian/img2simg.mk | ||
| 15 | @@ -3,7 +3,7 @@ NAME = img2simg | ||
| 16 | SOURCES = img2simg.cpp | ||
| 17 | SOURCES := $(foreach source, $(SOURCES), libsparse/$(source)) | ||
| 18 | CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17 | ||
| 19 | -LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 20 | +LDFLAGS += -Wl,-rpath='$$ORIGIN/../lib/android' -lbase \ | ||
| 21 | -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \ | ||
| 22 | -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -lsparse | ||
| 23 | |||
| 24 | -- | ||
| 25 | 2.36.1.vfs.0.0 | ||
| 26 | |||
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 @@ | |||
| 1 | From d198ecb4c36b645e5428aa5117f7673bf2f7a3e6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 3 | Date: Tue, 14 Mar 2023 11:42:08 +0100 | ||
| 4 | Subject: [PATCH] Fix compilation with gcc | ||
| 5 | |||
| 6 | Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> | ||
| 7 | --- | ||
| 8 | adb/adb_listeners.cpp | 18 ++++++++++++------ | ||
| 9 | adb/daemon/auth.cpp | 3 ++- | ||
| 10 | adb/daemon/usb.cpp | 3 ++- | ||
| 11 | adb/fdevent.cpp | 3 ++- | ||
| 12 | adb/transport_fd.cpp | 3 ++- | ||
| 13 | adb/transport_local.cpp | 3 ++- | ||
| 14 | 6 files changed, 22 insertions(+), 11 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/adb/adb_listeners.cpp b/adb/adb_listeners.cpp | ||
| 17 | index 29909a55..fbdf4487 100644 | ||
| 18 | --- a/adb/adb_listeners.cpp | ||
| 19 | +++ b/adb/adb_listeners.cpp | ||
| 20 | @@ -109,7 +109,8 @@ static void listener_event_func(int _fd, unsigned ev, void* _l) | ||
| 21 | } | ||
| 22 | |||
| 23 | // Called as a transport disconnect function. |arg| is the raw alistener*. | ||
| 24 | -static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_mutex) { | ||
| 25 | + EXCLUDES(listener_list_mutex) | ||
| 26 | +static void listener_disconnect(void* arg, atransport*) { | ||
| 27 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 28 | for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { | ||
| 29 | if (iter->get() == arg) { | ||
| 30 | @@ -121,7 +122,8 @@ static void listener_disconnect(void* arg, atransport*) EXCLUDES(listener_list_m | ||
| 31 | } | ||
| 32 | |||
| 33 | // Write the list of current listeners (network redirections) into a string. | ||
| 34 | -std::string format_listeners() EXCLUDES(listener_list_mutex) { | ||
| 35 | +EXCLUDES(listener_list_mutex) | ||
| 36 | +std::string format_listeners() { | ||
| 37 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 38 | std::string result; | ||
| 39 | for (auto& l : listener_list) { | ||
| 40 | @@ -139,8 +141,9 @@ std::string format_listeners() EXCLUDES(listener_list_mutex) { | ||
| 41 | return result; | ||
| 42 | } | ||
| 43 | |||
| 44 | +EXCLUDES(listener_list_mutex) | ||
| 45 | InstallStatus remove_listener(const char* local_name, atransport* transport) | ||
| 46 | - EXCLUDES(listener_list_mutex) { | ||
| 47 | +{ | ||
| 48 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 49 | for (auto iter = listener_list.begin(); iter != listener_list.end(); ++iter) { | ||
| 50 | if (local_name == (*iter)->local_name) { | ||
| 51 | @@ -151,7 +154,8 @@ InstallStatus remove_listener(const char* local_name, atransport* transport) | ||
| 52 | return INSTALL_STATUS_LISTENER_NOT_FOUND; | ||
| 53 | } | ||
| 54 | |||
| 55 | -void remove_all_listeners() EXCLUDES(listener_list_mutex) { | ||
| 56 | +EXCLUDES(listener_list_mutex) | ||
| 57 | +void remove_all_listeners() { | ||
| 58 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 59 | auto iter = listener_list.begin(); | ||
| 60 | while (iter != listener_list.end()) { | ||
| 61 | @@ -164,7 +168,8 @@ void remove_all_listeners() EXCLUDES(listener_list_mutex) { | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | -void close_smartsockets() EXCLUDES(listener_list_mutex) { | ||
| 66 | +EXCLUDES(listener_list_mutex) | ||
| 67 | +void close_smartsockets() { | ||
| 68 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 69 | auto pred = [](const std::unique_ptr<alistener>& listener) { | ||
| 70 | return listener->local_name == "*smartsocket*"; | ||
| 71 | @@ -172,9 +177,10 @@ void close_smartsockets() EXCLUDES(listener_list_mutex) { | ||
| 72 | listener_list.remove_if(pred); | ||
| 73 | } | ||
| 74 | |||
| 75 | +EXCLUDES(listener_list_mutex) | ||
| 76 | InstallStatus install_listener(const std::string& local_name, const char* connect_to, | ||
| 77 | atransport* transport, int no_rebind, int* resolved_tcp_port, | ||
| 78 | - std::string* error) EXCLUDES(listener_list_mutex) { | ||
| 79 | + std::string* error) { | ||
| 80 | std::lock_guard<std::mutex> lock(listener_list_mutex); | ||
| 81 | for (auto& l : listener_list) { | ||
| 82 | if (local_name == l->local_name) { | ||
| 83 | diff --git a/adb/daemon/auth.cpp b/adb/daemon/auth.cpp | ||
| 84 | index a18afa4e..0fd60a1f 100644 | ||
| 85 | --- a/adb/daemon/auth.cpp | ||
| 86 | +++ b/adb/daemon/auth.cpp | ||
| 87 | @@ -98,8 +98,9 @@ bool adbd_auth_verify(const char* token, size_t token_size, const std::string& s | ||
| 88 | return false; | ||
| 89 | } | ||
| 90 | |||
| 91 | +REQUIRES(framework_mutex) | ||
| 92 | static bool adbd_send_key_message_locked(std::string_view msg_type, std::string_view key) | ||
| 93 | - REQUIRES(framework_mutex) { | ||
| 94 | +{ | ||
| 95 | if (framework_fd < 0) { | ||
| 96 | LOG(ERROR) << "Client not connected to send msg_type " << msg_type; | ||
| 97 | return false; | ||
| 98 | diff --git a/adb/daemon/usb.cpp b/adb/daemon/usb.cpp | ||
| 99 | index 1abae87c..3a466782 100644 | ||
| 100 | --- a/adb/daemon/usb.cpp | ||
| 101 | +++ b/adb/daemon/usb.cpp | ||
| 102 | @@ -628,7 +628,8 @@ struct UsbFfsConnection : public Connection { | ||
| 103 | return CreateWriteBlock(std::move(block), 0, len, id); | ||
| 104 | } | ||
| 105 | |||
| 106 | - void SubmitWrites() REQUIRES(write_mutex_) { | ||
| 107 | + REQUIRES(write_mutex_) | ||
| 108 | + void SubmitWrites() { | ||
| 109 | if (writes_submitted_ == kUsbWriteQueueDepth) { | ||
| 110 | return; | ||
| 111 | } | ||
| 112 | diff --git a/adb/fdevent.cpp b/adb/fdevent.cpp | ||
| 113 | index 32f90863..bff24544 100644 | ||
| 114 | --- a/adb/fdevent.cpp | ||
| 115 | +++ b/adb/fdevent.cpp | ||
| 116 | @@ -376,7 +376,8 @@ static void fdevent_call_fdfunc(fdevent* fde) { | ||
| 117 | fde->func); | ||
| 118 | } | ||
| 119 | |||
| 120 | -static void fdevent_run_flush() EXCLUDES(run_queue_mutex) { | ||
| 121 | +EXCLUDES(run_queue_mutex) | ||
| 122 | +static void fdevent_run_flush() { | ||
| 123 | // We need to be careful around reentrancy here, since a function we call can queue up another | ||
| 124 | // function. | ||
| 125 | while (true) { | ||
| 126 | diff --git a/adb/transport_fd.cpp b/adb/transport_fd.cpp | ||
| 127 | index a93e68a0..c5af09ff 100644 | ||
| 128 | --- a/adb/transport_fd.cpp | ||
| 129 | +++ b/adb/transport_fd.cpp | ||
| 130 | @@ -168,7 +168,8 @@ struct NonblockingFdConnection : public Connection { | ||
| 131 | TryAgain, | ||
| 132 | }; | ||
| 133 | |||
| 134 | - WriteResult DispatchWrites() REQUIRES(write_mutex_) { | ||
| 135 | + REQUIRES(write_mutex_) | ||
| 136 | + WriteResult DispatchWrites() { | ||
| 137 | CHECK(!write_buffer_.empty()); | ||
| 138 | auto iovs = write_buffer_.iovecs(); | ||
| 139 | ssize_t rc = adb_writev(fd_.get(), iovs.data(), iovs.size()); | ||
| 140 | diff --git a/adb/transport_local.cpp b/adb/transport_local.cpp | ||
| 141 | index b9f738df..a273e8f7 100644 | ||
| 142 | --- a/adb/transport_local.cpp | ||
| 143 | +++ b/adb/transport_local.cpp | ||
| 144 | @@ -345,8 +345,9 @@ struct EmulatorConnection : public FdConnection { | ||
| 145 | }; | ||
| 146 | |||
| 147 | /* Only call this function if you already hold local_transports_lock. */ | ||
| 148 | +REQUIRES(local_transports_lock) | ||
| 149 | static atransport* find_emulator_transport_by_adb_port_locked(int adb_port) | ||
| 150 | - REQUIRES(local_transports_lock) { | ||
| 151 | +{ | ||
| 152 | auto it = local_transports.find(adb_port); | ||
| 153 | if (it == local_transports.end()) { | ||
| 154 | return nullptr; | ||
| 155 | -- | ||
| 156 | 2.36.1.vfs.0.0 | ||
| 157 | |||
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 @@ | |||
| 1 | From: Guo Ren <guoren@linux.alibaba.com> | ||
| 2 | Date: Wed, 29 Jun 2022 16:46:46 +0800 | ||
| 3 | Subject: Add riscv64 support | ||
| 4 | |||
| 5 | This patch contains the dwarf unwind support for 64bit risc-v. | ||
| 6 | |||
| 7 | * DwarfCfa.cpp (cfa_def_cfa_register): setup register if CFA_REG is | ||
| 8 | not setup for riscv64 | ||
| 9 | * Elf.cpp (GetRelPc): convert offset to virtual address for riscv64. | ||
| 10 | * ElfInterface.cpp (GetVirtAddrFromOffset): New for riscv64. | ||
| 11 | * RegsRiscv64.cpp (StepIfSignalHandler): Fix signal frame check. | ||
| 12 | libunwindstack/include/unwindstack/ | ||
| 13 | * ElfInterface.h (GetVirtAddrFromOffset): New for riscv64. | ||
| 14 | libunwindstack/tests/ | ||
| 15 | * DwarfCfaTest.cpp (cfa_def_cfa_register): ok for riscv64. | ||
| 16 | * RegsStepIfSignalHandlerTest.cpp (riscv64_step_if_signal_handler): Fix | ||
| 17 | testcase for riscv64 | ||
| 18 | |||
| 19 | Test: Builds. | ||
| 20 | Test: All unit tests pass. | ||
| 21 | |||
| 22 | Signed-off-by: Guo Ren <guoren@linux.alibaba.com> | ||
| 23 | Signed-off-by: Lifang Xia <lifang_xia@linux.alibaba.com> | ||
| 24 | Signed-off-by: Mao Han <han_mao@linux.alibaba.com> | ||
| 25 | Change-Id: Ib21ddf23cc83f332af202df7bffcaceec16063e0 | ||
| 26 | --- | ||
| 27 | system/core/libunwindstack/Android.bp | 1 + | ||
| 28 | system/core/libunwindstack/Elf.cpp | 2 + | ||
| 29 | system/core/libunwindstack/Regs.cpp | 10 ++ | ||
| 30 | system/core/libunwindstack/RegsRiscv64.cpp | 156 +++++++++++++++++++++ | ||
| 31 | .../core/libunwindstack/include/unwindstack/Elf.h | 5 + | ||
| 32 | .../include/unwindstack/MachineRiscv64.h | 59 ++++++++ | ||
| 33 | .../include/unwindstack/RegsGetLocal.h | 43 ++++++ | ||
| 34 | .../include/unwindstack/RegsRiscv64.h | 59 ++++++++ | ||
| 35 | .../include/unwindstack/UcontextRiscv64.h | 80 +++++++++++ | ||
| 36 | .../include/unwindstack/UserRiscv64.h | 37 +++++ | ||
| 37 | system/core/libunwindstack/tools/unwind.cpp | 3 + | ||
| 38 | .../core/libunwindstack/tools/unwind_symbols.cpp | 3 + | ||
| 39 | 12 files changed, 458 insertions(+) | ||
| 40 | create mode 100644 system/core/libunwindstack/RegsRiscv64.cpp | ||
| 41 | create mode 100644 system/core/libunwindstack/include/unwindstack/MachineRiscv64.h | ||
| 42 | create mode 100644 system/core/libunwindstack/include/unwindstack/RegsRiscv64.h | ||
| 43 | create mode 100644 system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h | ||
| 44 | create mode 100644 system/core/libunwindstack/include/unwindstack/UserRiscv64.h | ||
| 45 | |||
| 46 | diff --git a/system/core/libunwindstack/Android.bp b/system/core/libunwindstack/Android.bp | ||
| 47 | index 3695f72..f1f9c68 100644 | ||
| 48 | --- a/system/core/libunwindstack/Android.bp | ||
| 49 | +++ b/system/core/libunwindstack/Android.bp | ||
| 50 | @@ -70,6 +70,7 @@ cc_library { | ||
| 51 | "RegsArm64.cpp", | ||
| 52 | "RegsX86.cpp", | ||
| 53 | "RegsX86_64.cpp", | ||
| 54 | + "RegsRiscv64.cpp", | ||
| 55 | "RegsMips.cpp", | ||
| 56 | "RegsMips64.cpp", | ||
| 57 | "Unwinder.cpp", | ||
| 58 | diff --git a/system/core/libunwindstack/Elf.cpp b/system/core/libunwindstack/Elf.cpp | ||
| 59 | index f01b092..3c2088b 100644 | ||
| 60 | --- a/system/core/libunwindstack/Elf.cpp | ||
| 61 | +++ b/system/core/libunwindstack/Elf.cpp | ||
| 62 | @@ -290,6 +290,8 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { | ||
| 63 | arch_ = ARCH_X86_64; | ||
| 64 | } else if (e_machine == EM_MIPS) { | ||
| 65 | arch_ = ARCH_MIPS64; | ||
| 66 | + } else if (e_machine == EM_RISCV) { | ||
| 67 | + arch_ = ARCH_RISCV64; | ||
| 68 | } else { | ||
| 69 | // Unsupported. | ||
| 70 | ALOGI("64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = %d\n", | ||
| 71 | diff --git a/system/core/libunwindstack/Regs.cpp b/system/core/libunwindstack/Regs.cpp | ||
| 72 | index c7dec52..447a554 100644 | ||
| 73 | --- a/system/core/libunwindstack/Regs.cpp | ||
| 74 | +++ b/system/core/libunwindstack/Regs.cpp | ||
| 75 | @@ -27,12 +27,14 @@ | ||
| 76 | #include <unwindstack/RegsArm64.h> | ||
| 77 | #include <unwindstack/RegsMips.h> | ||
| 78 | #include <unwindstack/RegsMips64.h> | ||
| 79 | +#include <unwindstack/RegsRiscv64.h> | ||
| 80 | #include <unwindstack/RegsX86.h> | ||
| 81 | #include <unwindstack/RegsX86_64.h> | ||
| 82 | #include <unwindstack/UserArm.h> | ||
| 83 | #include <unwindstack/UserArm64.h> | ||
| 84 | #include <unwindstack/UserMips.h> | ||
| 85 | #include <unwindstack/UserMips64.h> | ||
| 86 | +#include <unwindstack/UserRiscv64.h> | ||
| 87 | #include <unwindstack/UserX86.h> | ||
| 88 | #include <unwindstack/UserX86_64.h> | ||
| 89 | |||
| 90 | @@ -67,6 +69,8 @@ Regs* Regs::RemoteGet(pid_t pid) { | ||
| 91 | return RegsMips::Read(buffer.data()); | ||
| 92 | case sizeof(mips64_user_regs): | ||
| 93 | return RegsMips64::Read(buffer.data()); | ||
| 94 | + case sizeof(riscv64_user_regs): | ||
| 95 | + return RegsRiscv64::Read(buffer.data()); | ||
| 96 | } | ||
| 97 | return nullptr; | ||
| 98 | } | ||
| 99 | @@ -85,6 +89,8 @@ Regs* Regs::CreateFromUcontext(ArchEnum arch, void* ucontext) { | ||
| 100 | return RegsMips::CreateFromUcontext(ucontext); | ||
| 101 | case ARCH_MIPS64: | ||
| 102 | return RegsMips64::CreateFromUcontext(ucontext); | ||
| 103 | + case ARCH_RISCV64: | ||
| 104 | + return RegsRiscv64::CreateFromUcontext(ucontext); | ||
| 105 | case ARCH_UNKNOWN: | ||
| 106 | default: | ||
| 107 | return nullptr; | ||
| 108 | @@ -104,6 +110,8 @@ ArchEnum Regs::CurrentArch() { | ||
| 109 | return ARCH_MIPS; | ||
| 110 | #elif defined(__mips__) && defined(__LP64__) | ||
| 111 | return ARCH_MIPS64; | ||
| 112 | +#elif defined(__riscv) | ||
| 113 | + return ARCH_RISCV64; | ||
| 114 | #else | ||
| 115 | abort(); | ||
| 116 | #endif | ||
| 117 | @@ -123,6 +131,8 @@ Regs* Regs::CreateFromLocal() { | ||
| 118 | regs = new RegsMips(); | ||
| 119 | #elif defined(__mips__) && defined(__LP64__) | ||
| 120 | regs = new RegsMips64(); | ||
| 121 | +#elif defined(__riscv) | ||
| 122 | + regs = new RegsRiscv64(); | ||
| 123 | #else | ||
| 124 | abort(); | ||
| 125 | #endif | ||
| 126 | diff --git a/system/core/libunwindstack/RegsRiscv64.cpp b/system/core/libunwindstack/RegsRiscv64.cpp | ||
| 127 | new file mode 100644 | ||
| 128 | index 0000000..887762a | ||
| 129 | --- /dev/null | ||
| 130 | +++ b/system/core/libunwindstack/RegsRiscv64.cpp | ||
| 131 | @@ -0,0 +1,156 @@ | ||
| 132 | +/* | ||
| 133 | + * Copyright (C) 2022 The Android Open Source Project | ||
| 134 | + * | ||
| 135 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 136 | + * you may not use this file except in compliance with the License. | ||
| 137 | + * You may obtain a copy of the License at | ||
| 138 | + * | ||
| 139 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 140 | + * | ||
| 141 | + * Unless required by applicable law or agreed to in writing, software | ||
| 142 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 143 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 144 | + * See the License for the specific language governing permissions and | ||
| 145 | + * limitations under the License. | ||
| 146 | + */ | ||
| 147 | + | ||
| 148 | +#include <stdint.h> | ||
| 149 | +#include <string.h> | ||
| 150 | + | ||
| 151 | +#include <functional> | ||
| 152 | + | ||
| 153 | +#include <unwindstack/Elf.h> | ||
| 154 | +#include <unwindstack/MachineRiscv64.h> | ||
| 155 | +#include <unwindstack/MapInfo.h> | ||
| 156 | +#include <unwindstack/Memory.h> | ||
| 157 | +#include <unwindstack/RegsRiscv64.h> | ||
| 158 | +#include <unwindstack/UcontextRiscv64.h> | ||
| 159 | +#include <unwindstack/UserRiscv64.h> | ||
| 160 | + | ||
| 161 | +namespace unwindstack { | ||
| 162 | + | ||
| 163 | +RegsRiscv64::RegsRiscv64() | ||
| 164 | + : RegsImpl<uint64_t>(RISCV64_REG_MAX, Location(LOCATION_REGISTER, RISCV64_REG_RA)) {} | ||
| 165 | + | ||
| 166 | +ArchEnum RegsRiscv64::Arch() { | ||
| 167 | + return ARCH_RISCV64; | ||
| 168 | +} | ||
| 169 | + | ||
| 170 | +uint64_t RegsRiscv64::pc() { | ||
| 171 | + return regs_[RISCV64_REG_PC]; | ||
| 172 | +} | ||
| 173 | + | ||
| 174 | +uint64_t RegsRiscv64::sp() { | ||
| 175 | + return regs_[RISCV64_REG_SP]; | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +void RegsRiscv64::set_pc(uint64_t pc) { | ||
| 179 | + regs_[RISCV64_REG_PC] = pc; | ||
| 180 | +} | ||
| 181 | + | ||
| 182 | +void RegsRiscv64::set_sp(uint64_t sp) { | ||
| 183 | + regs_[RISCV64_REG_SP] = sp; | ||
| 184 | +} | ||
| 185 | + | ||
| 186 | +uint64_t RegsRiscv64::GetPcAdjustment(uint64_t rel_pc, Elf*) { | ||
| 187 | + if (rel_pc < 8) { | ||
| 188 | + return 0; | ||
| 189 | + } | ||
| 190 | + // For now, just assume no compact branches | ||
| 191 | + return 8; | ||
| 192 | +} | ||
| 193 | + | ||
| 194 | +bool RegsRiscv64::SetPcFromReturnAddress(Memory*) { | ||
| 195 | + uint64_t ra = regs_[RISCV64_REG_RA]; | ||
| 196 | + if (regs_[RISCV64_REG_PC] == ra) { | ||
| 197 | + return false; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + regs_[RISCV64_REG_PC] = ra; | ||
| 201 | + return true; | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +void RegsRiscv64::IterateRegisters(std::function<void(const char*, uint64_t)> fn) { | ||
| 205 | + fn("pc", regs_[RISCV64_REG_PC]); | ||
| 206 | + fn("ra", regs_[RISCV64_REG_RA]); | ||
| 207 | + fn("sp", regs_[RISCV64_REG_SP]); | ||
| 208 | + fn("gp", regs_[RISCV64_REG_GP]); | ||
| 209 | + fn("tp", regs_[RISCV64_REG_TP]); | ||
| 210 | + fn("t0", regs_[RISCV64_REG_T0]); | ||
| 211 | + fn("t1", regs_[RISCV64_REG_T1]); | ||
| 212 | + fn("t2", regs_[RISCV64_REG_T2]); | ||
| 213 | + fn("t3", regs_[RISCV64_REG_T3]); | ||
| 214 | + fn("t4", regs_[RISCV64_REG_T4]); | ||
| 215 | + fn("t5", regs_[RISCV64_REG_T5]); | ||
| 216 | + fn("t6", regs_[RISCV64_REG_T6]); | ||
| 217 | + fn("s0", regs_[RISCV64_REG_S0]); | ||
| 218 | + fn("s1", regs_[RISCV64_REG_S1]); | ||
| 219 | + fn("s2", regs_[RISCV64_REG_S2]); | ||
| 220 | + fn("s3", regs_[RISCV64_REG_S3]); | ||
| 221 | + fn("s4", regs_[RISCV64_REG_S4]); | ||
| 222 | + fn("s5", regs_[RISCV64_REG_S5]); | ||
| 223 | + fn("s6", regs_[RISCV64_REG_S6]); | ||
| 224 | + fn("s7", regs_[RISCV64_REG_S7]); | ||
| 225 | + fn("s8", regs_[RISCV64_REG_S8]); | ||
| 226 | + fn("s9", regs_[RISCV64_REG_S9]); | ||
| 227 | + fn("s10", regs_[RISCV64_REG_S10]); | ||
| 228 | + fn("s11", regs_[RISCV64_REG_S11]); | ||
| 229 | + fn("a0", regs_[RISCV64_REG_A0]); | ||
| 230 | + fn("a1", regs_[RISCV64_REG_A1]); | ||
| 231 | + fn("a2", regs_[RISCV64_REG_A2]); | ||
| 232 | + fn("a3", regs_[RISCV64_REG_A3]); | ||
| 233 | + fn("a4", regs_[RISCV64_REG_A4]); | ||
| 234 | + fn("a5", regs_[RISCV64_REG_A5]); | ||
| 235 | + fn("a6", regs_[RISCV64_REG_A6]); | ||
| 236 | + fn("a7", regs_[RISCV64_REG_A7]); | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | +Regs* RegsRiscv64::Read(void* remote_data) { | ||
| 240 | + riscv64_user_regs* user = reinterpret_cast<riscv64_user_regs*>(remote_data); | ||
| 241 | + | ||
| 242 | + RegsRiscv64* regs = new RegsRiscv64(); | ||
| 243 | + memcpy(regs->RawData(), &user->regs[0], RISCV64_REG_MAX * sizeof(uint64_t)); | ||
| 244 | + // uint64_t* reg_data = reinterpret_cast<uint64_t*>(regs->RawData()); | ||
| 245 | + return regs; | ||
| 246 | +} | ||
| 247 | + | ||
| 248 | +Regs* RegsRiscv64::CreateFromUcontext(void* ucontext) { | ||
| 249 | + riscv64_ucontext_t* riscv64_ucontext = reinterpret_cast<riscv64_ucontext_t*>(ucontext); | ||
| 250 | + | ||
| 251 | + RegsRiscv64* regs = new RegsRiscv64(); | ||
| 252 | + memcpy(regs->RawData(), &riscv64_ucontext->uc_mcontext.__gregs[0], | ||
| 253 | + RISCV64_REG_MAX * sizeof(uint64_t)); | ||
| 254 | + return regs; | ||
| 255 | +} | ||
| 256 | + | ||
| 257 | +bool RegsRiscv64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) { | ||
| 258 | + uint64_t data; | ||
| 259 | + Memory* elf_memory = elf->memory(); | ||
| 260 | + // Read from elf memory since it is usually more expensive to read from | ||
| 261 | + // process memory. | ||
| 262 | + if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) { | ||
| 263 | + return false; | ||
| 264 | + } | ||
| 265 | + // Look for the kernel sigreturn function. | ||
| 266 | + // __kernel_rt_sigreturn: | ||
| 267 | + // li a7, __NR_rt_sigreturn | ||
| 268 | + // scall | ||
| 269 | + | ||
| 270 | + const uint8_t li_scall[] = {0x93, 0x08, 0xb0, 0x08, 0x73, 0x00, 0x00, 0x00}; | ||
| 271 | + if (memcmp(&data, &li_scall, 8) != 0) { | ||
| 272 | + return false; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + // SP + sizeof(siginfo_t) + uc_mcontext offset + PC offset. | ||
| 276 | + if (!process_memory->ReadFully(regs_[RISCV64_REG_SP] + 0x80 + 0xb0 + 0x00, regs_.data(), | ||
| 277 | + sizeof(uint64_t) * (RISCV64_REG_MAX))) { | ||
| 278 | + return false; | ||
| 279 | + } | ||
| 280 | + return true; | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | +Regs* RegsRiscv64::Clone() { | ||
| 284 | + return new RegsRiscv64(*this); | ||
| 285 | +} | ||
| 286 | + | ||
| 287 | +} // namespace unwindstack | ||
| 288 | diff --git a/system/core/libunwindstack/include/unwindstack/Elf.h b/system/core/libunwindstack/include/unwindstack/Elf.h | ||
| 289 | index 472ed92..88fa0ff 100644 | ||
| 290 | --- a/system/core/libunwindstack/include/unwindstack/Elf.h | ||
| 291 | +++ b/system/core/libunwindstack/include/unwindstack/Elf.h | ||
| 292 | @@ -32,6 +32,10 @@ | ||
| 293 | #define EM_AARCH64 183 | ||
| 294 | #endif | ||
| 295 | |||
| 296 | +#if !defined(EM_RISCV) | ||
| 297 | +#define EM_RISCV 243 | ||
| 298 | +#endif | ||
| 299 | + | ||
| 300 | namespace unwindstack { | ||
| 301 | |||
| 302 | // Forward declaration. | ||
| 303 | @@ -46,6 +50,7 @@ enum ArchEnum : uint8_t { | ||
| 304 | ARCH_X86_64, | ||
| 305 | ARCH_MIPS, | ||
| 306 | ARCH_MIPS64, | ||
| 307 | + ARCH_RISCV64, | ||
| 308 | }; | ||
| 309 | |||
| 310 | class Elf { | ||
| 311 | diff --git a/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h | ||
| 312 | new file mode 100644 | ||
| 313 | index 0000000..397e680 | ||
| 314 | --- /dev/null | ||
| 315 | +++ b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h | ||
| 316 | @@ -0,0 +1,59 @@ | ||
| 317 | +/* | ||
| 318 | + * Copyright (C) 2022 The Android Open Source Project | ||
| 319 | + * | ||
| 320 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 321 | + * you may not use this file except in compliance with the License. | ||
| 322 | + * You may obtain a copy of the License at | ||
| 323 | + * | ||
| 324 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 325 | + * | ||
| 326 | + * Unless required by applicable law or agreed to in writing, software | ||
| 327 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 328 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 329 | + * See the License for the specific language governing permissions and | ||
| 330 | + * limitations under the License. | ||
| 331 | + */ | ||
| 332 | + | ||
| 333 | +#pragma once | ||
| 334 | + | ||
| 335 | +#include <stdint.h> | ||
| 336 | + | ||
| 337 | +namespace unwindstack { | ||
| 338 | + | ||
| 339 | +enum Riscv64Reg : uint16_t { | ||
| 340 | + RISCV64_REG_PC, | ||
| 341 | + RISCV64_REG_RA, | ||
| 342 | + RISCV64_REG_SP, | ||
| 343 | + RISCV64_REG_GP, | ||
| 344 | + RISCV64_REG_TP, | ||
| 345 | + RISCV64_REG_T0, | ||
| 346 | + RISCV64_REG_T1, | ||
| 347 | + RISCV64_REG_T2, | ||
| 348 | + RISCV64_REG_S0, | ||
| 349 | + RISCV64_REG_S1, | ||
| 350 | + RISCV64_REG_A0, | ||
| 351 | + RISCV64_REG_A1, | ||
| 352 | + RISCV64_REG_A2, | ||
| 353 | + RISCV64_REG_A3, | ||
| 354 | + RISCV64_REG_A4, | ||
| 355 | + RISCV64_REG_A5, | ||
| 356 | + RISCV64_REG_A6, | ||
| 357 | + RISCV64_REG_A7, | ||
| 358 | + RISCV64_REG_S2, | ||
| 359 | + RISCV64_REG_S3, | ||
| 360 | + RISCV64_REG_S4, | ||
| 361 | + RISCV64_REG_S5, | ||
| 362 | + RISCV64_REG_S6, | ||
| 363 | + RISCV64_REG_S7, | ||
| 364 | + RISCV64_REG_S8, | ||
| 365 | + RISCV64_REG_S9, | ||
| 366 | + RISCV64_REG_S10, | ||
| 367 | + RISCV64_REG_S11, | ||
| 368 | + RISCV64_REG_T3, | ||
| 369 | + RISCV64_REG_T4, | ||
| 370 | + RISCV64_REG_T5, | ||
| 371 | + RISCV64_REG_T6, | ||
| 372 | + RISCV64_REG_MAX, | ||
| 373 | +}; | ||
| 374 | + | ||
| 375 | +} // namespace unwindstack | ||
| 376 | diff --git a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h | ||
| 377 | index f0b5e3a..698eba2 100644 | ||
| 378 | --- a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h | ||
| 379 | +++ b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h | ||
| 380 | @@ -81,6 +81,49 @@ inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { | ||
| 381 | : "x12", "x13", "memory"); | ||
| 382 | } | ||
| 383 | |||
| 384 | +#elif defined(__riscv) | ||
| 385 | + | ||
| 386 | +inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { | ||
| 387 | + asm volatile( | ||
| 388 | + "1:\n" | ||
| 389 | + "sd ra, 8(%[base])\n" | ||
| 390 | + "sd sp, 16(%[base])\n" | ||
| 391 | + "sd gp, 24(%[base])\n" | ||
| 392 | + "sd tp, 32(%[base])\n" | ||
| 393 | + "sd t0, 40(%[base])\n" | ||
| 394 | + "sd t1, 48(%[base])\n" | ||
| 395 | + "sd t2, 56(%[base])\n" | ||
| 396 | + "sd s0, 64(%[base])\n" | ||
| 397 | + "sd s1, 72(%[base])\n" | ||
| 398 | + "sd a0, 80(%[base])\n" | ||
| 399 | + "sd a1, 88(%[base])\n" | ||
| 400 | + "sd a2, 96(%[base])\n" | ||
| 401 | + "sd a3, 104(%[base])\n" | ||
| 402 | + "sd a4, 112(%[base])\n" | ||
| 403 | + "sd a5, 120(%[base])\n" | ||
| 404 | + "sd a6, 128(%[base])\n" | ||
| 405 | + "sd a7, 136(%[base])\n" | ||
| 406 | + "sd s2, 144(%[base])\n" | ||
| 407 | + "sd s3, 152(%[base])\n" | ||
| 408 | + "sd s4, 160(%[base])\n" | ||
| 409 | + "sd s5, 168(%[base])\n" | ||
| 410 | + "sd s6, 176(%[base])\n" | ||
| 411 | + "sd s7, 184(%[base])\n" | ||
| 412 | + "sd s8, 192(%[base])\n" | ||
| 413 | + "sd s9, 200(%[base])\n" | ||
| 414 | + "sd s10, 208(%[base])\n" | ||
| 415 | + "sd s11, 216(%[base])\n" | ||
| 416 | + "sd t3, 224(%[base])\n" | ||
| 417 | + "sd t4, 232(%[base])\n" | ||
| 418 | + "sd t5, 240(%[base])\n" | ||
| 419 | + "sd t6, 248(%[base])\n" | ||
| 420 | + "la t1, 1b\n" | ||
| 421 | + "sd t1, 0(%[base])\n" | ||
| 422 | + : [base] "+r"(reg_data) | ||
| 423 | + : | ||
| 424 | + : "t1", "memory"); | ||
| 425 | +} | ||
| 426 | + | ||
| 427 | #elif defined(__i386__) || defined(__x86_64__) || defined(__mips__) | ||
| 428 | |||
| 429 | extern "C" void AsmGetRegs(void* regs); | ||
| 430 | diff --git a/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h | ||
| 431 | new file mode 100644 | ||
| 432 | index 0000000..eb09397 | ||
| 433 | --- /dev/null | ||
| 434 | +++ b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h | ||
| 435 | @@ -0,0 +1,59 @@ | ||
| 436 | +/* | ||
| 437 | + * Copyright (C) 2022 The Android Open Source Project | ||
| 438 | + * | ||
| 439 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 440 | + * you may not use this file except in compliance with the License. | ||
| 441 | + * You may obtain a copy of the License at | ||
| 442 | + * | ||
| 443 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 444 | + * | ||
| 445 | + * Unless required by applicable law or agreed to in writing, software | ||
| 446 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 447 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 448 | + * See the License for the specific language governing permissions and | ||
| 449 | + * limitations under the License. | ||
| 450 | + */ | ||
| 451 | + | ||
| 452 | +#pragma once | ||
| 453 | + | ||
| 454 | +#include <stdint.h> | ||
| 455 | + | ||
| 456 | +#include <functional> | ||
| 457 | + | ||
| 458 | +#include <unwindstack/Elf.h> | ||
| 459 | +#include <unwindstack/Regs.h> | ||
| 460 | + | ||
| 461 | +namespace unwindstack { | ||
| 462 | + | ||
| 463 | +// Forward declarations. | ||
| 464 | +class Memory; | ||
| 465 | + | ||
| 466 | +class RegsRiscv64 : public RegsImpl<uint64_t> { | ||
| 467 | + public: | ||
| 468 | + RegsRiscv64(); | ||
| 469 | + virtual ~RegsRiscv64() = default; | ||
| 470 | + | ||
| 471 | + ArchEnum Arch() override final; | ||
| 472 | + | ||
| 473 | + uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override; | ||
| 474 | + | ||
| 475 | + bool SetPcFromReturnAddress(Memory* process_memory) override; | ||
| 476 | + | ||
| 477 | + bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override; | ||
| 478 | + | ||
| 479 | + void IterateRegisters(std::function<void(const char*, uint64_t)>) override final; | ||
| 480 | + | ||
| 481 | + uint64_t pc() override; | ||
| 482 | + uint64_t sp() override; | ||
| 483 | + | ||
| 484 | + void set_pc(uint64_t pc) override; | ||
| 485 | + void set_sp(uint64_t sp) override; | ||
| 486 | + | ||
| 487 | + Regs* Clone() override final; | ||
| 488 | + | ||
| 489 | + static Regs* Read(void* data); | ||
| 490 | + | ||
| 491 | + static Regs* CreateFromUcontext(void* ucontext); | ||
| 492 | +}; | ||
| 493 | + | ||
| 494 | +} // namespace unwindstack | ||
| 495 | diff --git a/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h | ||
| 496 | new file mode 100644 | ||
| 497 | index 0000000..c6c82b1 | ||
| 498 | --- /dev/null | ||
| 499 | +++ b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h | ||
| 500 | @@ -0,0 +1,80 @@ | ||
| 501 | +/* | ||
| 502 | + * Copyright (C) 2014 The Android Open Source Project | ||
| 503 | + * All rights reserved. | ||
| 504 | + * | ||
| 505 | + * Redistribution and use in source and binary forms, with or without | ||
| 506 | + * modification, are permitted provided that the following conditions | ||
| 507 | + * are met: | ||
| 508 | + * * Redistributions of source code must retain the above copyright | ||
| 509 | + * notice, this list of conditions and the following disclaimer. | ||
| 510 | + * * Redistributions in binary form must reproduce the above copyright | ||
| 511 | + * notice, this list of conditions and the following disclaimer in | ||
| 512 | + * the documentation and/or other materials provided with the | ||
| 513 | + * distribution. | ||
| 514 | + * | ||
| 515 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 516 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 517 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 518 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 519 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 520 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 521 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
| 522 | + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| 523 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 524 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| 525 | + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 526 | + * SUCH DAMAGE. | ||
| 527 | + */ | ||
| 528 | + | ||
| 529 | +#pragma once | ||
| 530 | + | ||
| 531 | +#include <sys/cdefs.h> | ||
| 532 | + | ||
| 533 | +typedef uint64_t __riscv_mc_gp_state[32]; // unsigned long | ||
| 534 | + | ||
| 535 | +struct __riscv_mc_f_ext_state { | ||
| 536 | + uint32_t __f[32]; | ||
| 537 | + uint32_t __fcsr; | ||
| 538 | +}; | ||
| 539 | + | ||
| 540 | +struct __riscv_mc_d_ext_state { | ||
| 541 | + uint64_t __f[32]; | ||
| 542 | + uint32_t __fcsr; | ||
| 543 | +}; | ||
| 544 | + | ||
| 545 | +struct __riscv_mc_q_ext_state { | ||
| 546 | + uint64_t __f[64] __attribute__((__aligned__(16))); | ||
| 547 | + uint32_t __fcsr; | ||
| 548 | + uint32_t __reserved[3]; | ||
| 549 | +}; | ||
| 550 | + | ||
| 551 | +union __riscv_mc_fp_state { | ||
| 552 | + struct __riscv_mc_f_ext_state __f; | ||
| 553 | + struct __riscv_mc_d_ext_state __d; | ||
| 554 | + struct __riscv_mc_q_ext_state __q; | ||
| 555 | +}; | ||
| 556 | + | ||
| 557 | +struct __riscv_stack_t { | ||
| 558 | + uint64_t ss_sp; | ||
| 559 | + int32_t ss_flags; | ||
| 560 | + uint64_t ss_size; | ||
| 561 | +}; | ||
| 562 | + | ||
| 563 | +struct riscv64_sigset_t { | ||
| 564 | + uint64_t sig; // unsigned long | ||
| 565 | +}; | ||
| 566 | + | ||
| 567 | +struct riscv64_mcontext_t { | ||
| 568 | + __riscv_mc_gp_state __gregs; | ||
| 569 | + union __riscv_mc_fp_state __fpregs; | ||
| 570 | +}; | ||
| 571 | + | ||
| 572 | +struct riscv64_ucontext_t { | ||
| 573 | + uint64_t uc_flags; // unsigned long | ||
| 574 | + struct riscv64_ucontext_t* uc_link; | ||
| 575 | + __riscv_stack_t uc_stack; | ||
| 576 | + riscv64_sigset_t uc_sigmask; | ||
| 577 | + /* The kernel adds extra padding here to allow sigset_t to grow. */ | ||
| 578 | + int8_t __padding[128 - sizeof(riscv64_sigset_t)]; // char | ||
| 579 | + riscv64_mcontext_t uc_mcontext; | ||
| 580 | +}; | ||
| 581 | diff --git a/system/core/libunwindstack/include/unwindstack/UserRiscv64.h b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h | ||
| 582 | new file mode 100644 | ||
| 583 | index 0000000..1e91228 | ||
| 584 | --- /dev/null | ||
| 585 | +++ b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h | ||
| 586 | @@ -0,0 +1,37 @@ | ||
| 587 | +/* | ||
| 588 | + * Copyright (C) 2016 The Android Open Source Project | ||
| 589 | + * All rights reserved. | ||
| 590 | + * | ||
| 591 | + * Redistribution and use in source and binary forms, with or without | ||
| 592 | + * modification, are permitted provided that the following conditions | ||
| 593 | + * are met: | ||
| 594 | + * * Redistributions of source code must retain the above copyright | ||
| 595 | + * notice, this list of conditions and the following disclaimer. | ||
| 596 | + * * Redistributions in binary form must reproduce the above copyright | ||
| 597 | + * notice, this list of conditions and the following disclaimer in | ||
| 598 | + * the documentation and/or other materials provided with the | ||
| 599 | + * distribution. | ||
| 600 | + * | ||
| 601 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 602 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 603 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 604 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 605 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 606 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 607 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
| 608 | + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| 609 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 610 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| 611 | + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 612 | + * SUCH DAMAGE. | ||
| 613 | + */ | ||
| 614 | + | ||
| 615 | +#pragma once | ||
| 616 | + | ||
| 617 | +namespace unwindstack { | ||
| 618 | + | ||
| 619 | +struct riscv64_user_regs { | ||
| 620 | + uint64_t regs[32]; | ||
| 621 | +}; | ||
| 622 | + | ||
| 623 | +} // namespace unwindstack | ||
| 624 | diff --git a/system/core/libunwindstack/tools/unwind.cpp b/system/core/libunwindstack/tools/unwind.cpp | ||
| 625 | index 1812e50..ae20891 100644 | ||
| 626 | --- a/system/core/libunwindstack/tools/unwind.cpp | ||
| 627 | +++ b/system/core/libunwindstack/tools/unwind.cpp | ||
| 628 | @@ -83,6 +83,9 @@ void DoUnwind(pid_t pid) { | ||
| 629 | case unwindstack::ARCH_MIPS64: | ||
| 630 | printf("mips64"); | ||
| 631 | break; | ||
| 632 | + case unwindstack::ARCH_RISCV64: | ||
| 633 | + printf("riscv64"); | ||
| 634 | + break; | ||
| 635 | default: | ||
| 636 | printf("unknown\n"); | ||
| 637 | return; | ||
| 638 | diff --git a/system/core/libunwindstack/tools/unwind_symbols.cpp b/system/core/libunwindstack/tools/unwind_symbols.cpp | ||
| 639 | index 8df2284..976db56 100644 | ||
| 640 | --- a/system/core/libunwindstack/tools/unwind_symbols.cpp | ||
| 641 | +++ b/system/core/libunwindstack/tools/unwind_symbols.cpp | ||
| 642 | @@ -77,6 +77,9 @@ int main(int argc, char** argv) { | ||
| 643 | case EM_AARCH64: | ||
| 644 | printf("ABI: arm64\n"); | ||
| 645 | break; | ||
| 646 | + case EM_RISCV: | ||
| 647 | + printf("ABI: riscv64\n"); | ||
| 648 | + break; | ||
| 649 | case EM_386: | ||
| 650 | printf("ABI: x86\n"); | ||
| 651 | 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 @@ | |||
| 1 | Description: Added missing headers causing compile errors | ||
| 2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
| 3 | Forwarded: not-needed | ||
| 4 | |||
| 5 | --- a/system/core/adb/sysdeps/posix/network.cpp | ||
| 6 | +++ b/system/core/adb/sysdeps/posix/network.cpp | ||
| 7 | @@ -22,6 +22,7 @@ | ||
| 8 | #include <sys/socket.h> | ||
| 9 | |||
| 10 | #include <string> | ||
| 11 | +#include <cstring> | ||
| 12 | |||
| 13 | #include <android-base/logging.h> | ||
| 14 | #include <android-base/stringprintf.h> | ||
| 15 | --- a/system/core/base/file.cpp | ||
| 16 | +++ b/system/core/base/file.cpp | ||
| 17 | @@ -26,6 +26,7 @@ | ||
| 18 | #include <sys/stat.h> | ||
| 19 | #include <sys/types.h> | ||
| 20 | #include <unistd.h> | ||
| 21 | +#include <cstring> | ||
| 22 | |||
| 23 | #include <memory> | ||
| 24 | #include <mutex> | ||
| 25 | --- a/system/core/libbacktrace/BacktraceMap.cpp | ||
| 26 | +++ b/system/core/libbacktrace/BacktraceMap.cpp | ||
| 27 | @@ -21,6 +21,7 @@ | ||
| 28 | #include <stdint.h> | ||
| 29 | #include <sys/types.h> | ||
| 30 | #include <unistd.h> | ||
| 31 | +#include <algorithm> | ||
| 32 | |||
| 33 | #include <log/log.h> | ||
| 34 | |||
| 35 | --- a/system/core/libbacktrace/UnwindStackMap.cpp | ||
| 36 | +++ b/system/core/libbacktrace/UnwindStackMap.cpp | ||
| 37 | @@ -20,6 +20,7 @@ | ||
| 38 | |||
| 39 | #include <string> | ||
| 40 | #include <vector> | ||
| 41 | +#include <algorithm> | ||
| 42 | |||
| 43 | #include <backtrace/BacktraceMap.h> | ||
| 44 | #include <unwindstack/Elf.h> | ||
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/debian/Nonnull.patch index a7e0fa81e7..8d1408a48e 100644 --- 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/debian/Nonnull.patch | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | Description: Bring Clang's _Nonnull keyword to GCC | 1 | Description: Bring Clang's _Nonnull keyword to GCC |
| 2 | Author: Kai-Chung Yan | 2 | Author: Kai-Chung Yan |
| 3 | Forwarded: not-needed | 3 | Forwarded: not-needed |
| 4 | --- a/adb/sysdeps.h | 4 | --- a/system/core/adb/sysdeps.h |
| 5 | +++ b/adb/sysdeps.h | 5 | +++ b/system/core/adb/sysdeps.h |
| 6 | @@ -40,11 +40,12 @@ | 6 | @@ -40,11 +40,12 @@ |
| 7 | #include "sysdeps/network.h" | 7 | #include "sysdeps/network.h" |
| 8 | #include "sysdeps/stat.h" | 8 | #include "sysdeps/stat.h" |
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/debian/Vector-cast.patch index dd39d1ee7a..b32d5f6f54 100644 --- 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/debian/Vector-cast.patch | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | Description: Fix the wired error by GCC7 that fails to match the correct parent method. | 1 | Description: Fix the weird error by GCC7 that fails to match the correct parent method. |
| 2 | Author: Kai-Chung Yan | 2 | Author: Kai-Chung Yan |
| 3 | Forwarded: not-needed | 3 | Forwarded: not-needed |
| 4 | --- a/libutils/include/utils/Vector.h | 4 | --- a/system/core/libutils/include/utils/Vector.h |
| 5 | +++ b/libutils/include/utils/Vector.h | 5 | +++ b/system/core/libutils/include/utils/Vector.h |
| 6 | @@ -256,7 +256,7 @@ | 6 | @@ -256,7 +256,7 @@ |
| 7 | 7 | ||
| 8 | template<class TYPE> inline | 8 | template<class TYPE> inline |
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 @@ | |||
| 1 | Forwarded: not-needed | ||
| 2 | --- a/system/core/fs_mgr/liblp/reader.cpp | ||
| 3 | +++ b/system/core/fs_mgr/liblp/reader.cpp | ||
| 4 | @@ -22,6 +22,7 @@ | ||
| 5 | #include <unistd.h> | ||
| 6 | |||
| 7 | #include <functional> | ||
| 8 | +#include <cstring> | ||
| 9 | |||
| 10 | #include <android-base/file.h> | ||
| 11 | #include <android-base/unique_fd.h> | ||
| 12 | --- a/system/core/fs_mgr/liblp/writer.cpp | ||
| 13 | +++ b/system/core/fs_mgr/liblp/writer.cpp | ||
| 14 | @@ -21,6 +21,7 @@ | ||
| 15 | #include <unistd.h> | ||
| 16 | |||
| 17 | #include <string> | ||
| 18 | +#include <cstring> | ||
| 19 | |||
| 20 | #include <android-base/file.h> | ||
| 21 | #include <android-base/unique_fd.h> | ||
| 22 | --- a/system/core/liblog/logger_write.cpp | ||
| 23 | +++ b/system/core/liblog/logger_write.cpp | ||
| 24 | @@ -27,6 +27,7 @@ | ||
| 25 | #include <android/set_abort_message.h> | ||
| 26 | #endif | ||
| 27 | |||
| 28 | +#include <mutex> | ||
| 29 | #include <shared_mutex> | ||
| 30 | |||
| 31 | #include <android-base/errno_restorer.h> | ||
| 32 | --- a/system/core/libziparchive/zip_archive_stream_entry.cc | ||
| 33 | +++ b/system/core/libziparchive/zip_archive_stream_entry.cc | ||
| 34 | @@ -23,6 +23,7 @@ | ||
| 35 | #include <sys/types.h> | ||
| 36 | #include <unistd.h> | ||
| 37 | |||
| 38 | +#include <limits> | ||
| 39 | #include <memory> | ||
| 40 | #include <vector> | ||
| 41 | |||
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/debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch index cc1a8cb954..b926eddcdf 100644 --- 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/debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch | |||
| @@ -1,8 +1,7 @@ | |||
| 1 | Description: Fixes "20150704-CVE-2015-3239" | 1 | Description: Off-by-one error in the dwarf_to_unw_regnum function in include/dwarf_i.h in |
| 2 | Index: pkg-libunwind/include/dwarf_i.h | 2 | libunwind 1.1 allows local users to have unspecified impact via invalid dwarf opcodes. |
| 3 | =================================================================== | 3 | --- a/external/libunwind/include/dwarf_i.h |
| 4 | --- pkg-libunwind.orig/include/dwarf_i.h 2015-07-04 10:57:29.000000000 +0900 | 4 | +++ b/external/libunwind/include/dwarf_i.h |
| 5 | +++ pkg-libunwind/include/dwarf_i.h 2015-07-04 11:06:08.675616821 +0900 | ||
| 6 | @@ -20,7 +20,7 @@ | 5 | @@ -20,7 +20,7 @@ |
| 7 | extern const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH]; | 6 | extern const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH]; |
| 8 | /* REG is evaluated multiple times; it better be side-effects free! */ | 7 | /* REG is evaluated multiple times; it better be side-effects free! */ |
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/debian/external/libunwind/legacy_built-in_sync_functions.patch index 8d78faac14..ce1d4e52eb 100644 --- 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/debian/external/libunwind/legacy_built-in_sync_functions.patch | |||
| @@ -10,9 +10,10 @@ Description: Replace the legacy __sync built-in functions with __atomic ones | |||
| 10 | [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html | 10 | [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html |
| 11 | Author: Kai-Chung Yan () | 11 | Author: Kai-Chung Yan () |
| 12 | Last-Update: 2016-10-04 | 12 | Last-Update: 2016-10-04 |
| 13 | --- a/include/libunwind_i.h | 13 | Forwarded: not-needed |
| 14 | +++ b/include/libunwind_i.h | 14 | --- a/external/libunwind/include/libunwind_i.h |
| 15 | @@ -155,8 +155,8 @@ | 15 | +++ b/external/libunwind/include/libunwind_i.h |
| 16 | @@ -155,8 +155,8 @@ cmpxchg_ptr (void *addr, void *old, void | ||
| 16 | u.vp = addr; | 17 | u.vp = addr; |
| 17 | return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new); | 18 | return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new); |
| 18 | } | 19 | } |
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/debian/external/libunwind/user_pt_regs.patch index 8051b6d185..600471f126 100644 --- 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/debian/external/libunwind/user_pt_regs.patch | |||
| @@ -3,9 +3,10 @@ Last-Update: 2016-08-24 | |||
| 3 | Description: Manual definition of struct user_pt_regs | 3 | Description: Manual definition of struct user_pt_regs |
| 4 | On ARM64, libunwind uses struct user_pt_regs which is not defined in | 4 | On ARM64, libunwind uses struct user_pt_regs which is not defined in |
| 5 | anywhere, which causes FTBFS. | 5 | anywhere, which causes FTBFS. |
| 6 | --- a/src/ptrace/_UPT_access_reg.c | 6 | Forwarded: not-needed |
| 7 | +++ b/src/ptrace/_UPT_access_reg.c | 7 | --- a/external/libunwind/src/ptrace/_UPT_access_reg.c |
| 8 | @@ -26,6 +26,15 @@ | 8 | +++ b/external/libunwind/src/ptrace/_UPT_access_reg.c |
| 9 | @@ -26,6 +26,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE | ||
| 9 | 10 | ||
| 10 | #include "_UPT_internal.h" | 11 | #include "_UPT_internal.h" |
| 11 | 12 | ||
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/debian/fix-attribute-issue-with-gcc.patch index 771f0e71c5..e0b4275579 100644 --- 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/debian/fix-attribute-issue-with-gcc.patch | |||
| @@ -1,16 +1,16 @@ | |||
| 1 | Description: remove clang-ism | 1 | Description: remove clang-ism |
| 2 | Forwarded: not-needed | 2 | Forwarded: not-needed |
| 3 | 3 | ||
| 4 | --- a/base/include/android-base/logging.h | 4 | --- a/system/core/base/include/android-base/logging.h |
| 5 | +++ b/base/include/android-base/logging.h | 5 | +++ b/system/core/base/include/android-base/logging.h |
| 6 | @@ -484,10 +484,7 @@ | 6 | @@ -451,10 +451,7 @@ |
| 7 | // -Wno-user-defined-warnings to CPPFLAGS. | 7 | // -Wno-user-defined-warnings to CPPFLAGS. |
| 8 | #pragma clang diagnostic push | 8 | #pragma clang diagnostic push |
| 9 | #pragma clang diagnostic ignored "-Wgcc-compat" | 9 | #pragma clang diagnostic ignored "-Wgcc-compat" |
| 10 | -#define OSTREAM_STRING_POINTER_USAGE_WARNING \ | 10 | -#define OSTREAM_STRING_POINTER_USAGE_WARNING \ |
| 11 | - __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) | 11 | - __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) |
| 12 | -inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) | 12 | -inline OSTREAM_STRING_POINTER_USAGE_WARNING |
| 13 | - OSTREAM_STRING_POINTER_USAGE_WARNING { | 13 | -std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { |
| 14 | +inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { | 14 | +inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { |
| 15 | return stream << static_cast<const void*>(string_pointer); | 15 | return stream << static_cast<const void*>(string_pointer); |
| 16 | } | 16 | } |
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/debian/fix-build-on-non-x86.patch index 66d1dddc61..98a5078244 100644 --- 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/debian/fix-build-on-non-x86.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | Description: non-x86 arches do not have PAGE_SIZE | 1 | Description: non-x86 arches do not have PAGE_SIZE |
| 2 | Forwarded: not-needed | 2 | Forwarded: not-needed |
| 3 | --- a/base/cmsg.cpp | 3 | --- a/system/core/base/cmsg.cpp |
| 4 | +++ b/base/cmsg.cpp | 4 | +++ b/system/core/base/cmsg.cpp |
| 5 | @@ -33,7 +33,8 @@ | 5 | @@ -33,7 +33,8 @@ |
| 6 | const std::vector<int>& fds) { | 6 | const std::vector<int>& fds) { |
| 7 | size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); | 7 | size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); |
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/debian/fix-gettid-exception-declaration.patch index 3622d7ebb1..7fd228bff6 100644 --- 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/debian/fix-gettid-exception-declaration.patch | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | --- a/libcutils/include/cutils/threads.h | 1 | Description: get libcutils building |
| 2 | +++ b/libcutils/include/cutils/threads.h | 2 | Forwarded: not-needed |
| 3 | --- a/system/core/libcutils/include/cutils/threads.h | ||
| 4 | +++ b/system/core/libcutils/include/cutils/threads.h | ||
| 3 | @@ -33,7 +33,7 @@ | 5 | @@ -33,7 +33,7 @@ |
| 4 | // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. | 6 | // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. |
| 5 | // | 7 | // |
| @@ -9,8 +11,8 @@ | |||
| 9 | 11 | ||
| 10 | // | 12 | // |
| 11 | // Deprecated: use `_Thread_local` in C or `thread_local` in C++. | 13 | // Deprecated: use `_Thread_local` in C or `thread_local` in C++. |
| 12 | --- a/libcutils/threads.cpp | 14 | --- a/system/core/libcutils/threads.cpp |
| 13 | +++ b/libcutils/threads.cpp | 15 | +++ b/system/core/libcutils/threads.cpp |
| 14 | @@ -33,7 +33,7 @@ | 16 | @@ -33,7 +33,7 @@ |
| 15 | 17 | ||
| 16 | // No definition needed for Android because we'll just pick up bionic's copy. | 18 | // No definition needed for Android because we'll just pick up bionic's copy. |
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/debian/fix-standard-namespace-errors.patch index 8a21054ba7..e41a3576ae 100644 --- 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/debian/fix-standard-namespace-errors.patch | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | Index: android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h | 1 | Description: Add missing 'std::' scope identifiers. |
| 2 | =================================================================== | 2 | Forwarded: not-needed |
| 3 | --- android-platform-system-core.orig/libunwindstack/include/unwindstack/DwarfMemory.h | 3 | --- a/system/core/libunwindstack/include/unwindstack/DwarfMemory.h |
| 4 | +++ android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h | 4 | +++ b/system/core/libunwindstack/include/unwindstack/DwarfMemory.h |
| 5 | @@ -29,7 +29,7 @@ class DwarfMemory { | 5 | @@ -29,7 +29,7 @@ |
| 6 | DwarfMemory(Memory* memory) : memory_(memory) {} | 6 | DwarfMemory(Memory* memory) : memory_(memory) {} |
| 7 | virtual ~DwarfMemory() = default; | 7 | virtual ~DwarfMemory() = default; |
| 8 | 8 | ||
| @@ -11,7 +11,7 @@ Index: android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemo | |||
| 11 | 11 | ||
| 12 | template <typename SignedType> | 12 | template <typename SignedType> |
| 13 | bool ReadSigned(uint64_t* value); | 13 | bool ReadSigned(uint64_t* value); |
| 14 | @@ -39,7 +39,7 @@ class DwarfMemory { | 14 | @@ -39,7 +39,7 @@ |
| 15 | bool ReadSLEB128(int64_t* value); | 15 | bool ReadSLEB128(int64_t* value); |
| 16 | 16 | ||
| 17 | template <typename AddressType> | 17 | template <typename AddressType> |
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/debian/hard-code-build-number.patch index ccc7655e75..2a332eb689 100644 --- 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/debian/hard-code-build-number.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | Description: just hard code rather than deal with circular deps | 1 | Description: just hard code rather than deal with circular deps |
| 2 | Forwarded: not-needed | 2 | Forwarded: not-needed |
| 3 | --- a/adb/adb.cpp | 3 | --- a/system/core/adb/adb.cpp |
| 4 | +++ b/adb/adb.cpp | 4 | +++ b/system/core/adb/adb.cpp |
| 5 | @@ -44,8 +44,6 @@ | 5 | @@ -44,8 +44,6 @@ |
| 6 | #include <android-base/parsenetaddress.h> | 6 | #include <android-base/parsenetaddress.h> |
| 7 | #include <android-base/stringprintf.h> | 7 | #include <android-base/stringprintf.h> |
| @@ -20,13 +20,14 @@ Forwarded: not-needed | |||
| 20 | android::base::GetExecutablePath().c_str()); | 20 | android::base::GetExecutablePath().c_str()); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | --- a/fastboot/fastboot.cpp | 23 | --- a/system/core/fastboot/fastboot.cpp |
| 24 | +++ b/fastboot/fastboot.cpp | 24 | +++ b/system/core/fastboot/fastboot.cpp |
| 25 | @@ -58,9 +58,7 @@ | 25 | @@ -59,10 +59,8 @@ |
| 26 | #include <android-base/stringprintf.h> | 26 | #include <android-base/stringprintf.h> |
| 27 | #include <android-base/strings.h> | 27 | #include <android-base/strings.h> |
| 28 | #include <android-base/unique_fd.h> | 28 | #include <android-base/unique_fd.h> |
| 29 | -#include <build/version.h> | 29 | -#include <build/version.h> |
| 30 | #include <libavb/libavb.h> | ||
| 30 | #include <liblp/liblp.h> | 31 | #include <liblp/liblp.h> |
| 31 | -#include <platform_tools_version.h> | 32 | -#include <platform_tools_version.h> |
| 32 | #include <sparse/sparse.h> | 33 | #include <sparse/sparse.h> |
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/debian/libusb-header-path.patch index d507eab851..1663aae465 100644 --- 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/debian/libusb-header-path.patch | |||
| @@ -3,8 +3,8 @@ Author: Umang Parmar <umangjparmar@gmail.com> | |||
| 3 | Forwarded: not-needed | 3 | Forwarded: not-needed |
| 4 | Last-Update: 2018-05-26 | 4 | Last-Update: 2018-05-26 |
| 5 | 5 | ||
| 6 | --- a/adb/client/usb_libusb.cpp | 6 | --- a/system/core/adb/client/usb_libusb.cpp |
| 7 | +++ b/adb/client/usb_libusb.cpp | 7 | +++ b/system/core/adb/client/usb_libusb.cpp |
| 8 | @@ -30,7 +30,7 @@ | 8 | @@ -30,7 +30,7 @@ |
| 9 | #include <thread> | 9 | #include <thread> |
| 10 | #include <unordered_map> | 10 | #include <unordered_map> |
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/debian/move-log-file-to-proper-dir.patch index e71af8637c..006564b024 100644 --- 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/debian/move-log-file-to-proper-dir.patch | |||
| @@ -2,8 +2,8 @@ Description: Update log file directory. | |||
| 2 | Author: Umang Parmar <umangjparmar@gmail.com> | 2 | Author: Umang Parmar <umangjparmar@gmail.com> |
| 3 | Last Updated: 2018-05-17 | 3 | Last Updated: 2018-05-17 |
| 4 | 4 | ||
| 5 | --- a/adb/adb_utils.cpp | 5 | --- a/system/core/adb/adb_utils.cpp |
| 6 | +++ b/adb/adb_utils.cpp | 6 | +++ b/system/core/adb/adb_utils.cpp |
| 7 | @@ -339,6 +339,11 @@ | 7 | @@ -339,6 +339,11 @@ |
| 8 | 8 | ||
| 9 | return temp_path_utf8 + log_name; | 9 | return temp_path_utf8 + log_name; |
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/debian/simg_dump-python3.patch index 947b5269b8..e6933ef145 100644 --- 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/debian/simg_dump-python3.patch | |||
| @@ -1,14 +1,14 @@ | |||
| 1 | Description: Port simg_dump to Python 3. | 1 | Description: Port simg_dump to Python 3. |
| 2 | Author: Antonio Russo <antonio.e.russo@gmail.com> | 2 | Author: Antonio Russo <antonio.e.russo@gmail.com> |
| 3 | Forwarded: no | 3 | Forwarded: not-needed |
| 4 | Last-Update: 2019-01-05 | 4 | Last-Update: 2019-01-05 |
| 5 | Origin: https://bugs.debian.org/945646 | 5 | Origin: https://bugs.debian.org/945646 |
| 6 | 6 | ||
| 7 | --- | 7 | --- |
| 8 | Index: android-platform-system-core/libsparse/simg_dump.py | 8 | Index: android-platform-tools/system/core/libsparse/simg_dump.py |
| 9 | =================================================================== | 9 | =================================================================== |
| 10 | --- android-platform-system-core.orig/libsparse/simg_dump.py | 10 | --- android-platform-tools.orig/system/core/libsparse/simg_dump.py |
| 11 | +++ android-platform-system-core/libsparse/simg_dump.py | 11 | +++ android-platform-tools/system/core/libsparse/simg_dump.py |
| 12 | @@ -1,4 +1,4 @@ | 12 | @@ -1,4 +1,4 @@ |
| 13 | -#! /usr/bin/env python | 13 | -#! /usr/bin/env python |
| 14 | +#! /usr/bin/env python3 | 14 | +#! /usr/bin/env python3 |
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/debian/stdatomic.patch index 8de0035a5e..ea3711dfa2 100644 --- 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/debian/stdatomic.patch | |||
| @@ -3,8 +3,8 @@ Description: Fix incompatibility between <stdatomic.h> and <atomic> | |||
| 3 | makes sure only one of them is present at any time. | 3 | makes sure only one of them is present at any time. |
| 4 | Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 | 4 | Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 |
| 5 | Bug: https://reviews.llvm.org/D45470 | 5 | Bug: https://reviews.llvm.org/D45470 |
| 6 | --- a/libcutils/include/cutils/trace.h | 6 | --- a/system/core/libcutils/include/cutils/trace.h |
| 7 | +++ b/libcutils/include/cutils/trace.h | 7 | +++ b/system/core/libcutils/include/cutils/trace.h |
| 8 | @@ -18,7 +18,14 @@ | 8 | @@ -18,7 +18,14 @@ |
| 9 | #define _LIBS_CUTILS_TRACE_H | 9 | #define _LIBS_CUTILS_TRACE_H |
| 10 | 10 | ||
| @@ -20,8 +20,8 @@ Bug: https://reviews.llvm.org/D45470 | |||
| 20 | #include <stdbool.h> | 20 | #include <stdbool.h> |
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | --- a/libcutils/include/cutils/atomic.h | 23 | --- a/system/core/libcutils/include/cutils/atomic.h |
| 24 | +++ b/libcutils/include/cutils/atomic.h | 24 | +++ b/system/core/libcutils/include/cutils/atomic.h |
| 25 | @@ -19,7 +19,23 @@ | 25 | @@ -19,7 +19,23 @@ |
| 26 | 26 | ||
| 27 | #include <stdint.h> | 27 | #include <stdint.h> |
| @@ -46,8 +46,8 @@ Bug: https://reviews.llvm.org/D45470 | |||
| 46 | 46 | ||
| 47 | #ifndef ANDROID_ATOMIC_INLINE | 47 | #ifndef ANDROID_ATOMIC_INLINE |
| 48 | #define ANDROID_ATOMIC_INLINE static inline | 48 | #define ANDROID_ATOMIC_INLINE static inline |
| 49 | --- a/liblog/logger.h | 49 | --- a/system/core/liblog/logger.h |
| 50 | +++ b/liblog/logger.h | 50 | +++ b/system/core/liblog/logger.h |
| 51 | @@ -16,7 +16,13 @@ | 51 | @@ -16,7 +16,13 @@ |
| 52 | 52 | ||
| 53 | #pragma once | 53 | #pragma once |
| @@ -59,16 +59,6 @@ Bug: https://reviews.llvm.org/D45470 | |||
| 59 | +#else | 59 | +#else |
| 60 | #include <stdatomic.h> | 60 | #include <stdatomic.h> |
| 61 | +#endif | 61 | +#endif |
| 62 | #include <stdbool.h> | 62 | #include <sys/cdefs.h> |
| 63 | |||
| 64 | #include <cutils/list.h> | ||
| 65 | --- a/liblog/logger_write.cpp | ||
| 66 | +++ b/liblog/logger_write.cpp | ||
| 67 | @@ -15,7 +15,6 @@ | ||
| 68 | */ | ||
| 69 | 63 | ||
| 70 | #include <errno.h> | 64 | #include <log/log.h> |
| 71 | -#include <stdatomic.h> | ||
| 72 | #include <stdlib.h> | ||
| 73 | #include <string.h> | ||
| 74 | #include <sys/time.h> | ||
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 @@ | |||
| 1 | Description: Defer packaging fastdeploy with adb for 29.x.x tags. | ||
| 2 | Forwarded: not-needed | ||
| 3 | --- a/system/core/adb/client/commandline.cpp | ||
| 4 | +++ b/system/core/adb/client/commandline.cpp | ||
| 5 | @@ -59,7 +59,6 @@ | ||
| 6 | #include "bugreport.h" | ||
| 7 | #include "client/file_sync_client.h" | ||
| 8 | #include "commandline.h" | ||
| 9 | -#include "fastdeploy.h" | ||
| 10 | #include "services.h" | ||
| 11 | #include "shell_protocol.h" | ||
| 12 | #include "sysdeps/chrono.h" | ||
| 13 | --- a/system/core/adb/client/adb_install.cpp | ||
| 14 | +++ b/system/core/adb/client/adb_install.cpp | ||
| 15 | @@ -35,7 +35,6 @@ | ||
| 16 | #include "adb_utils.h" | ||
| 17 | #include "client/file_sync_client.h" | ||
| 18 | #include "commandline.h" | ||
| 19 | -#include "fastdeploy.h" | ||
| 20 | |||
| 21 | static constexpr int kFastDeployMinApi = 24; | ||
| 22 | |||
| 23 | @@ -167,14 +166,6 @@ | ||
| 24 | } | ||
| 25 | |||
| 26 | if (use_fastdeploy) { | ||
| 27 | - auto metadata = extract_metadata(file); | ||
| 28 | - if (metadata.has_value()) { | ||
| 29 | - // pass all but 1st (command) and last (apk path) parameters through to pm for | ||
| 30 | - // session creation | ||
| 31 | - std::vector<const char*> pm_args{argv + 1, argv + argc - 1}; | ||
| 32 | - auto patchFd = install_patch(pm_args.size(), pm_args.data()); | ||
| 33 | - return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); | ||
| 34 | - } | ||
| 35 | } | ||
| 36 | |||
| 37 | struct stat sb; | ||
| 38 | @@ -267,16 +258,6 @@ | ||
| 39 | argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ | ||
| 40 | |||
| 41 | if (use_fastdeploy) { | ||
| 42 | - auto metadata = extract_metadata(apk_file[0]); | ||
| 43 | - if (metadata.has_value()) { | ||
| 44 | - auto patchFd = apply_patch_on_device(apk_dest.c_str()); | ||
| 45 | - int status = stream_patch(apk_file[0], std::move(metadata.value()), std::move(patchFd)); | ||
| 46 | - | ||
| 47 | - result = pm_command(argc, argv); | ||
| 48 | - delete_device_file(apk_dest); | ||
| 49 | - | ||
| 50 | - return status; | ||
| 51 | - } | ||
| 52 | } | ||
| 53 | |||
| 54 | if (do_sync_push(apk_file, apk_dest.c_str(), false)) { | ||
| 55 | @@ -292,7 +273,6 @@ | ||
| 56 | InstallMode installMode = INSTALL_DEFAULT; | ||
| 57 | bool use_fastdeploy = false; | ||
| 58 | bool is_reinstall = false; | ||
| 59 | - FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; | ||
| 60 | |||
| 61 | for (int i = 1; i < argc; i++) { | ||
| 62 | if (!strcmp(argv[i], "--streaming")) { | ||
| 63 | @@ -313,13 +293,10 @@ | ||
| 64 | use_fastdeploy = false; | ||
| 65 | } else if (!strcmp(argv[i], "--force-agent")) { | ||
| 66 | processedArgIndicies.push_back(i); | ||
| 67 | - agent_update_strategy = FastDeploy_AgentUpdateAlways; | ||
| 68 | } else if (!strcmp(argv[i], "--date-check-agent")) { | ||
| 69 | processedArgIndicies.push_back(i); | ||
| 70 | - agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; | ||
| 71 | } else if (!strcmp(argv[i], "--version-check-agent")) { | ||
| 72 | processedArgIndicies.push_back(i); | ||
| 73 | - agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | @@ -331,13 +308,11 @@ | ||
| 78 | error_exit("Attempting to use streaming install on unsupported device"); | ||
| 79 | } | ||
| 80 | |||
| 81 | - if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { | ||
| 82 | - printf("Fast Deploy is only compatible with devices of API version %d or higher, " | ||
| 83 | - "ignoring.\n", | ||
| 84 | - kFastDeployMinApi); | ||
| 85 | + if (use_fastdeploy) { | ||
| 86 | + printf("Fast Deploy is unavailable in this build of adb, " | ||
| 87 | + "ignoring.\n"); | ||
| 88 | use_fastdeploy = false; | ||
| 89 | } | ||
| 90 | - fastdeploy_set_agent_update_strategy(agent_update_strategy); | ||
| 91 | |||
| 92 | std::vector<const char*> passthrough_argv; | ||
| 93 | 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 @@ | |||
| 1 | From: Guo Ren <guoren@linux.alibaba.com> | ||
| 2 | Date: Wed, 29 Jun 2022 16:46:46 +0800 | ||
| 3 | Subject: Add riscv64 support | ||
| 4 | |||
| 5 | This patch contains the dwarf unwind support for 64bit risc-v. | ||
| 6 | |||
| 7 | * DwarfCfa.cpp (cfa_def_cfa_register): setup register if CFA_REG is | ||
| 8 | not setup for riscv64 | ||
| 9 | * Elf.cpp (GetRelPc): convert offset to virtual address for riscv64. | ||
| 10 | * ElfInterface.cpp (GetVirtAddrFromOffset): New for riscv64. | ||
| 11 | * RegsRiscv64.cpp (StepIfSignalHandler): Fix signal frame check. | ||
| 12 | libunwindstack/include/unwindstack/ | ||
| 13 | * ElfInterface.h (GetVirtAddrFromOffset): New for riscv64. | ||
| 14 | libunwindstack/tests/ | ||
| 15 | * DwarfCfaTest.cpp (cfa_def_cfa_register): ok for riscv64. | ||
| 16 | * RegsStepIfSignalHandlerTest.cpp (riscv64_step_if_signal_handler): Fix | ||
| 17 | testcase for riscv64 | ||
| 18 | |||
| 19 | Test: Builds. | ||
| 20 | Test: All unit tests pass. | ||
| 21 | |||
| 22 | Signed-off-by: Guo Ren <guoren@linux.alibaba.com> | ||
| 23 | Signed-off-by: Lifang Xia <lifang_xia@linux.alibaba.com> | ||
| 24 | Signed-off-by: Mao Han <han_mao@linux.alibaba.com> | ||
| 25 | Change-Id: Ib21ddf23cc83f332af202df7bffcaceec16063e0 | ||
| 26 | --- | ||
| 27 | system/core/libunwindstack/Android.bp | 1 + | ||
| 28 | system/core/libunwindstack/Elf.cpp | 2 + | ||
| 29 | system/core/libunwindstack/Regs.cpp | 10 ++ | ||
| 30 | system/core/libunwindstack/RegsRiscv64.cpp | 156 +++++++++++++++++++++ | ||
| 31 | .../core/libunwindstack/include/unwindstack/Elf.h | 5 + | ||
| 32 | .../include/unwindstack/MachineRiscv64.h | 59 ++++++++ | ||
| 33 | .../include/unwindstack/RegsGetLocal.h | 43 ++++++ | ||
| 34 | .../include/unwindstack/RegsRiscv64.h | 59 ++++++++ | ||
| 35 | .../include/unwindstack/UcontextRiscv64.h | 80 +++++++++++ | ||
| 36 | .../include/unwindstack/UserRiscv64.h | 37 +++++ | ||
| 37 | system/core/libunwindstack/tools/unwind.cpp | 3 + | ||
| 38 | .../core/libunwindstack/tools/unwind_symbols.cpp | 3 + | ||
| 39 | 12 files changed, 458 insertions(+) | ||
| 40 | create mode 100644 system/core/libunwindstack/RegsRiscv64.cpp | ||
| 41 | create mode 100644 system/core/libunwindstack/include/unwindstack/MachineRiscv64.h | ||
| 42 | create mode 100644 system/core/libunwindstack/include/unwindstack/RegsRiscv64.h | ||
| 43 | create mode 100644 system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h | ||
| 44 | create mode 100644 system/core/libunwindstack/include/unwindstack/UserRiscv64.h | ||
| 45 | |||
| 46 | diff --git a/system/core/libunwindstack/Android.bp b/system/core/libunwindstack/Android.bp | ||
| 47 | index 3695f72..f1f9c68 100644 | ||
| 48 | --- a/system/core/libunwindstack/Android.bp | ||
| 49 | +++ b/system/core/libunwindstack/Android.bp | ||
| 50 | @@ -70,6 +70,7 @@ cc_library { | ||
| 51 | "RegsArm64.cpp", | ||
| 52 | "RegsX86.cpp", | ||
| 53 | "RegsX86_64.cpp", | ||
| 54 | + "RegsRiscv64.cpp", | ||
| 55 | "RegsMips.cpp", | ||
| 56 | "RegsMips64.cpp", | ||
| 57 | "Unwinder.cpp", | ||
| 58 | diff --git a/system/core/libunwindstack/Elf.cpp b/system/core/libunwindstack/Elf.cpp | ||
| 59 | index f01b092..3c2088b 100644 | ||
| 60 | --- a/system/core/libunwindstack/Elf.cpp | ||
| 61 | +++ b/system/core/libunwindstack/Elf.cpp | ||
| 62 | @@ -290,6 +290,8 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) { | ||
| 63 | arch_ = ARCH_X86_64; | ||
| 64 | } else if (e_machine == EM_MIPS) { | ||
| 65 | arch_ = ARCH_MIPS64; | ||
| 66 | + } else if (e_machine == EM_RISCV) { | ||
| 67 | + arch_ = ARCH_RISCV64; | ||
| 68 | } else { | ||
| 69 | // Unsupported. | ||
| 70 | ALOGI("64 bit elf that is neither aarch64 nor x86_64 nor mips64: e_machine = %d\n", | ||
| 71 | diff --git a/system/core/libunwindstack/Regs.cpp b/system/core/libunwindstack/Regs.cpp | ||
| 72 | index c7dec52..447a554 100644 | ||
| 73 | --- a/system/core/libunwindstack/Regs.cpp | ||
| 74 | +++ b/system/core/libunwindstack/Regs.cpp | ||
| 75 | @@ -27,12 +27,14 @@ | ||
| 76 | #include <unwindstack/RegsArm64.h> | ||
| 77 | #include <unwindstack/RegsMips.h> | ||
| 78 | #include <unwindstack/RegsMips64.h> | ||
| 79 | +#include <unwindstack/RegsRiscv64.h> | ||
| 80 | #include <unwindstack/RegsX86.h> | ||
| 81 | #include <unwindstack/RegsX86_64.h> | ||
| 82 | #include <unwindstack/UserArm.h> | ||
| 83 | #include <unwindstack/UserArm64.h> | ||
| 84 | #include <unwindstack/UserMips.h> | ||
| 85 | #include <unwindstack/UserMips64.h> | ||
| 86 | +#include <unwindstack/UserRiscv64.h> | ||
| 87 | #include <unwindstack/UserX86.h> | ||
| 88 | #include <unwindstack/UserX86_64.h> | ||
| 89 | |||
| 90 | @@ -67,6 +69,8 @@ Regs* Regs::RemoteGet(pid_t pid) { | ||
| 91 | return RegsMips::Read(buffer.data()); | ||
| 92 | case sizeof(mips64_user_regs): | ||
| 93 | return RegsMips64::Read(buffer.data()); | ||
| 94 | + case sizeof(riscv64_user_regs): | ||
| 95 | + return RegsRiscv64::Read(buffer.data()); | ||
| 96 | } | ||
| 97 | return nullptr; | ||
| 98 | } | ||
| 99 | @@ -85,6 +89,8 @@ Regs* Regs::CreateFromUcontext(ArchEnum arch, void* ucontext) { | ||
| 100 | return RegsMips::CreateFromUcontext(ucontext); | ||
| 101 | case ARCH_MIPS64: | ||
| 102 | return RegsMips64::CreateFromUcontext(ucontext); | ||
| 103 | + case ARCH_RISCV64: | ||
| 104 | + return RegsRiscv64::CreateFromUcontext(ucontext); | ||
| 105 | case ARCH_UNKNOWN: | ||
| 106 | default: | ||
| 107 | return nullptr; | ||
| 108 | @@ -104,6 +110,8 @@ ArchEnum Regs::CurrentArch() { | ||
| 109 | return ARCH_MIPS; | ||
| 110 | #elif defined(__mips__) && defined(__LP64__) | ||
| 111 | return ARCH_MIPS64; | ||
| 112 | +#elif defined(__riscv) | ||
| 113 | + return ARCH_RISCV64; | ||
| 114 | #else | ||
| 115 | abort(); | ||
| 116 | #endif | ||
| 117 | @@ -123,6 +131,8 @@ Regs* Regs::CreateFromLocal() { | ||
| 118 | regs = new RegsMips(); | ||
| 119 | #elif defined(__mips__) && defined(__LP64__) | ||
| 120 | regs = new RegsMips64(); | ||
| 121 | +#elif defined(__riscv) | ||
| 122 | + regs = new RegsRiscv64(); | ||
| 123 | #else | ||
| 124 | abort(); | ||
| 125 | #endif | ||
| 126 | diff --git a/system/core/libunwindstack/RegsRiscv64.cpp b/system/core/libunwindstack/RegsRiscv64.cpp | ||
| 127 | new file mode 100644 | ||
| 128 | index 0000000..887762a | ||
| 129 | --- /dev/null | ||
| 130 | +++ b/system/core/libunwindstack/RegsRiscv64.cpp | ||
| 131 | @@ -0,0 +1,156 @@ | ||
| 132 | +/* | ||
| 133 | + * Copyright (C) 2022 The Android Open Source Project | ||
| 134 | + * | ||
| 135 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 136 | + * you may not use this file except in compliance with the License. | ||
| 137 | + * You may obtain a copy of the License at | ||
| 138 | + * | ||
| 139 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 140 | + * | ||
| 141 | + * Unless required by applicable law or agreed to in writing, software | ||
| 142 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 143 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 144 | + * See the License for the specific language governing permissions and | ||
| 145 | + * limitations under the License. | ||
| 146 | + */ | ||
| 147 | + | ||
| 148 | +#include <stdint.h> | ||
| 149 | +#include <string.h> | ||
| 150 | + | ||
| 151 | +#include <functional> | ||
| 152 | + | ||
| 153 | +#include <unwindstack/Elf.h> | ||
| 154 | +#include <unwindstack/MachineRiscv64.h> | ||
| 155 | +#include <unwindstack/MapInfo.h> | ||
| 156 | +#include <unwindstack/Memory.h> | ||
| 157 | +#include <unwindstack/RegsRiscv64.h> | ||
| 158 | +#include <unwindstack/UcontextRiscv64.h> | ||
| 159 | +#include <unwindstack/UserRiscv64.h> | ||
| 160 | + | ||
| 161 | +namespace unwindstack { | ||
| 162 | + | ||
| 163 | +RegsRiscv64::RegsRiscv64() | ||
| 164 | + : RegsImpl<uint64_t>(RISCV64_REG_MAX, Location(LOCATION_REGISTER, RISCV64_REG_RA)) {} | ||
| 165 | + | ||
| 166 | +ArchEnum RegsRiscv64::Arch() { | ||
| 167 | + return ARCH_RISCV64; | ||
| 168 | +} | ||
| 169 | + | ||
| 170 | +uint64_t RegsRiscv64::pc() { | ||
| 171 | + return regs_[RISCV64_REG_PC]; | ||
| 172 | +} | ||
| 173 | + | ||
| 174 | +uint64_t RegsRiscv64::sp() { | ||
| 175 | + return regs_[RISCV64_REG_SP]; | ||
| 176 | +} | ||
| 177 | + | ||
| 178 | +void RegsRiscv64::set_pc(uint64_t pc) { | ||
| 179 | + regs_[RISCV64_REG_PC] = pc; | ||
| 180 | +} | ||
| 181 | + | ||
| 182 | +void RegsRiscv64::set_sp(uint64_t sp) { | ||
| 183 | + regs_[RISCV64_REG_SP] = sp; | ||
| 184 | +} | ||
| 185 | + | ||
| 186 | +uint64_t RegsRiscv64::GetPcAdjustment(uint64_t rel_pc, Elf*) { | ||
| 187 | + if (rel_pc < 8) { | ||
| 188 | + return 0; | ||
| 189 | + } | ||
| 190 | + // For now, just assume no compact branches | ||
| 191 | + return 8; | ||
| 192 | +} | ||
| 193 | + | ||
| 194 | +bool RegsRiscv64::SetPcFromReturnAddress(Memory*) { | ||
| 195 | + uint64_t ra = regs_[RISCV64_REG_RA]; | ||
| 196 | + if (regs_[RISCV64_REG_PC] == ra) { | ||
| 197 | + return false; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + regs_[RISCV64_REG_PC] = ra; | ||
| 201 | + return true; | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +void RegsRiscv64::IterateRegisters(std::function<void(const char*, uint64_t)> fn) { | ||
| 205 | + fn("pc", regs_[RISCV64_REG_PC]); | ||
| 206 | + fn("ra", regs_[RISCV64_REG_RA]); | ||
| 207 | + fn("sp", regs_[RISCV64_REG_SP]); | ||
| 208 | + fn("gp", regs_[RISCV64_REG_GP]); | ||
| 209 | + fn("tp", regs_[RISCV64_REG_TP]); | ||
| 210 | + fn("t0", regs_[RISCV64_REG_T0]); | ||
| 211 | + fn("t1", regs_[RISCV64_REG_T1]); | ||
| 212 | + fn("t2", regs_[RISCV64_REG_T2]); | ||
| 213 | + fn("t3", regs_[RISCV64_REG_T3]); | ||
| 214 | + fn("t4", regs_[RISCV64_REG_T4]); | ||
| 215 | + fn("t5", regs_[RISCV64_REG_T5]); | ||
| 216 | + fn("t6", regs_[RISCV64_REG_T6]); | ||
| 217 | + fn("s0", regs_[RISCV64_REG_S0]); | ||
| 218 | + fn("s1", regs_[RISCV64_REG_S1]); | ||
| 219 | + fn("s2", regs_[RISCV64_REG_S2]); | ||
| 220 | + fn("s3", regs_[RISCV64_REG_S3]); | ||
| 221 | + fn("s4", regs_[RISCV64_REG_S4]); | ||
| 222 | + fn("s5", regs_[RISCV64_REG_S5]); | ||
| 223 | + fn("s6", regs_[RISCV64_REG_S6]); | ||
| 224 | + fn("s7", regs_[RISCV64_REG_S7]); | ||
| 225 | + fn("s8", regs_[RISCV64_REG_S8]); | ||
| 226 | + fn("s9", regs_[RISCV64_REG_S9]); | ||
| 227 | + fn("s10", regs_[RISCV64_REG_S10]); | ||
| 228 | + fn("s11", regs_[RISCV64_REG_S11]); | ||
| 229 | + fn("a0", regs_[RISCV64_REG_A0]); | ||
| 230 | + fn("a1", regs_[RISCV64_REG_A1]); | ||
| 231 | + fn("a2", regs_[RISCV64_REG_A2]); | ||
| 232 | + fn("a3", regs_[RISCV64_REG_A3]); | ||
| 233 | + fn("a4", regs_[RISCV64_REG_A4]); | ||
| 234 | + fn("a5", regs_[RISCV64_REG_A5]); | ||
| 235 | + fn("a6", regs_[RISCV64_REG_A6]); | ||
| 236 | + fn("a7", regs_[RISCV64_REG_A7]); | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | +Regs* RegsRiscv64::Read(void* remote_data) { | ||
| 240 | + riscv64_user_regs* user = reinterpret_cast<riscv64_user_regs*>(remote_data); | ||
| 241 | + | ||
| 242 | + RegsRiscv64* regs = new RegsRiscv64(); | ||
| 243 | + memcpy(regs->RawData(), &user->regs[0], RISCV64_REG_MAX * sizeof(uint64_t)); | ||
| 244 | + // uint64_t* reg_data = reinterpret_cast<uint64_t*>(regs->RawData()); | ||
| 245 | + return regs; | ||
| 246 | +} | ||
| 247 | + | ||
| 248 | +Regs* RegsRiscv64::CreateFromUcontext(void* ucontext) { | ||
| 249 | + riscv64_ucontext_t* riscv64_ucontext = reinterpret_cast<riscv64_ucontext_t*>(ucontext); | ||
| 250 | + | ||
| 251 | + RegsRiscv64* regs = new RegsRiscv64(); | ||
| 252 | + memcpy(regs->RawData(), &riscv64_ucontext->uc_mcontext.__gregs[0], | ||
| 253 | + RISCV64_REG_MAX * sizeof(uint64_t)); | ||
| 254 | + return regs; | ||
| 255 | +} | ||
| 256 | + | ||
| 257 | +bool RegsRiscv64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) { | ||
| 258 | + uint64_t data; | ||
| 259 | + Memory* elf_memory = elf->memory(); | ||
| 260 | + // Read from elf memory since it is usually more expensive to read from | ||
| 261 | + // process memory. | ||
| 262 | + if (!elf_memory->ReadFully(elf_offset, &data, sizeof(data))) { | ||
| 263 | + return false; | ||
| 264 | + } | ||
| 265 | + // Look for the kernel sigreturn function. | ||
| 266 | + // __kernel_rt_sigreturn: | ||
| 267 | + // li a7, __NR_rt_sigreturn | ||
| 268 | + // scall | ||
| 269 | + | ||
| 270 | + const uint8_t li_scall[] = {0x93, 0x08, 0xb0, 0x08, 0x73, 0x00, 0x00, 0x00}; | ||
| 271 | + if (memcmp(&data, &li_scall, 8) != 0) { | ||
| 272 | + return false; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + // SP + sizeof(siginfo_t) + uc_mcontext offset + PC offset. | ||
| 276 | + if (!process_memory->ReadFully(regs_[RISCV64_REG_SP] + 0x80 + 0xb0 + 0x00, regs_.data(), | ||
| 277 | + sizeof(uint64_t) * (RISCV64_REG_MAX))) { | ||
| 278 | + return false; | ||
| 279 | + } | ||
| 280 | + return true; | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | +Regs* RegsRiscv64::Clone() { | ||
| 284 | + return new RegsRiscv64(*this); | ||
| 285 | +} | ||
| 286 | + | ||
| 287 | +} // namespace unwindstack | ||
| 288 | diff --git a/system/core/libunwindstack/include/unwindstack/Elf.h b/system/core/libunwindstack/include/unwindstack/Elf.h | ||
| 289 | index 472ed92..88fa0ff 100644 | ||
| 290 | --- a/system/core/libunwindstack/include/unwindstack/Elf.h | ||
| 291 | +++ b/system/core/libunwindstack/include/unwindstack/Elf.h | ||
| 292 | @@ -32,6 +32,10 @@ | ||
| 293 | #define EM_AARCH64 183 | ||
| 294 | #endif | ||
| 295 | |||
| 296 | +#if !defined(EM_RISCV) | ||
| 297 | +#define EM_RISCV 243 | ||
| 298 | +#endif | ||
| 299 | + | ||
| 300 | namespace unwindstack { | ||
| 301 | |||
| 302 | // Forward declaration. | ||
| 303 | @@ -46,6 +50,7 @@ enum ArchEnum : uint8_t { | ||
| 304 | ARCH_X86_64, | ||
| 305 | ARCH_MIPS, | ||
| 306 | ARCH_MIPS64, | ||
| 307 | + ARCH_RISCV64, | ||
| 308 | }; | ||
| 309 | |||
| 310 | class Elf { | ||
| 311 | diff --git a/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h | ||
| 312 | new file mode 100644 | ||
| 313 | index 0000000..397e680 | ||
| 314 | --- /dev/null | ||
| 315 | +++ b/system/core/libunwindstack/include/unwindstack/MachineRiscv64.h | ||
| 316 | @@ -0,0 +1,59 @@ | ||
| 317 | +/* | ||
| 318 | + * Copyright (C) 2022 The Android Open Source Project | ||
| 319 | + * | ||
| 320 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 321 | + * you may not use this file except in compliance with the License. | ||
| 322 | + * You may obtain a copy of the License at | ||
| 323 | + * | ||
| 324 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 325 | + * | ||
| 326 | + * Unless required by applicable law or agreed to in writing, software | ||
| 327 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 328 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 329 | + * See the License for the specific language governing permissions and | ||
| 330 | + * limitations under the License. | ||
| 331 | + */ | ||
| 332 | + | ||
| 333 | +#pragma once | ||
| 334 | + | ||
| 335 | +#include <stdint.h> | ||
| 336 | + | ||
| 337 | +namespace unwindstack { | ||
| 338 | + | ||
| 339 | +enum Riscv64Reg : uint16_t { | ||
| 340 | + RISCV64_REG_PC, | ||
| 341 | + RISCV64_REG_RA, | ||
| 342 | + RISCV64_REG_SP, | ||
| 343 | + RISCV64_REG_GP, | ||
| 344 | + RISCV64_REG_TP, | ||
| 345 | + RISCV64_REG_T0, | ||
| 346 | + RISCV64_REG_T1, | ||
| 347 | + RISCV64_REG_T2, | ||
| 348 | + RISCV64_REG_S0, | ||
| 349 | + RISCV64_REG_S1, | ||
| 350 | + RISCV64_REG_A0, | ||
| 351 | + RISCV64_REG_A1, | ||
| 352 | + RISCV64_REG_A2, | ||
| 353 | + RISCV64_REG_A3, | ||
| 354 | + RISCV64_REG_A4, | ||
| 355 | + RISCV64_REG_A5, | ||
| 356 | + RISCV64_REG_A6, | ||
| 357 | + RISCV64_REG_A7, | ||
| 358 | + RISCV64_REG_S2, | ||
| 359 | + RISCV64_REG_S3, | ||
| 360 | + RISCV64_REG_S4, | ||
| 361 | + RISCV64_REG_S5, | ||
| 362 | + RISCV64_REG_S6, | ||
| 363 | + RISCV64_REG_S7, | ||
| 364 | + RISCV64_REG_S8, | ||
| 365 | + RISCV64_REG_S9, | ||
| 366 | + RISCV64_REG_S10, | ||
| 367 | + RISCV64_REG_S11, | ||
| 368 | + RISCV64_REG_T3, | ||
| 369 | + RISCV64_REG_T4, | ||
| 370 | + RISCV64_REG_T5, | ||
| 371 | + RISCV64_REG_T6, | ||
| 372 | + RISCV64_REG_MAX, | ||
| 373 | +}; | ||
| 374 | + | ||
| 375 | +} // namespace unwindstack | ||
| 376 | diff --git a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h | ||
| 377 | index f0b5e3a..698eba2 100644 | ||
| 378 | --- a/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h | ||
| 379 | +++ b/system/core/libunwindstack/include/unwindstack/RegsGetLocal.h | ||
| 380 | @@ -81,6 +81,49 @@ inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { | ||
| 381 | : "x12", "x13", "memory"); | ||
| 382 | } | ||
| 383 | |||
| 384 | +#elif defined(__riscv) | ||
| 385 | + | ||
| 386 | +inline __attribute__((__always_inline__)) void AsmGetRegs(void* reg_data) { | ||
| 387 | + asm volatile( | ||
| 388 | + "1:\n" | ||
| 389 | + "sd ra, 8(%[base])\n" | ||
| 390 | + "sd sp, 16(%[base])\n" | ||
| 391 | + "sd gp, 24(%[base])\n" | ||
| 392 | + "sd tp, 32(%[base])\n" | ||
| 393 | + "sd t0, 40(%[base])\n" | ||
| 394 | + "sd t1, 48(%[base])\n" | ||
| 395 | + "sd t2, 56(%[base])\n" | ||
| 396 | + "sd s0, 64(%[base])\n" | ||
| 397 | + "sd s1, 72(%[base])\n" | ||
| 398 | + "sd a0, 80(%[base])\n" | ||
| 399 | + "sd a1, 88(%[base])\n" | ||
| 400 | + "sd a2, 96(%[base])\n" | ||
| 401 | + "sd a3, 104(%[base])\n" | ||
| 402 | + "sd a4, 112(%[base])\n" | ||
| 403 | + "sd a5, 120(%[base])\n" | ||
| 404 | + "sd a6, 128(%[base])\n" | ||
| 405 | + "sd a7, 136(%[base])\n" | ||
| 406 | + "sd s2, 144(%[base])\n" | ||
| 407 | + "sd s3, 152(%[base])\n" | ||
| 408 | + "sd s4, 160(%[base])\n" | ||
| 409 | + "sd s5, 168(%[base])\n" | ||
| 410 | + "sd s6, 176(%[base])\n" | ||
| 411 | + "sd s7, 184(%[base])\n" | ||
| 412 | + "sd s8, 192(%[base])\n" | ||
| 413 | + "sd s9, 200(%[base])\n" | ||
| 414 | + "sd s10, 208(%[base])\n" | ||
| 415 | + "sd s11, 216(%[base])\n" | ||
| 416 | + "sd t3, 224(%[base])\n" | ||
| 417 | + "sd t4, 232(%[base])\n" | ||
| 418 | + "sd t5, 240(%[base])\n" | ||
| 419 | + "sd t6, 248(%[base])\n" | ||
| 420 | + "la t1, 1b\n" | ||
| 421 | + "sd t1, 0(%[base])\n" | ||
| 422 | + : [base] "+r"(reg_data) | ||
| 423 | + : | ||
| 424 | + : "t1", "memory"); | ||
| 425 | +} | ||
| 426 | + | ||
| 427 | #elif defined(__i386__) || defined(__x86_64__) || defined(__mips__) | ||
| 428 | |||
| 429 | extern "C" void AsmGetRegs(void* regs); | ||
| 430 | diff --git a/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h | ||
| 431 | new file mode 100644 | ||
| 432 | index 0000000..eb09397 | ||
| 433 | --- /dev/null | ||
| 434 | +++ b/system/core/libunwindstack/include/unwindstack/RegsRiscv64.h | ||
| 435 | @@ -0,0 +1,59 @@ | ||
| 436 | +/* | ||
| 437 | + * Copyright (C) 2022 The Android Open Source Project | ||
| 438 | + * | ||
| 439 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 440 | + * you may not use this file except in compliance with the License. | ||
| 441 | + * You may obtain a copy of the License at | ||
| 442 | + * | ||
| 443 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 444 | + * | ||
| 445 | + * Unless required by applicable law or agreed to in writing, software | ||
| 446 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 447 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 448 | + * See the License for the specific language governing permissions and | ||
| 449 | + * limitations under the License. | ||
| 450 | + */ | ||
| 451 | + | ||
| 452 | +#pragma once | ||
| 453 | + | ||
| 454 | +#include <stdint.h> | ||
| 455 | + | ||
| 456 | +#include <functional> | ||
| 457 | + | ||
| 458 | +#include <unwindstack/Elf.h> | ||
| 459 | +#include <unwindstack/Regs.h> | ||
| 460 | + | ||
| 461 | +namespace unwindstack { | ||
| 462 | + | ||
| 463 | +// Forward declarations. | ||
| 464 | +class Memory; | ||
| 465 | + | ||
| 466 | +class RegsRiscv64 : public RegsImpl<uint64_t> { | ||
| 467 | + public: | ||
| 468 | + RegsRiscv64(); | ||
| 469 | + virtual ~RegsRiscv64() = default; | ||
| 470 | + | ||
| 471 | + ArchEnum Arch() override final; | ||
| 472 | + | ||
| 473 | + uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override; | ||
| 474 | + | ||
| 475 | + bool SetPcFromReturnAddress(Memory* process_memory) override; | ||
| 476 | + | ||
| 477 | + bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override; | ||
| 478 | + | ||
| 479 | + void IterateRegisters(std::function<void(const char*, uint64_t)>) override final; | ||
| 480 | + | ||
| 481 | + uint64_t pc() override; | ||
| 482 | + uint64_t sp() override; | ||
| 483 | + | ||
| 484 | + void set_pc(uint64_t pc) override; | ||
| 485 | + void set_sp(uint64_t sp) override; | ||
| 486 | + | ||
| 487 | + Regs* Clone() override final; | ||
| 488 | + | ||
| 489 | + static Regs* Read(void* data); | ||
| 490 | + | ||
| 491 | + static Regs* CreateFromUcontext(void* ucontext); | ||
| 492 | +}; | ||
| 493 | + | ||
| 494 | +} // namespace unwindstack | ||
| 495 | diff --git a/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h | ||
| 496 | new file mode 100644 | ||
| 497 | index 0000000..c6c82b1 | ||
| 498 | --- /dev/null | ||
| 499 | +++ b/system/core/libunwindstack/include/unwindstack/UcontextRiscv64.h | ||
| 500 | @@ -0,0 +1,80 @@ | ||
| 501 | +/* | ||
| 502 | + * Copyright (C) 2014 The Android Open Source Project | ||
| 503 | + * All rights reserved. | ||
| 504 | + * | ||
| 505 | + * Redistribution and use in source and binary forms, with or without | ||
| 506 | + * modification, are permitted provided that the following conditions | ||
| 507 | + * are met: | ||
| 508 | + * * Redistributions of source code must retain the above copyright | ||
| 509 | + * notice, this list of conditions and the following disclaimer. | ||
| 510 | + * * Redistributions in binary form must reproduce the above copyright | ||
| 511 | + * notice, this list of conditions and the following disclaimer in | ||
| 512 | + * the documentation and/or other materials provided with the | ||
| 513 | + * distribution. | ||
| 514 | + * | ||
| 515 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 516 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 517 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 518 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 519 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 520 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 521 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
| 522 | + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| 523 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 524 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| 525 | + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 526 | + * SUCH DAMAGE. | ||
| 527 | + */ | ||
| 528 | + | ||
| 529 | +#pragma once | ||
| 530 | + | ||
| 531 | +#include <sys/cdefs.h> | ||
| 532 | + | ||
| 533 | +typedef uint64_t __riscv_mc_gp_state[32]; // unsigned long | ||
| 534 | + | ||
| 535 | +struct __riscv_mc_f_ext_state { | ||
| 536 | + uint32_t __f[32]; | ||
| 537 | + uint32_t __fcsr; | ||
| 538 | +}; | ||
| 539 | + | ||
| 540 | +struct __riscv_mc_d_ext_state { | ||
| 541 | + uint64_t __f[32]; | ||
| 542 | + uint32_t __fcsr; | ||
| 543 | +}; | ||
| 544 | + | ||
| 545 | +struct __riscv_mc_q_ext_state { | ||
| 546 | + uint64_t __f[64] __attribute__((__aligned__(16))); | ||
| 547 | + uint32_t __fcsr; | ||
| 548 | + uint32_t __reserved[3]; | ||
| 549 | +}; | ||
| 550 | + | ||
| 551 | +union __riscv_mc_fp_state { | ||
| 552 | + struct __riscv_mc_f_ext_state __f; | ||
| 553 | + struct __riscv_mc_d_ext_state __d; | ||
| 554 | + struct __riscv_mc_q_ext_state __q; | ||
| 555 | +}; | ||
| 556 | + | ||
| 557 | +struct __riscv_stack_t { | ||
| 558 | + uint64_t ss_sp; | ||
| 559 | + int32_t ss_flags; | ||
| 560 | + uint64_t ss_size; | ||
| 561 | +}; | ||
| 562 | + | ||
| 563 | +struct riscv64_sigset_t { | ||
| 564 | + uint64_t sig; // unsigned long | ||
| 565 | +}; | ||
| 566 | + | ||
| 567 | +struct riscv64_mcontext_t { | ||
| 568 | + __riscv_mc_gp_state __gregs; | ||
| 569 | + union __riscv_mc_fp_state __fpregs; | ||
| 570 | +}; | ||
| 571 | + | ||
| 572 | +struct riscv64_ucontext_t { | ||
| 573 | + uint64_t uc_flags; // unsigned long | ||
| 574 | + struct riscv64_ucontext_t* uc_link; | ||
| 575 | + __riscv_stack_t uc_stack; | ||
| 576 | + riscv64_sigset_t uc_sigmask; | ||
| 577 | + /* The kernel adds extra padding here to allow sigset_t to grow. */ | ||
| 578 | + int8_t __padding[128 - sizeof(riscv64_sigset_t)]; // char | ||
| 579 | + riscv64_mcontext_t uc_mcontext; | ||
| 580 | +}; | ||
| 581 | diff --git a/system/core/libunwindstack/include/unwindstack/UserRiscv64.h b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h | ||
| 582 | new file mode 100644 | ||
| 583 | index 0000000..1e91228 | ||
| 584 | --- /dev/null | ||
| 585 | +++ b/system/core/libunwindstack/include/unwindstack/UserRiscv64.h | ||
| 586 | @@ -0,0 +1,37 @@ | ||
| 587 | +/* | ||
| 588 | + * Copyright (C) 2016 The Android Open Source Project | ||
| 589 | + * All rights reserved. | ||
| 590 | + * | ||
| 591 | + * Redistribution and use in source and binary forms, with or without | ||
| 592 | + * modification, are permitted provided that the following conditions | ||
| 593 | + * are met: | ||
| 594 | + * * Redistributions of source code must retain the above copyright | ||
| 595 | + * notice, this list of conditions and the following disclaimer. | ||
| 596 | + * * Redistributions in binary form must reproduce the above copyright | ||
| 597 | + * notice, this list of conditions and the following disclaimer in | ||
| 598 | + * the documentation and/or other materials provided with the | ||
| 599 | + * distribution. | ||
| 600 | + * | ||
| 601 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 602 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 603 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 604 | + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 605 | + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 606 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 607 | + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
| 608 | + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
| 609 | + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 610 | + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | ||
| 611 | + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 612 | + * SUCH DAMAGE. | ||
| 613 | + */ | ||
| 614 | + | ||
| 615 | +#pragma once | ||
| 616 | + | ||
| 617 | +namespace unwindstack { | ||
| 618 | + | ||
| 619 | +struct riscv64_user_regs { | ||
| 620 | + uint64_t regs[32]; | ||
| 621 | +}; | ||
| 622 | + | ||
| 623 | +} // namespace unwindstack | ||
| 624 | diff --git a/system/core/libunwindstack/tools/unwind.cpp b/system/core/libunwindstack/tools/unwind.cpp | ||
| 625 | index 1812e50..ae20891 100644 | ||
| 626 | --- a/system/core/libunwindstack/tools/unwind.cpp | ||
| 627 | +++ b/system/core/libunwindstack/tools/unwind.cpp | ||
| 628 | @@ -83,6 +83,9 @@ void DoUnwind(pid_t pid) { | ||
| 629 | case unwindstack::ARCH_MIPS64: | ||
| 630 | printf("mips64"); | ||
| 631 | break; | ||
| 632 | + case unwindstack::ARCH_RISCV64: | ||
| 633 | + printf("riscv64"); | ||
| 634 | + break; | ||
| 635 | default: | ||
| 636 | printf("unknown\n"); | ||
| 637 | return; | ||
| 638 | diff --git a/system/core/libunwindstack/tools/unwind_symbols.cpp b/system/core/libunwindstack/tools/unwind_symbols.cpp | ||
| 639 | index 8df2284..976db56 100644 | ||
| 640 | --- a/system/core/libunwindstack/tools/unwind_symbols.cpp | ||
| 641 | +++ b/system/core/libunwindstack/tools/unwind_symbols.cpp | ||
| 642 | @@ -77,6 +77,9 @@ int main(int argc, char** argv) { | ||
| 643 | case EM_AARCH64: | ||
| 644 | printf("ABI: arm64\n"); | ||
| 645 | break; | ||
| 646 | + case EM_RISCV: | ||
| 647 | + printf("ABI: riscv64\n"); | ||
| 648 | + break; | ||
| 649 | case EM_386: | ||
| 650 | printf("ABI: x86\n"); | ||
| 651 | 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 @@ | |||
| 1 | Description: Added missing headers causing compile errors | ||
| 2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
| 3 | Forwarded: not-needed | ||
| 4 | |||
| 5 | --- a/system/core/adb/sysdeps/posix/network.cpp | ||
| 6 | +++ b/system/core/adb/sysdeps/posix/network.cpp | ||
| 7 | @@ -22,6 +22,7 @@ | ||
| 8 | #include <sys/socket.h> | ||
| 9 | |||
| 10 | #include <string> | ||
| 11 | +#include <cstring> | ||
| 12 | |||
| 13 | #include <android-base/logging.h> | ||
| 14 | #include <android-base/stringprintf.h> | ||
| 15 | --- a/system/core/base/file.cpp | ||
| 16 | +++ b/system/core/base/file.cpp | ||
| 17 | @@ -26,6 +26,7 @@ | ||
| 18 | #include <sys/stat.h> | ||
| 19 | #include <sys/types.h> | ||
| 20 | #include <unistd.h> | ||
| 21 | +#include <cstring> | ||
| 22 | |||
| 23 | #include <memory> | ||
| 24 | #include <mutex> | ||
| 25 | --- a/system/core/libbacktrace/BacktraceMap.cpp | ||
| 26 | +++ b/system/core/libbacktrace/BacktraceMap.cpp | ||
| 27 | @@ -21,6 +21,7 @@ | ||
| 28 | #include <stdint.h> | ||
| 29 | #include <sys/types.h> | ||
| 30 | #include <unistd.h> | ||
| 31 | +#include <algorithm> | ||
| 32 | |||
| 33 | #include <log/log.h> | ||
| 34 | |||
| 35 | --- a/system/core/libbacktrace/UnwindStackMap.cpp | ||
| 36 | +++ b/system/core/libbacktrace/UnwindStackMap.cpp | ||
| 37 | @@ -20,6 +20,7 @@ | ||
| 38 | |||
| 39 | #include <string> | ||
| 40 | #include <vector> | ||
| 41 | +#include <algorithm> | ||
| 42 | |||
| 43 | #include <backtrace/BacktraceMap.h> | ||
| 44 | #include <unwindstack/Elf.h> | ||
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 @@ | |||
| 1 | Description: Bring Clang's _Nonnull keyword to GCC | ||
| 2 | Author: Kai-Chung Yan | ||
| 3 | Forwarded: not-needed | ||
| 4 | --- a/system/core/adb/sysdeps.h | ||
| 5 | +++ b/system/core/adb/sysdeps.h | ||
| 6 | @@ -40,11 +40,12 @@ | ||
| 7 | #include "sysdeps/network.h" | ||
| 8 | #include "sysdeps/stat.h" | ||
| 9 | |||
| 10 | +#define _Nonnull | ||
| 11 | +#define _Nullable | ||
| 12 | + | ||
| 13 | #ifdef _WIN32 | ||
| 14 | |||
| 15 | // Clang-only nullability specifiers | ||
| 16 | -#define _Nonnull | ||
| 17 | -#define _Nullable | ||
| 18 | |||
| 19 | #include <ctype.h> | ||
| 20 | #include <direct.h> | ||
diff --git a/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 @@ | |||
| 1 | Description: Fix the weird error by GCC7 that fails to match the correct parent method. | ||
| 2 | Author: Kai-Chung Yan | ||
| 3 | Forwarded: not-needed | ||
| 4 | --- a/system/core/libutils/include/utils/Vector.h | ||
| 5 | +++ b/system/core/libutils/include/utils/Vector.h | ||
| 6 | @@ -256,7 +256,7 @@ | ||
| 7 | |||
| 8 | template<class TYPE> inline | ||
| 9 | const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const { | ||
| 10 | - VectorImpl::operator = (static_cast<const VectorImpl&>(rhs)); | ||
| 11 | + VectorImpl::operator = (rhs); | ||
| 12 | return *this; | ||
| 13 | } | ||
| 14 | |||
diff --git a/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 @@ | |||
| 1 | Forwarded: not-needed | ||
| 2 | --- a/system/core/fs_mgr/liblp/reader.cpp | ||
| 3 | +++ b/system/core/fs_mgr/liblp/reader.cpp | ||
| 4 | @@ -22,6 +22,7 @@ | ||
| 5 | #include <unistd.h> | ||
| 6 | |||
| 7 | #include <functional> | ||
| 8 | +#include <cstring> | ||
| 9 | |||
| 10 | #include <android-base/file.h> | ||
| 11 | #include <android-base/unique_fd.h> | ||
| 12 | --- a/system/core/fs_mgr/liblp/writer.cpp | ||
| 13 | +++ b/system/core/fs_mgr/liblp/writer.cpp | ||
| 14 | @@ -21,6 +21,7 @@ | ||
| 15 | #include <unistd.h> | ||
| 16 | |||
| 17 | #include <string> | ||
| 18 | +#include <cstring> | ||
| 19 | |||
| 20 | #include <android-base/file.h> | ||
| 21 | #include <android-base/unique_fd.h> | ||
| 22 | --- a/system/core/liblog/logger_write.cpp | ||
| 23 | +++ b/system/core/liblog/logger_write.cpp | ||
| 24 | @@ -27,6 +27,7 @@ | ||
| 25 | #include <android/set_abort_message.h> | ||
| 26 | #endif | ||
| 27 | |||
| 28 | +#include <mutex> | ||
| 29 | #include <shared_mutex> | ||
| 30 | |||
| 31 | #include <android-base/errno_restorer.h> | ||
| 32 | --- a/system/core/libziparchive/zip_archive_stream_entry.cc | ||
| 33 | +++ b/system/core/libziparchive/zip_archive_stream_entry.cc | ||
| 34 | @@ -23,6 +23,7 @@ | ||
| 35 | #include <sys/types.h> | ||
| 36 | #include <unistd.h> | ||
| 37 | |||
| 38 | +#include <limits> | ||
| 39 | #include <memory> | ||
| 40 | #include <vector> | ||
| 41 | |||
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 @@ | |||
| 1 | Description: remove clang-ism | ||
| 2 | Forwarded: not-needed | ||
| 3 | |||
| 4 | --- a/system/core/base/include/android-base/logging.h | ||
| 5 | +++ b/system/core/base/include/android-base/logging.h | ||
| 6 | @@ -451,10 +451,7 @@ | ||
| 7 | // -Wno-user-defined-warnings to CPPFLAGS. | ||
| 8 | #pragma clang diagnostic push | ||
| 9 | #pragma clang diagnostic ignored "-Wgcc-compat" | ||
| 10 | -#define OSTREAM_STRING_POINTER_USAGE_WARNING \ | ||
| 11 | - __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) | ||
| 12 | -inline OSTREAM_STRING_POINTER_USAGE_WARNING | ||
| 13 | -std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { | ||
| 14 | +inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { | ||
| 15 | return stream << static_cast<const void*>(string_pointer); | ||
| 16 | } | ||
| 17 | #pragma clang diagnostic pop | ||
diff --git a/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 @@ | |||
| 1 | Description: non-x86 arches do not have PAGE_SIZE | ||
| 2 | Forwarded: not-needed | ||
| 3 | --- a/system/core/base/cmsg.cpp | ||
| 4 | +++ b/system/core/base/cmsg.cpp | ||
| 5 | @@ -33,7 +33,8 @@ | ||
| 6 | const std::vector<int>& fds) { | ||
| 7 | size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); | ||
| 8 | size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); | ||
| 9 | - if (cmsg_space >= PAGE_SIZE) { | ||
| 10 | + size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE)); | ||
| 11 | + if (cmsg_space >= pagesize) { | ||
| 12 | errno = ENOMEM; | ||
| 13 | return -1; | ||
| 14 | } | ||
| 15 | @@ -75,7 +76,8 @@ | ||
| 16 | fds->clear(); | ||
| 17 | |||
| 18 | size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds); | ||
| 19 | - if (cmsg_space >= PAGE_SIZE) { | ||
| 20 | + size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE)); | ||
| 21 | + if (cmsg_space >= pagesize) { | ||
| 22 | errno = ENOMEM; | ||
| 23 | return -1; | ||
| 24 | } | ||
diff --git a/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 @@ | |||
| 1 | Description: get libcutils building | ||
| 2 | Forwarded: not-needed | ||
| 3 | --- a/system/core/libcutils/include/cutils/threads.h | ||
| 4 | +++ b/system/core/libcutils/include/cutils/threads.h | ||
| 5 | @@ -33,7 +33,7 @@ | ||
| 6 | // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. | ||
| 7 | // | ||
| 8 | |||
| 9 | -extern pid_t gettid(); | ||
| 10 | +extern pid_t gettid(void) __THROW; | ||
| 11 | |||
| 12 | // | ||
| 13 | // Deprecated: use `_Thread_local` in C or `thread_local` in C++. | ||
| 14 | --- a/system/core/libcutils/threads.cpp | ||
| 15 | +++ b/system/core/libcutils/threads.cpp | ||
| 16 | @@ -33,7 +33,7 @@ | ||
| 17 | |||
| 18 | // No definition needed for Android because we'll just pick up bionic's copy. | ||
| 19 | #ifndef __ANDROID__ | ||
| 20 | -pid_t gettid() { | ||
| 21 | +pid_t gettid(void) __THROW { | ||
| 22 | #if defined(__APPLE__) | ||
| 23 | uint64_t tid; | ||
| 24 | 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 @@ | |||
| 1 | Description: Add missing 'std::' scope identifiers. | ||
| 2 | Forwarded: not-needed | ||
| 3 | --- a/system/core/libunwindstack/include/unwindstack/DwarfMemory.h | ||
| 4 | +++ b/system/core/libunwindstack/include/unwindstack/DwarfMemory.h | ||
| 5 | @@ -29,7 +29,7 @@ | ||
| 6 | DwarfMemory(Memory* memory) : memory_(memory) {} | ||
| 7 | virtual ~DwarfMemory() = default; | ||
| 8 | |||
| 9 | - bool ReadBytes(void* dst, size_t num_bytes); | ||
| 10 | + bool ReadBytes(void* dst, std::size_t num_bytes); | ||
| 11 | |||
| 12 | template <typename SignedType> | ||
| 13 | bool ReadSigned(uint64_t* value); | ||
| 14 | @@ -39,7 +39,7 @@ | ||
| 15 | bool ReadSLEB128(int64_t* value); | ||
| 16 | |||
| 17 | template <typename AddressType> | ||
| 18 | - size_t GetEncodedSize(uint8_t encoding); | ||
| 19 | + std::size_t GetEncodedSize(uint8_t encoding); | ||
| 20 | |||
| 21 | bool AdjustEncodedValue(uint8_t encoding, uint64_t* value); | ||
| 22 | |||
diff --git a/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 @@ | |||
| 1 | Description: just hard code rather than deal with circular deps | ||
| 2 | Forwarded: not-needed | ||
| 3 | --- a/system/core/adb/adb.cpp | ||
| 4 | +++ b/system/core/adb/adb.cpp | ||
| 5 | @@ -44,8 +44,6 @@ | ||
| 6 | #include <android-base/parsenetaddress.h> | ||
| 7 | #include <android-base/stringprintf.h> | ||
| 8 | #include <android-base/strings.h> | ||
| 9 | -#include <build/version.h> | ||
| 10 | -#include <platform_tools_version.h> | ||
| 11 | |||
| 12 | #include "adb_auth.h" | ||
| 13 | #include "adb_io.h" | ||
| 14 | @@ -69,7 +67,7 @@ | ||
| 15 | "Version %s-%s\n" | ||
| 16 | "Installed as %s\n", | ||
| 17 | ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, | ||
| 18 | - PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(), | ||
| 19 | + PLATFORM_TOOLS_VERSION, "debian", | ||
| 20 | android::base::GetExecutablePath().c_str()); | ||
| 21 | } | ||
| 22 | |||
| 23 | --- a/system/core/fastboot/fastboot.cpp | ||
| 24 | +++ b/system/core/fastboot/fastboot.cpp | ||
| 25 | @@ -59,10 +59,8 @@ | ||
| 26 | #include <android-base/stringprintf.h> | ||
| 27 | #include <android-base/strings.h> | ||
| 28 | #include <android-base/unique_fd.h> | ||
| 29 | -#include <build/version.h> | ||
| 30 | #include <libavb/libavb.h> | ||
| 31 | #include <liblp/liblp.h> | ||
| 32 | -#include <platform_tools_version.h> | ||
| 33 | #include <sparse/sparse.h> | ||
| 34 | #include <ziparchive/zip_archive.h> | ||
| 35 | |||
| 36 | @@ -1680,7 +1678,7 @@ | ||
| 37 | setvbuf(stdout, nullptr, _IONBF, 0); | ||
| 38 | setvbuf(stderr, nullptr, _IONBF, 0); | ||
| 39 | } else if (name == "version") { | ||
| 40 | - fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str()); | ||
| 41 | + fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, "debian"); | ||
| 42 | fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str()); | ||
| 43 | return 0; | ||
| 44 | #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 @@ | |||
| 1 | Description: libusb.h comes from different location | ||
| 2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
| 3 | Forwarded: not-needed | ||
| 4 | Last-Update: 2018-05-26 | ||
| 5 | |||
| 6 | --- a/system/core/adb/client/usb_libusb.cpp | ||
| 7 | +++ b/system/core/adb/client/usb_libusb.cpp | ||
| 8 | @@ -30,7 +30,7 @@ | ||
| 9 | #include <thread> | ||
| 10 | #include <unordered_map> | ||
| 11 | |||
| 12 | -#include <libusb/libusb.h> | ||
| 13 | +#include <libusb-1.0/libusb.h> | ||
| 14 | |||
| 15 | #include <android-base/file.h> | ||
| 16 | #include <android-base/logging.h> | ||
diff --git a/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 @@ | |||
| 1 | Description: Update log file directory. | ||
| 2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
| 3 | Last Updated: 2018-05-17 | ||
| 4 | |||
| 5 | --- a/system/core/adb/adb_utils.cpp | ||
| 6 | +++ b/system/core/adb/adb_utils.cpp | ||
| 7 | @@ -339,6 +339,11 @@ | ||
| 8 | |||
| 9 | return temp_path_utf8 + log_name; | ||
| 10 | #else | ||
| 11 | + std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid()); | ||
| 12 | + struct stat st = {0}; | ||
| 13 | + if (stat(log_dir.c_str(), &st) == 0) { | ||
| 14 | + return log_dir; | ||
| 15 | + } | ||
| 16 | const char* tmp_dir = getenv("TMPDIR"); | ||
| 17 | if (tmp_dir == nullptr) tmp_dir = "/tmp"; | ||
| 18 | return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid()); | ||
diff --git a/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 @@ | |||
| 1 | Description: Port simg_dump to Python 3. | ||
| 2 | Author: Antonio Russo <antonio.e.russo@gmail.com> | ||
| 3 | Forwarded: not-needed | ||
| 4 | Last-Update: 2019-01-05 | ||
| 5 | Origin: https://bugs.debian.org/945646 | ||
| 6 | |||
| 7 | --- | ||
| 8 | Index: android-platform-tools/system/core/libsparse/simg_dump.py | ||
| 9 | =================================================================== | ||
| 10 | --- android-platform-tools.orig/system/core/libsparse/simg_dump.py | ||
| 11 | +++ android-platform-tools/system/core/libsparse/simg_dump.py | ||
| 12 | @@ -1,4 +1,4 @@ | ||
| 13 | -#! /usr/bin/env python | ||
| 14 | +#! /usr/bin/env python3 | ||
| 15 | |||
| 16 | # Copyright (C) 2012 The Android Open Source Project | ||
| 17 | # | ||
| 18 | @@ -14,7 +14,7 @@ | ||
| 19 | # See the License for the specific language governing permissions and | ||
| 20 | # limitations under the License. | ||
| 21 | |||
| 22 | -from __future__ import print_function | ||
| 23 | + | ||
| 24 | import csv | ||
| 25 | import getopt | ||
| 26 | import hashlib | ||
| 27 | @@ -47,7 +47,7 @@ def main(): | ||
| 28 | opts, args = getopt.getopt(sys.argv[1:], | ||
| 29 | "vsc:", | ||
| 30 | ["verbose", "showhash", "csvfile"]) | ||
| 31 | - except getopt.GetoptError, e: | ||
| 32 | + except getopt.GetoptError as e: | ||
| 33 | print(e) | ||
| 34 | usage(me) | ||
| 35 | for o, a in opts: | ||
| 36 | @@ -66,7 +66,7 @@ def main(): | ||
| 37 | usage(me) | ||
| 38 | |||
| 39 | if csvfilename: | ||
| 40 | - csvfile = open(csvfilename, "wb") | ||
| 41 | + csvfile = open(csvfilename, "w", newline='') | ||
| 42 | csvwriter = csv.writer(csvfile) | ||
| 43 | |||
| 44 | output = verbose or csvfilename or showhash | ||
| 45 | @@ -121,7 +121,7 @@ def main(): | ||
| 46 | "output offset", "output blocks", "type", "hash"]) | ||
| 47 | |||
| 48 | offset = 0 | ||
| 49 | - for i in xrange(1, total_chunks + 1): | ||
| 50 | + for i in range(1, total_chunks + 1): | ||
| 51 | header_bin = FH.read(12) | ||
| 52 | header = struct.unpack("<2H2I", header_bin) | ||
| 53 | chunk_type = header[0] | ||
| 54 | @@ -160,7 +160,7 @@ def main(): | ||
| 55 | if showhash: | ||
| 56 | h = hashlib.sha1() | ||
| 57 | data = fill_bin * (blk_sz / 4); | ||
| 58 | - for block in xrange(chunk_sz): | ||
| 59 | + for block in range(chunk_sz): | ||
| 60 | h.update(data) | ||
| 61 | curhash = h.hexdigest() | ||
| 62 | elif chunk_type == 0xCAC3: | ||
diff --git a/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 @@ | |||
| 1 | Description: Fix incompatibility between <stdatomic.h> and <atomic> | ||
| 2 | This 2 headers combined will cause errors for both GCC and Clang. This patch | ||
| 3 | makes sure only one of them is present at any time. | ||
| 4 | Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 | ||
| 5 | Bug: https://reviews.llvm.org/D45470 | ||
| 6 | --- a/system/core/libcutils/include/cutils/trace.h | ||
| 7 | +++ b/system/core/libcutils/include/cutils/trace.h | ||
| 8 | @@ -18,7 +18,14 @@ | ||
| 9 | #define _LIBS_CUTILS_TRACE_H | ||
| 10 | |||
| 11 | #include <inttypes.h> | ||
| 12 | +#ifdef __cplusplus | ||
| 13 | +#include <atomic> | ||
| 14 | +using std::atomic_bool; | ||
| 15 | +using std::atomic_load_explicit; | ||
| 16 | +using std::memory_order_acquire; | ||
| 17 | +#else | ||
| 18 | #include <stdatomic.h> | ||
| 19 | +#endif | ||
| 20 | #include <stdbool.h> | ||
| 21 | #include <stdint.h> | ||
| 22 | #include <stdio.h> | ||
| 23 | --- a/system/core/libcutils/include/cutils/atomic.h | ||
| 24 | +++ b/system/core/libcutils/include/cutils/atomic.h | ||
| 25 | @@ -19,7 +19,23 @@ | ||
| 26 | |||
| 27 | #include <stdint.h> | ||
| 28 | #include <sys/types.h> | ||
| 29 | +#ifdef __cplusplus | ||
| 30 | +#include <atomic> | ||
| 31 | +using std::atomic_compare_exchange_strong_explicit; | ||
| 32 | +using std::atomic_fetch_add_explicit; | ||
| 33 | +using std::atomic_fetch_or_explicit; | ||
| 34 | +using std::atomic_fetch_sub_explicit; | ||
| 35 | +using std::atomic_int_least32_t; | ||
| 36 | +using std::atomic_load_explicit; | ||
| 37 | +using std::atomic_store_explicit; | ||
| 38 | +using std::atomic_thread_fence; | ||
| 39 | +using std::memory_order::memory_order_acquire; | ||
| 40 | +using std::memory_order::memory_order_relaxed; | ||
| 41 | +using std::memory_order::memory_order_release; | ||
| 42 | +using std::memory_order::memory_order_seq_cst; | ||
| 43 | +#else | ||
| 44 | #include <stdatomic.h> | ||
| 45 | +#endif | ||
| 46 | |||
| 47 | #ifndef ANDROID_ATOMIC_INLINE | ||
| 48 | #define ANDROID_ATOMIC_INLINE static inline | ||
| 49 | --- a/system/core/liblog/logger.h | ||
| 50 | +++ b/system/core/liblog/logger.h | ||
| 51 | @@ -16,7 +16,13 @@ | ||
| 52 | |||
| 53 | #pragma once | ||
| 54 | |||
| 55 | +#ifdef __cplusplus | ||
| 56 | +#include <atomic> | ||
| 57 | +using std::atomic_int; | ||
| 58 | +using std::atomic_uintptr_t; | ||
| 59 | +#else | ||
| 60 | #include <stdatomic.h> | ||
| 61 | +#endif | ||
| 62 | #include <sys/cdefs.h> | ||
| 63 | |||
| 64 | #include <log/log.h> | ||
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 @@ | |||
| 1 | Description: Defer packaging fastdeploy with adb for 29.x.x tags. | ||
| 2 | Forwarded: not-needed | ||
| 3 | --- a/system/core/adb/client/commandline.cpp | ||
| 4 | +++ b/system/core/adb/client/commandline.cpp | ||
| 5 | @@ -59,7 +59,6 @@ | ||
| 6 | #include "bugreport.h" | ||
| 7 | #include "client/file_sync_client.h" | ||
| 8 | #include "commandline.h" | ||
| 9 | -#include "fastdeploy.h" | ||
| 10 | #include "services.h" | ||
| 11 | #include "shell_protocol.h" | ||
| 12 | #include "sysdeps/chrono.h" | ||
| 13 | --- a/system/core/adb/client/adb_install.cpp | ||
| 14 | +++ b/system/core/adb/client/adb_install.cpp | ||
| 15 | @@ -35,7 +35,6 @@ | ||
| 16 | #include "adb_utils.h" | ||
| 17 | #include "client/file_sync_client.h" | ||
| 18 | #include "commandline.h" | ||
| 19 | -#include "fastdeploy.h" | ||
| 20 | |||
| 21 | static constexpr int kFastDeployMinApi = 24; | ||
| 22 | |||
| 23 | @@ -167,14 +166,6 @@ | ||
| 24 | } | ||
| 25 | |||
| 26 | if (use_fastdeploy) { | ||
| 27 | - auto metadata = extract_metadata(file); | ||
| 28 | - if (metadata.has_value()) { | ||
| 29 | - // pass all but 1st (command) and last (apk path) parameters through to pm for | ||
| 30 | - // session creation | ||
| 31 | - std::vector<const char*> pm_args{argv + 1, argv + argc - 1}; | ||
| 32 | - auto patchFd = install_patch(pm_args.size(), pm_args.data()); | ||
| 33 | - return stream_patch(file, std::move(metadata.value()), std::move(patchFd)); | ||
| 34 | - } | ||
| 35 | } | ||
| 36 | |||
| 37 | struct stat sb; | ||
| 38 | @@ -267,16 +258,6 @@ | ||
| 39 | argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */ | ||
| 40 | |||
| 41 | if (use_fastdeploy) { | ||
| 42 | - auto metadata = extract_metadata(apk_file[0]); | ||
| 43 | - if (metadata.has_value()) { | ||
| 44 | - auto patchFd = apply_patch_on_device(apk_dest.c_str()); | ||
| 45 | - int status = stream_patch(apk_file[0], std::move(metadata.value()), std::move(patchFd)); | ||
| 46 | - | ||
| 47 | - result = pm_command(argc, argv); | ||
| 48 | - delete_device_file(apk_dest); | ||
| 49 | - | ||
| 50 | - return status; | ||
| 51 | - } | ||
| 52 | } | ||
| 53 | |||
| 54 | if (do_sync_push(apk_file, apk_dest.c_str(), false)) { | ||
| 55 | @@ -292,7 +273,6 @@ | ||
| 56 | InstallMode installMode = INSTALL_DEFAULT; | ||
| 57 | bool use_fastdeploy = false; | ||
| 58 | bool is_reinstall = false; | ||
| 59 | - FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; | ||
| 60 | |||
| 61 | for (int i = 1; i < argc; i++) { | ||
| 62 | if (!strcmp(argv[i], "--streaming")) { | ||
| 63 | @@ -313,13 +293,10 @@ | ||
| 64 | use_fastdeploy = false; | ||
| 65 | } else if (!strcmp(argv[i], "--force-agent")) { | ||
| 66 | processedArgIndicies.push_back(i); | ||
| 67 | - agent_update_strategy = FastDeploy_AgentUpdateAlways; | ||
| 68 | } else if (!strcmp(argv[i], "--date-check-agent")) { | ||
| 69 | processedArgIndicies.push_back(i); | ||
| 70 | - agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp; | ||
| 71 | } else if (!strcmp(argv[i], "--version-check-agent")) { | ||
| 72 | processedArgIndicies.push_back(i); | ||
| 73 | - agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | @@ -331,13 +308,11 @@ | ||
| 78 | error_exit("Attempting to use streaming install on unsupported device"); | ||
| 79 | } | ||
| 80 | |||
| 81 | - if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) { | ||
| 82 | - printf("Fast Deploy is only compatible with devices of API version %d or higher, " | ||
| 83 | - "ignoring.\n", | ||
| 84 | - kFastDeployMinApi); | ||
| 85 | + if (use_fastdeploy) { | ||
| 86 | + printf("Fast Deploy is unavailable in this build of adb, " | ||
| 87 | + "ignoring.\n"); | ||
| 88 | use_fastdeploy = false; | ||
| 89 | } | ||
| 90 | - fastdeploy_set_agent_update_strategy(agent_update_strategy); | ||
| 91 | |||
| 92 | std::vector<const char*> passthrough_argv; | ||
| 93 | for (int i = 0; i < argc; i++) { | ||
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/debian/system/core/throw-exception-on-unknown-os.patch index 5e239b7dc6..6b07f17bfc 100644 --- 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/debian/system/core/throw-exception-on-unknown-os.patch | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | Description: Turn #error into exceptions | 1 | Description: Turn #error into exceptions |
| 2 | So the library can be built on non-Linux platforms too, although can't | 2 | So the library can be built on non-Linux platforms too, although can't |
| 3 | guarauntee its functionality regarding that piece of code. | 3 | guarauntee its functionality regarding that piece of code. |
| 4 | --- a/base/file.cpp | 4 | Forwarded: not-needed |
| 5 | +++ b/base/file.cpp | 5 | --- a/system/core/base/file.cpp |
| 6 | +++ b/system/core/base/file.cpp | ||
| 6 | @@ -422,7 +422,8 @@ | 7 | @@ -422,7 +422,8 @@ |
| 7 | path[PATH_MAX - 1] = 0; | 8 | path[PATH_MAX - 1] = 0; |
| 8 | return path; | 9 | return path; |
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 @@ | |||
| 1 | Description: Turn #error into exceptions | ||
| 2 | So the library can be built on non-Linux platforms too, although can't | ||
| 3 | guarauntee its functionality regarding that piece of code. | ||
| 4 | Forwarded: not-needed | ||
| 5 | --- a/system/core/base/file.cpp | ||
| 6 | +++ b/system/core/base/file.cpp | ||
| 7 | @@ -422,7 +422,8 @@ | ||
| 8 | path[PATH_MAX - 1] = 0; | ||
| 9 | return path; | ||
| 10 | #else | ||
| 11 | -#error unknown OS | ||
| 12 | +#include <stdexcept> | ||
| 13 | + throw std::runtime_error(std::string("Unknown OS!")); | ||
| 14 | #endif | ||
| 15 | } | ||
| 16 | |||
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 @@ | |||
| 1 | libcrypto_utils.mk: modifications to make it build in yocto environment | ||
| 2 | |||
| 3 | Adding an include file that is setting the common flags. | ||
| 4 | Changed the cppflag to include the headers from other components | ||
| 5 | of android-tools | ||
| 6 | |||
| 7 | Modified LDflags so that the libraries that are coming from other android-tools | ||
| 8 | are searched in the output folder. | ||
| 9 | |||
| 10 | Modified the build rule so that it outputs the binary and header to the OUT_DIR | ||
| 11 | |||
| 12 | Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com> | ||
| 13 | |||
| 14 | --- git/debian/libcrypto_utils.mk 2021-04-30 14:18:54.071379767 +0200 | ||
| 15 | +++ git/debian/libcrypto_utils.mk 2021-04-30 14:22:46.179047308 +0200 | ||
| 16 | @@ -1,15 +1,17 @@ | ||
| 17 | +include ../../rules_yocto.mk | ||
| 18 | NAME:= libcrypto_utils | ||
| 19 | SOURCES := android_pubkey.c | ||
| 20 | SOURCES := $(foreach source, $(SOURCES), libcrypto_utils/$(source)) | ||
| 21 | -CPPFLAGS += -Ilibcrypto_utils/include -Iinclude | ||
| 22 | +CPPFLAGS += -Ilibcrypto_utils/include -Iinclude -I$(OUT_DIR)/usr/include | ||
| 23 | LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \ | ||
| 24 | -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 25 | - -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 26 | - -lcrypto -Wl,-z,defs | ||
| 27 | + -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \ | ||
| 28 | + -l:libcrypto.so.0 -Wl,-z,defs | ||
| 29 | |||
| 30 | build: $(SOURCES) | ||
| 31 | - $(CC) $^ -o $(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) | ||
| 32 | - ln -s $(NAME).so.0 $(NAME).so | ||
| 33 | + $(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CPPFLAGS) $(LDFLAGS) | ||
| 34 | + ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so | ||
| 35 | + cp -r libcrypto_utils/include/* $(OUT_DIR)/usr/include/ | ||
| 36 | |||
| 37 | clean: | ||
| 38 | - $(RM) $(NAME).so* | ||
| 39 | + $(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so* | ||
diff --git a/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 @@ | |||
| 1 | user_pt_regs.patch | ||
| 2 | legacy_built-in_sync_functions.patch | ||
| 3 | 20150704-CVE-2015-3239_dwarf_i.h.patch | ||
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 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | 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 @@ | |||
| 1 | CPPFLAGS += -fPIC | CPPFLAGS += -fPIC | |
| 2 | ifndef OUT_DIR | ||
| 3 | OUT_DIR = ../../debian/out | ||
| 4 | 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 @@ | |||
| 1 | DESCRIPTION = "Different utilities from Android" | ||
| 2 | SECTION = "console/utils" | ||
| 3 | LICENSE = "Apache-2.0 & GPL-2.0-only & BSD-2-Clause & BSD-3-Clause" | ||
| 4 | LIC_FILES_CHKSUM = " \ | ||
| 5 | file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ | ||
| 6 | file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ | ||
| 7 | file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \ | ||
| 8 | file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ | ||
| 9 | " | ||
| 10 | DEPENDS = "libbsd libpcre zlib libcap libusb squashfs-tools p7zip libselinux" | ||
| 11 | |||
| 12 | ANDROID_MIRROR = "android.googlesource.com" | ||
| 13 | |||
| 14 | # matches with 10.0.0+r36 | ||
| 15 | SRCREV_boringssl = "ae2dd49c7cb74d04bdba7c1c9bd62c1e9cdf98f6" | ||
| 16 | SRCREV_core = "5aa13b053182b758d7a19db0c83e1b9b5bf1ec2e" | ||
| 17 | SRCREV_extras = "d31740f9d0399f8b938e88e58843d966e1cccab6" | ||
| 18 | SRCREV_libhardware = "c6925520342a7d37758f85eb1cf3baa20a7b7a18" | ||
| 19 | SRCREV_build = "28768b3120f751583a2743101b892f210d4715cf" | ||
| 20 | SRCREV_libunwind = "03a963ecf6ea836b38b3537cbcda0ecfd7a77393" | ||
| 21 | |||
| 22 | SRC_URI = " \ | ||
| 23 | git://salsa.debian.org/android-tools-team/android-platform-external-boringssl;name=boringssl;protocol=https;nobranch=1;destsuffix=git/external/boringssl \ | ||
| 24 | git://salsa.debian.org/android-tools-team/android-platform-system-core;name=core;protocol=https;nobranch=1;destsuffix=git/system/core \ | ||
| 25 | git://salsa.debian.org/android-tools-team/android-platform-system-extras;name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \ | ||
| 26 | git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \ | ||
| 27 | git://salsa.debian.org/android-tools-team/android-platform-build.git;name=build;protocol=https;nobranch=1;destsuffix=git/build \ | ||
| 28 | git://salsa.debian.org/android-tools-team/android-platform-external-libunwind.git;protocol=https;name=libunwind;nobranch=1;destsuffix=git/external/libunwind \ | ||
| 29 | " | ||
| 30 | |||
| 31 | # Patches copied from android-platform-system-core/debian/patches | ||
| 32 | # and applied in the order defined by the "series" file | ||
| 33 | SRC_URI += " \ | ||
| 34 | file://core-debian/move-log-file-to-proper-dir.patch;patchdir=system/core \ | ||
| 35 | file://core-debian/Added-missing-headers.patch;patchdir=system/core \ | ||
| 36 | file://core-debian/libusb-header-path.patch;patchdir=system/core \ | ||
| 37 | file://core-debian/stdatomic.patch;patchdir=system/core \ | ||
| 38 | file://core-debian/Nonnull.patch;patchdir=system/core \ | ||
| 39 | file://core-debian/Vector-cast.patch;patchdir=system/core \ | ||
| 40 | file://core-debian/use-Python-3-for-mkbootimg.patch;patchdir=system/core \ | ||
| 41 | file://core-debian/throw-exception-on-unknown-os.patch;patchdir=system/core \ | ||
| 42 | file://core-debian/simg_dump-python3.patch;patchdir=system/core \ | ||
| 43 | file://core-debian/fix-attribute-issue-with-gcc.patch;patchdir=system/core \ | ||
| 44 | file://core-debian/workaround-error-expected-primary-expression-before-.-token.patch;patchdir=system/core \ | ||
| 45 | file://core-debian/fix-gettid-exception-declaration.patch;patchdir=system/core \ | ||
| 46 | file://core-debian/fix-build-on-non-x86.patch;patchdir=system/core \ | ||
| 47 | file://core-debian/add-missing-headers.patch;patchdir=system/core \ | ||
| 48 | file://core-debian/hard-code-build-number.patch;patchdir=system/core \ | ||
| 49 | file://core-debian/fix-gcc-11-ftbfs.patch;patchdir=system/core \ | ||
| 50 | file://core-debian/fix-gnu-hurd.patch;patchdir=system/core \ | ||
| 51 | " | ||
| 52 | |||
| 53 | # Patches copied from android-platform-external-libunwind/debian/patches | ||
| 54 | # and applied in the order defined by the "series" file | ||
| 55 | SRC_URI += " \ | ||
| 56 | file://libunwind-debian/user_pt_regs.patch;patchdir=external/libunwind \ | ||
| 57 | file://libunwind-debian/legacy_built-in_sync_functions.patch;patchdir=external/libunwind \ | ||
| 58 | file://libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch;patchdir=external/libunwind \ | ||
| 59 | " | ||
| 60 | |||
| 61 | # meta-openembedded specific patches + files: | ||
| 62 | SRC_URI += " \ | ||
| 63 | file://core/0001-patching-adb.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ | ||
| 64 | file://core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \ | ||
| 65 | file://core/0003-socket.h-removing-dependency-of-gtest.patch;patchdir=system/core \ | ||
| 66 | file://core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ | ||
| 67 | file://core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch;patchdir=system/core \ | ||
| 68 | file://core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch;patchdir=system/core \ | ||
| 69 | file://core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch;patchdir=system/core \ | ||
| 70 | file://core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \ | ||
| 71 | file://core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ | ||
| 72 | file://core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ | ||
| 73 | file://core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ | ||
| 74 | file://core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ | ||
| 75 | file://core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch;patchdir=system/core \ | ||
| 76 | file://core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch;patchdir=system/core \ | ||
| 77 | file://core/0015-Use-namespace-std-to-compile-libbacktrace.patch;patchdir=system/core \ | ||
| 78 | file://core/0016-Adapt-adbd-to-work-with-yocto.patch;patchdir=system/core \ | ||
| 79 | file://core/0017-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch;patchdir=system/core \ | ||
| 80 | file://core/0018-img2simg-Fix-wrong-rpath.patch;patchdir=system/core \ | ||
| 81 | file://core/0019-Fix-compilation-with-gcc.patch;patchdir=system/core \ | ||
| 82 | file://core/0020-adb-Fix-build-on-big-endian-systems.patch;patchdir=system/core \ | ||
| 83 | file://core/0021-adb-Allow-adbd-to-be-run-as-root.patch;patchdir=system/core \ | ||
| 84 | file://0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch;patchdir=external/boringssl \ | ||
| 85 | file://0001-patching-libundwind-to-build-in-yocto-environment.patch;patchdir=external/libunwind \ | ||
| 86 | file://0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch;patchdir=system/extras \ | ||
| 87 | file://0002-libfec-change-out_dir-in-makefile.patch;patchdir=system/extras \ | ||
| 88 | file://rules_yocto.mk;subdir=git \ | ||
| 89 | file://android-tools-adbd.service \ | ||
| 90 | file://adbd.mk;subdir=git/system/core/debian \ | ||
| 91 | " | ||
| 92 | |||
| 93 | S = "${WORKDIR}/git" | ||
| 94 | B = "${WORKDIR}/${BPN}" | ||
| 95 | |||
| 96 | # http://errors.yoctoproject.org/Errors/Details/1debian881/ | ||
| 97 | ARM_INSTRUCTION_SET:armv4 = "arm" | ||
| 98 | ARM_INSTRUCTION_SET:armv5 = "arm" | ||
| 99 | |||
| 100 | COMPATIBLE_HOST:powerpc = "(null)" | ||
| 101 | COMPATIBLE_HOST:powerpc64 = "(null)" | ||
| 102 | COMPATIBLE_HOST:powerpc64le = "(null)" | ||
| 103 | |||
| 104 | inherit systemd | ||
| 105 | |||
| 106 | SYSTEMD_SERVICE:${PN} = "android-tools-adbd.service" | ||
| 107 | |||
| 108 | # Find libbsd headers during native builds | ||
| 109 | CC:append:class-native = " -I${STAGING_INCDIR}" | ||
| 110 | CC:append:class-nativesdk = " -I${STAGING_INCDIR}" | ||
| 111 | |||
| 112 | PREREQUISITE_core = "libbase libsparse liblog libcutils" | ||
| 113 | TOOLS_TO_BUILD = "libcrypto_utils libadb libziparchive fastboot adb img2simg simg2img libbacktrace" | ||
| 114 | TOOLS_TO_BUILD:append:class-target = " adbd" | ||
| 115 | |||
| 116 | do_compile() { | ||
| 117 | |||
| 118 | case "${HOST_ARCH}" in | ||
| 119 | arm) | ||
| 120 | export android_arch=linux-arm | ||
| 121 | cpu=arm | ||
| 122 | deb_host_arch=arm | ||
| 123 | ;; | ||
| 124 | aarch64) | ||
| 125 | export android_arch=linux-arm64 | ||
| 126 | cpu=arm64 | ||
| 127 | deb_host_arch=arm64 | ||
| 128 | ;; | ||
| 129 | riscv64) | ||
| 130 | export android_arch=linux-riscv64 | ||
| 131 | ;; | ||
| 132 | mips|mipsel) | ||
| 133 | export android_arch=linux-mips | ||
| 134 | cpu=mips | ||
| 135 | deb_host_arch=mips | ||
| 136 | ;; | ||
| 137 | mips64|mips64el) | ||
| 138 | export android_arch=linux-mips64 | ||
| 139 | cpu=mips64 | ||
| 140 | deb_host_arch=mips64 | ||
| 141 | ;; | ||
| 142 | powerpc|powerpc64) | ||
| 143 | export android_arch=linux-ppc | ||
| 144 | ;; | ||
| 145 | i586|i686|x86_64) | ||
| 146 | export android_arch=linux-x86 | ||
| 147 | cpu=x86_64 | ||
| 148 | deb_host_arch=amd64 | ||
| 149 | ;; | ||
| 150 | esac | ||
| 151 | |||
| 152 | export SRCDIR=${S} | ||
| 153 | |||
| 154 | oe_runmake -f ${S}/external/boringssl/debian/libcrypto.mk -C ${S}/external/boringssl | ||
| 155 | oe_runmake -f ${S}/external/libunwind/debian/libunwind.mk -C ${S}/external/libunwind CPU=${cpu} | ||
| 156 | |||
| 157 | for tool in ${PREREQUISITE_core}; do | ||
| 158 | oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core | ||
| 159 | done | ||
| 160 | |||
| 161 | for i in `find ${S}/system/extras/debian/ -name "*.mk"`; do | ||
| 162 | oe_runmake -f $i -C ${S}/system/extras | ||
| 163 | done | ||
| 164 | |||
| 165 | for tool in ${TOOLS_TO_BUILD}; do | ||
| 166 | if [ "$tool" = "libbacktrace" ]; then | ||
| 167 | oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core DEB_HOST_ARCH=${deb_host_arch} | ||
| 168 | else | ||
| 169 | oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core | ||
| 170 | fi | ||
| 171 | done | ||
| 172 | |||
| 173 | } | ||
| 174 | |||
| 175 | do_install() { | ||
| 176 | for tool in img2simg simg2img fastboot; do | ||
| 177 | if echo ${TOOLS_TO_BUILD} | grep -q "$tool" ; then | ||
| 178 | install -D -p -m0755 ${S}/debian/out/usr/bin/$tool ${D}${bindir}/$tool | ||
| 179 | fi | ||
| 180 | done | ||
| 181 | |||
| 182 | if echo ${TOOLS_TO_BUILD} | grep -q "adb " ; then | ||
| 183 | install -d ${D}${bindir} | ||
| 184 | install -m0755 ${S}/debian/out/usr/lib/android/adb/adb ${D}${bindir} | ||
| 185 | fi | ||
| 186 | |||
| 187 | if echo ${TOOLS_TO_BUILD} | grep -q "adbd" ; then | ||
| 188 | install -d ${D}${bindir} | ||
| 189 | install -m0755 ${B}/adbd/adbd ${D}${bindir} | ||
| 190 | fi | ||
| 191 | |||
| 192 | # Outside the if statement to avoid errors during do_package | ||
| 193 | install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ | ||
| 194 | ${D}${systemd_unitdir}/system/android-tools-adbd.service | ||
| 195 | |||
| 196 | install -d ${D}${libdir}/android/ | ||
| 197 | install -m0755 ${S}/debian/out/usr/lib/android/*.so.* ${D}${libdir}/android/ | ||
| 198 | if echo ${TOOLS_TO_BUILD} | grep -q "mkbootimg" ; then | ||
| 199 | install -d ${D}${bindir} | ||
| 200 | install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} | ||
| 201 | fi | ||
| 202 | } | ||
| 203 | |||
| 204 | PACKAGES =+ "${PN}-fstools ${PN}-adbd" | ||
| 205 | |||
| 206 | RDEPENDS:${BPN} = "${BPN}-conf p7zip" | ||
| 207 | |||
| 208 | FILES:${PN}-adbd = "\ | ||
| 209 | ${bindir}/adbd \ | ||
| 210 | ${systemd_unitdir}/system/android-tools-adbd.service \ | ||
| 211 | " | ||
| 212 | |||
| 213 | FILES:${PN}-fstools = "\ | ||
| 214 | ${bindir}/ext2simg \ | ||
| 215 | ${bindir}/ext4fixup \ | ||
| 216 | ${bindir}/img2simg \ | ||
| 217 | ${bindir}/make_ext4fs \ | ||
| 218 | ${bindir}/simg2img \ | ||
| 219 | ${bindir}/simg2simg \ | ||
| 220 | ${bindir}/simg_dump \ | ||
| 221 | ${bindir}/mkuserimg \ | ||
| 222 | " | ||
| 223 | FILES:${PN} += "${libdir}/android ${libdir}/android/*" | ||
| 224 | |||
| 225 | BBCLASSEXTEND = "native" | ||
| 226 | |||
| 227 | android_tools_enable_devmode() { | ||
| 228 | touch ${IMAGE_ROOTFS}/var/usb-debugging-enabled | ||
| 229 | } | ||
| 230 | |||
| 231 | 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 @@ | |||
| 1 | DESCRIPTION = "Various utilities from Android" | ||
| 2 | SECTION = "console/utils" | ||
| 3 | LICENSE = "Apache-2.0 & GPL-2.0-only & BSD-2-Clause & BSD-3-Clause" | ||
| 4 | LIC_FILES_CHKSUM = " \ | ||
| 5 | file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ | ||
| 6 | file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ | ||
| 7 | file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \ | ||
| 8 | file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ | ||
| 9 | " | ||
| 10 | DEPENDS = "libbsd libpcre zlib libcap libusb squashfs-tools p7zip libselinux googletest" | ||
| 11 | |||
| 12 | SRCREV_core = "abfd66fafcbb691d7860df059f1df1c9b1ef29da" | ||
| 13 | |||
| 14 | SRC_URI = " \ | ||
| 15 | git://salsa.debian.org/android-tools-team/android-platform-tools;name=core;protocol=https;nobranch=1 \ | ||
| 16 | " | ||
| 17 | |||
| 18 | # Patches copied from android-platform-tools/debian/patches | ||
| 19 | # and applied in the order defined by the file debian/patches/series | ||
| 20 | SRC_URI += " \ | ||
| 21 | file://debian/external/libunwind/user_pt_regs.patch \ | ||
| 22 | file://debian/external/libunwind/legacy_built-in_sync_functions.patch \ | ||
| 23 | file://debian/external/libunwind/20150704-CVE-2015-3239_dwarf_i.h.patch \ | ||
| 24 | \ | ||
| 25 | file://debian/system/core/move-log-file-to-proper-dir.patch \ | ||
| 26 | file://debian/system/core/Added-missing-headers.patch \ | ||
| 27 | file://debian/system/core/libusb-header-path.patch \ | ||
| 28 | file://debian/system/core/stdatomic.patch \ | ||
| 29 | file://debian/system/core/Nonnull.patch \ | ||
| 30 | file://debian/system/core/Vector-cast.patch \ | ||
| 31 | file://debian/system/core/throw-exception-on-unknown-os.patch \ | ||
| 32 | file://debian/system/core/simg_dump-python3.patch \ | ||
| 33 | file://debian/system/core/fix-attribute-issue-with-gcc.patch \ | ||
| 34 | file://debian/system/core/fix-gettid-exception-declaration.patch \ | ||
| 35 | file://debian/system/core/fix-build-on-non-x86.patch \ | ||
| 36 | file://debian/system/core/add-missing-headers.patch \ | ||
| 37 | file://debian/system/core/hard-code-build-number.patch \ | ||
| 38 | file://debian/system/core/stub-out-fastdeploy.patch \ | ||
| 39 | file://debian/system/core/fix-standard-namespace-errors.patch \ | ||
| 40 | file://debian/system/core/Add-riscv64-support.patch \ | ||
| 41 | \ | ||
| 42 | " | ||
| 43 | |||
| 44 | # patches which don't come from debian | ||
| 45 | SRC_URI += " \ | ||
| 46 | file://rules_yocto.mk;subdir=git \ | ||
| 47 | file://android-tools-adbd.service \ | ||
| 48 | file://adbd.mk;subdir=git/debian/system/core \ | ||
| 49 | file://remount \ | ||
| 50 | file://0001-Fixes-for-yocto-build.patch \ | ||
| 51 | file://0002-android-tools-modifications-to-make-it-build-in-yoct.patch \ | ||
| 52 | file://0003-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch \ | ||
| 53 | file://0004-adb-Fix-build-on-big-endian-systems.patch \ | ||
| 54 | file://0005-adb-Allow-adbd-to-be-run-as-root.patch \ | ||
| 55 | " | ||
| 56 | |||
| 57 | S = "${WORKDIR}/git" | ||
| 58 | B = "${WORKDIR}/${BPN}" | ||
| 59 | |||
| 60 | # http://errors.yoctoproject.org/Errors/Details/1debian881/ | ||
| 61 | ARM_INSTRUCTION_SET:armv4 = "arm" | ||
| 62 | ARM_INSTRUCTION_SET:armv5 = "arm" | ||
| 63 | |||
| 64 | COMPATIBLE_HOST:powerpc = "(null)" | ||
| 65 | COMPATIBLE_HOST:powerpc64 = "(null)" | ||
| 66 | COMPATIBLE_HOST:powerpc64le = "(null)" | ||
| 67 | |||
| 68 | inherit systemd | ||
| 69 | |||
| 70 | SYSTEMD_SERVICE:${PN} = "android-tools-adbd.service" | ||
| 71 | |||
| 72 | # Find libbsd headers during native builds | ||
| 73 | CC:append:class-native = " -I${STAGING_INCDIR}" | ||
| 74 | CC:append:class-nativesdk = " -I${STAGING_INCDIR}" | ||
| 75 | |||
| 76 | PREREQUISITE_core = "liblog libbase libsparse liblog libcutils" | ||
| 77 | TOOLS_TO_BUILD = "libcrypto_utils libadb libziparchive fastboot adb img2simg simg2img libbacktrace" | ||
| 78 | TOOLS_TO_BUILD:append:class-target = " adbd" | ||
| 79 | |||
| 80 | do_compile() { | ||
| 81 | |||
| 82 | case "${HOST_ARCH}" in | ||
| 83 | arm) | ||
| 84 | export android_arch=linux-arm | ||
| 85 | cpu=arm | ||
| 86 | deb_host_arch=arm | ||
| 87 | ;; | ||
| 88 | aarch64) | ||
| 89 | export android_arch=linux-arm64 | ||
| 90 | cpu=arm64 | ||
| 91 | deb_host_arch=arm64 | ||
| 92 | ;; | ||
| 93 | riscv64) | ||
| 94 | export android_arch=linux-riscv64 | ||
| 95 | ;; | ||
| 96 | mips|mipsel) | ||
| 97 | export android_arch=linux-mips | ||
| 98 | cpu=mips | ||
| 99 | deb_host_arch=mips | ||
| 100 | ;; | ||
| 101 | mips64|mips64el) | ||
| 102 | export android_arch=linux-mips64 | ||
| 103 | cpu=mips64 | ||
| 104 | deb_host_arch=mips64 | ||
| 105 | ;; | ||
| 106 | powerpc|powerpc64) | ||
| 107 | export android_arch=linux-ppc | ||
| 108 | ;; | ||
| 109 | i586|i686|x86_64) | ||
| 110 | export android_arch=linux-x86 | ||
| 111 | cpu=x86_64 | ||
| 112 | deb_host_arch=amd64 | ||
| 113 | ;; | ||
| 114 | esac | ||
| 115 | |||
| 116 | export SRCDIR=${S} | ||
| 117 | |||
| 118 | oe_runmake -f ${S}/debian/external/boringssl/libcrypto.mk -C ${S} | ||
| 119 | oe_runmake -f ${S}/debian/external/libunwind/libunwind.mk -C ${S} CPU=${cpu} | ||
| 120 | |||
| 121 | for tool in ${PREREQUISITE_core}; do | ||
| 122 | oe_runmake -f ${S}/debian/system/core/${tool}.mk -C ${S} | ||
| 123 | done | ||
| 124 | |||
| 125 | for i in `find ${S}/debian/system/extras/ -name "*.mk"`; do | ||
| 126 | oe_runmake -f $i -C ${S} | ||
| 127 | done | ||
| 128 | |||
| 129 | for tool in ${TOOLS_TO_BUILD}; do | ||
| 130 | if [ "$tool" = "libbacktrace" ]; then | ||
| 131 | oe_runmake -f ${S}/debian/system/core/${tool}.mk -C ${S} DEB_HOST_ARCH=${deb_host_arch} | ||
| 132 | else | ||
| 133 | oe_runmake -f ${S}/debian/system/core/${tool}.mk -C ${S} | ||
| 134 | fi | ||
| 135 | done | ||
| 136 | |||
| 137 | } | ||
| 138 | |||
| 139 | do_install() { | ||
| 140 | install -d ${D}${base_sbindir} | ||
| 141 | install -m 0755 ${S}/../remount -D ${D}${base_sbindir}/remount | ||
| 142 | |||
| 143 | for tool in img2simg simg2img fastboot adbd; do | ||
| 144 | if echo ${TOOLS_TO_BUILD} | grep -q "$tool" ; then | ||
| 145 | install -D -p -m0755 ${S}/debian/out/system/core/$tool ${D}${bindir}/$tool | ||
| 146 | fi | ||
| 147 | done | ||
| 148 | |||
| 149 | # grep adb also matches adbd, so handle adb separately from other tools | ||
| 150 | if echo ${TOOLS_TO_BUILD} | grep -q "adb " ; then | ||
| 151 | install -d ${D}${bindir} | ||
| 152 | install -m0755 ${S}/debian/out/system/core/adb ${D}${bindir} | ||
| 153 | fi | ||
| 154 | |||
| 155 | # Outside the if statement to avoid errors during do_package | ||
| 156 | install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ | ||
| 157 | ${D}${systemd_unitdir}/system/android-tools-adbd.service | ||
| 158 | |||
| 159 | install -d ${D}${libdir}/android/ | ||
| 160 | install -m0755 ${S}/debian/out/system/core/*.so.* ${D}${libdir}/android/ | ||
| 161 | if echo ${TOOLS_TO_BUILD} | grep -q "mkbootimg" ; then | ||
| 162 | install -d ${D}${bindir} | ||
| 163 | install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} | ||
| 164 | fi | ||
| 165 | } | ||
| 166 | |||
| 167 | PACKAGES =+ "${PN}-fstools ${PN}-adbd" | ||
| 168 | |||
| 169 | RDEPENDS:${BPN} = "${BPN}-conf p7zip" | ||
| 170 | |||
| 171 | FILES:${PN}-adbd = "\ | ||
| 172 | ${bindir}/adbd \ | ||
| 173 | ${systemd_unitdir}/system/android-tools-adbd.service \ | ||
| 174 | " | ||
| 175 | |||
| 176 | FILES:${PN}-fstools = "\ | ||
| 177 | ${bindir}/ext2simg \ | ||
| 178 | ${bindir}/ext4fixup \ | ||
| 179 | ${bindir}/img2simg \ | ||
| 180 | ${bindir}/make_ext4fs \ | ||
| 181 | ${bindir}/simg2img \ | ||
| 182 | ${bindir}/simg2simg \ | ||
| 183 | ${bindir}/simg_dump \ | ||
| 184 | ${bindir}/mkuserimg \ | ||
| 185 | " | ||
| 186 | FILES:${PN} += "${libdir}/android ${libdir}/android/*" | ||
| 187 | |||
| 188 | BBCLASSEXTEND = "native" | ||
| 189 | |||
| 190 | android_tools_enable_devmode() { | ||
| 191 | touch ${IMAGE_ROOTFS}/var/usb-debugging-enabled | ||
| 192 | } | ||
| 193 | |||
| 194 | ROOTFS_POSTPROCESS_COMMAND_${PN}-adbd += "${@bb.utils.contains("USB_DEBUGGING_ENABLED", "1", "android_tools_enable_devmode;", "", d)}" | ||
