Fix sysroot path and add toolchain for embedded

This commit is contained in:
s_c_c 2024-03-13 16:17:23 +08:00 committed by yykk
parent 1feb881c70
commit 6f8079e872
4 changed files with 142 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 7c6665977db9192e18f8c28ba33e02b4b548b0da Mon Sep 17 00:00:00 2001
From: s_c_c <shichuchao@huawei.com>
Date: Mon, 11 Mar 2024 16:01:57 +0800
Subject: [PATCH] feat for embedded comment out sysroot_hash
---
config/posix/BUILD.gn | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/config/posix/BUILD.gn b/config/posix/BUILD.gn
index 53fa7ac..9afcdae 100644
--- a/config/posix/BUILD.gn
+++ b/config/posix/BUILD.gn
@@ -88,12 +88,12 @@ config("runtime_library") {
# when turning the sysroot on or off. (defines are passed via the command
# line, and build system rebuilds things when their commandline
# changes). Nothing should ever read this define.
- sysroot_hash =
- exec_script("//build/linux/sysroot_scripts/install-sysroot.py",
- [ "--print-hash=$current_cpu" ],
- "trim string",
- [ "//build/linux/sysroot_scripts/sysroots.json" ])
- defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ]
+ # sysroot_hash =
+ # exec_script("//build/linux/sysroot_scripts/install-sysroot.py",
+ # [ "--print-hash=$current_cpu" ],
+ # "trim string",
+ # [ "//build/linux/sysroot_scripts/sysroots.json" ])
+ # defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ]
}
asmflags += sysroot_flags
--
2.20.1 (Apple Git-117)

View File

@ -0,0 +1,41 @@
From ff44eba6593a3e8a3c0c7bcaf7ab913ba2b8e76f Mon Sep 17 00:00:00 2001
From: s_c_c <shichuchao@huawei.com>
Date: Tue, 12 Mar 2024 15:04:10 +0800
Subject: [PATCH] feat for embedded add linux_arm64 toolchain
---
toolchain/linux/BUILD.gn | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/toolchain/linux/BUILD.gn b/toolchain/linux/BUILD.gn
index a8c2f78..9019e67 100644
--- a/toolchain/linux/BUILD.gn
+++ b/toolchain/linux/BUILD.gn
@@ -147,3 +147,23 @@ clang_toolchain("linux_clang_arm64") {
}
shlib_extension = ".z.so"
}
+
+gcc_toolchain("linux_arm64") {
+ tool_path = rebase_path("//toolchain/bin", root_build_dir)
+ toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-"
+
+ cc = "${toolprefix}gcc"
+ cxx = "${toolprefix}g++"
+
+ ar = "${toolprefix}ar"
+ ld = cxx
+ readelf = "${toolprefix}readelf"
+ nm = "${toolprefix}nm"
+
+ toolchain_args = {
+ current_cpu = "arm64"
+ current_os = "linux"
+ is_clang = false
+ }
+ shlib_extension = ".z.so"
+}
\ No newline at end of file
--
2.20.1 (Apple Git-117)

View File

@ -0,0 +1,59 @@
From c14e20a9afa283e454b3e5c209e237c100fbf10d Mon Sep 17 00:00:00 2001
From: s_c_c <shichuchao@huawei.com>
Date: Wed, 13 Mar 2024 16:12:51 +0800
Subject: [PATCH] feat for embedded fix sysroot path
---
.../hiviewdfx/hilog/interfaces/native/innerkits/BUILD.gn | 7 ++++---
.../third_party/bounds_checking_function/BUILD.gn | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/openeuler/compiler_gn/base/hiviewdfx/hilog/interfaces/native/innerkits/BUILD.gn b/openeuler/compiler_gn/base/hiviewdfx/hilog/interfaces/native/innerkits/BUILD.gn
index bd1f91b..776e60a 100644
--- a/openeuler/compiler_gn/base/hiviewdfx/hilog/interfaces/native/innerkits/BUILD.gn
+++ b/openeuler/compiler_gn/base/hiviewdfx/hilog/interfaces/native/innerkits/BUILD.gn
@@ -11,9 +11,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
+import("//build/config/sysroot.gni")
config("libhilog_pub_config") {
- include_dirs = [ "include" ]
+ include_dirs = [ "${sysroot}/usr/include/hilog" ]
libs = ["hilog.z"]
}
@@ -22,11 +23,11 @@ group("libhilog") {
}
config("libhilog_base_pub_cfg") {
- include_dirs = [ "include" ]
+ include_dirs = [ "${sysroot}/usr/include/hilog" ]
}
ohos_prebuilt_static_library("libhilog_base") {
- source = "/usr/lib64/libhilog_base.a"
+ source = "${sysroot}/usr/lib64/libhilog_base.a"
public_configs = [ ":libhilog_base_pub_cfg" ]
part_name = "hilog_native"
diff --git a/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn b/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn
index ae44b79..5c17fb7 100644
--- a/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn
+++ b/openeuler/compiler_gn/third_party/bounds_checking_function/BUILD.gn
@@ -11,9 +11,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
+import("//build/config/sysroot.gni")
config("libsec_public_config") {
- include_dirs = [ "include" ]
+ include_dirs = [ "${sysroot}/usr/include" ]
libs = [ "boundscheck" ]
}
--
2.20.1 (Apple Git-117)

View File

@ -2,7 +2,7 @@
%global openHarmony_source_release OpenHarmony-v3.2-Release
Name: distributed-build
Version: 1.0.0
Release: 8
Release: 9
Summary: openEuler embedded softbus build tools
License: Apache-2.0
URL: https://gitee.com/openharmony/build
@ -30,6 +30,9 @@ Patch0017: 0017-feat-add-script-to-create-soft-link.patch
Patch0020: 0020-feat-add-openssl-gn-file-and-soft-link.patch
Patch0021: 0021-feat-change-config-json.patch
Patch0022: 0022-add-build-gn-file-of-icu-jsoncpp-zlib.patch
Patch0023: 0023-feat-for-embedded-comment-out-sysroot_hash.patch
Patch0024: 0024-feat-for-embedded-add-linux_arm64-toolchain.patch
Patch0025: 0025-feat-for-embedded-fix-sysroot-path.patch
BuildArch: noarch
%description
@ -49,6 +52,9 @@ cp -rp %{_builddir}/build-%{openHarmony_source_release}/* %{buildroot}/opt/dist
/opt/distributed-middleware-build
%changelog
* Tue Mar 12 2024 s_c_c <shichuchao@huawei.com> - 1.0.0-9
- Fix sysroot path and add toolchain for embedded
* Fri Mar 08 2023 Peng He <hepeng68@huawei.com> - 1.0.0-8
- sync from 22.03-LTS-SP3