diff --git a/0000-change-set-for-obs-build.patch b/0000-change-set-for-obs-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fa7a2f8aa7313521a77d318d5e738a3759f0631 --- /dev/null +++ b/0000-change-set-for-obs-build.patch @@ -0,0 +1,73 @@ +diff -Naur build-OpenHarmony-v3.0.2-LTS/config/sanitizers/BUILD.gn build-OpenHarmony-v3.0.2-LTS-path2/config/sanitizers/BUILD.gn +--- build-OpenHarmony-v3.0.2-LTS/config/sanitizers/BUILD.gn 2022-02-26 17:17:05.000000000 +0800 ++++ build-OpenHarmony-v3.0.2-LTS-path2/config/sanitizers/BUILD.gn 2022-07-14 11:50:09.927655500 +0800 +@@ -678,6 +678,8 @@ + } + } + ++ print(_clang_rt_libs_dir) ++ + foreach(rt_lib, _dso_names) { + _clang_rt_dso_paths += [ "$_clang_rt_libs_dir/${rt_lib}" ] + } +diff -Naur build-OpenHarmony-v3.0.2-LTS/loader/preloader/platforms.template build-OpenHarmony-v3.0.2-LTS-path2/loader/preloader/platforms.template +--- build-OpenHarmony-v3.0.2-LTS/loader/preloader/platforms.template 2022-07-14 11:49:08.352875000 +0800 ++++ build-OpenHarmony-v3.0.2-LTS-path2/loader/preloader/platforms.template 2022-07-14 11:06:07.951920300 +0800 +@@ -12,6 +12,12 @@ + "target_cpu": "arm", + "toolchain": "//build/toolchain/linux:arm", + "parts_config": "./parts.json" ++ }, ++ { ++ "target_os": "ohos", ++ "target_cpu": "x86_64", ++ "toolchain": "//build/toolchain/linux:x86_64", ++ "parts_config": "./parts.json" + } + ] + } +diff -Naur build-OpenHarmony-v3.0.2-LTS/toolchain/linux/BUILD.gn build-OpenHarmony-v3.0.2-LTS-path2/toolchain/linux/BUILD.gn +--- build-OpenHarmony-v3.0.2-LTS/toolchain/linux/BUILD.gn 2022-07-14 11:49:08.511178900 +0800 ++++ build-OpenHarmony-v3.0.2-LTS-path2/toolchain/linux/BUILD.gn 2022-07-14 11:10:51.681272300 +0800 +@@ -25,6 +25,8 @@ + tool_path = rebase_path("//toolchain/bin", root_build_dir) + toolprefix = "${tool_path}/aarch64-openeuler-linux-gnu-" + ++ toolprefix = "" ++ + cc = "${toolprefix}gcc" + cxx = "${toolprefix}g++" + +@@ -45,6 +47,8 @@ + tool_path = rebase_path("//toolchain/bin", root_build_dir) + toolprefix = "${tool_path}/arm-openeuler-linux-gnu-" + ++ toolprefix = "" ++ + cc = "${toolprefix}gcc" + cxx = "${toolprefix}g++" + +@@ -120,4 +124,23 @@ + current_os = "linux" + is_clang = false + } ++} ++ ++gcc_toolchain("x86_64") { ++ cc = "gcc" ++ cxx = "g++" ++ ++ readelf = "readelf" ++ nm = "nm" ++ ar = "ar" ++ ld = cxx ++ ++ # Output linker map files for binary size analysis. ++ enable_linker_map = true ++ ++ toolchain_args = { ++ current_cpu = "x86_64" ++ current_os = "linux" ++ is_clang = false ++ } + } diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 16181c9ab182a5a897b422f833927f016eccea51..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# dsoftbus - -#### Description -openEuler embedded softbus capability support - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index 996fc270bae88a42fef30e2ff1e5a0b0699b23d4..e77d7bc0b2a34e0d4b5d49d7f6d0d585e9eb7a0d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # dsoftbus #### 介绍 -openEuler embedded softbus capability support +openEuler秉承着打造“数字化基础设施操作系统”的愿景,为促进与OpenHarmony生态的合作与互通,实现端边领域的互通和协同,首次在嵌入式领域引入分布式软总线技术。 +分布式软总线是OpenHarmony社区开源的分布式设备通信基座,为设备之间的互通互联提供统一的分布式协同能力,实现设备无感发现和高效传输。 +OpenHarmony主要面向强交互等需求的智能终端、物联网终端和工业终端。openEuler主要面向有高可靠、高性能等需求的服务器、边缘计算、云和嵌入式设备,二者各有侧重。通过以分布式软总线为代表的技术进行生态互通,以期实现“1+1>2”的效果,支撑社区用户开拓更广阔的行业空间。 #### 软件架构 软件架构说明 diff --git a/dsoftbus.spec b/dsoftbus.spec new file mode 100644 index 0000000000000000000000000000000000000000..724ddde4171c8fd59b6320ce3b04f3c3f84821da --- /dev/null +++ b/dsoftbus.spec @@ -0,0 +1,222 @@ +%define debug_package %{nil} +%global source0_name dsoftbus_standard +%global source0_release v3.1.2-release +%global source1_name yocto-embedded-tools +%global source1_release v1.0.0-release +%global source2_name embedded-ipc +%global source2_release v1.0.0-release +%global source3_name libboundscheck +%global source3_release v1.1.11 +%global source4_name gn-linux-arm64 + +Name: dsoftbus +Version: 1.0.0 +Release: 2 +Summary: openEuler embedded softbus capability support +License: Apache License 2.0 +Url: https://openeuler.gitee.io/yocto-meta-openeuler/features/distributed_softbus.html +Source0: https://gitee.com/openeuler/%{source0_name}/repository/archive/%{source0_release}.tar.gz #/%{source0_name}-%{source0_release}.tar.gz +Source1: https://gitee.com/openeuler/%{source1_name}/repository/archive/%{source1_release}.tar.gz #/%{source1_name}-%{source1_release}.tar.gz +Source2: https://gitee.com/openeuler/%{source2_name}/repository/archive/%{source2_release}.tar.gz #/%{source2_name}-%{source2_release}.tar.gz +Source3: https://gitee.com/src-openeuler/%{source3_name}/raw/openEuler-22.03-LTS-SP1/%{source3_name}-%{source3_release}.tar.gz +Source4: https://chrome-infra-packages.appspot.com/p/gn/gn/linux-arm64/+/DC9187N-24PO5pEFOlVDm4kNr7ewdhh-Lp73tDNUY5QC #/%{source4_name}.zip + +Patch0000: 0000-change-set-for-obs-build.patch + +BuildRequires: gcc, g++, cmake, python, zip, unzip, ninja-build, git + +%description +OpenEuler supports distributed softbus capability, which is part of openEuler's embedded capability + +%prep +# Create the directory needed for the build +dsoftbus_build_tools="%{_builddir}/dsoftbus_build_tools" +dsoftbus_build_dir="%{_builddir}/dsoftbus_build" +dsoftbus_prebuilts_build_tools="${dsoftbus_build_dir}/prebuilts/build-tools/linux-x86/bin" +dsoftbus_thirdparty="${dsoftbus_build_dir}/third_party" +dsoftbus_utils="${dsoftbus_build_dir}/utils" +dsoftbus_src="${dsoftbus_build_dir}/foundation/communication" +dsoftbus_hichain="${dsoftbus_build_dir}/base/security" + +mkdir -p ${dsoftbus_prebuilts_build_tools} +mkdir -p ${dsoftbus_thirdparty} +mkdir -p ${dsoftbus_utils} +mkdir -p ${dsoftbus_src} +mkdir -p ${dsoftbus_hichain} + +# Decompress pack +%setup -q -T -D -b 0 -n %{source0_name}-%{source0_release} +%setup -q -T -D -b 1 -n %{source1_name}-%{source1_release} +%setup -q -T -D -b 2 -n %{source2_name}-%{source2_release} +%setup -q -T -D -b 3 -n %{source3_name}-%{source3_release} + +cd %{_builddir} +mv %{source0_name}-%{source0_release} %{source0_name} +mv %{source1_name}-%{source1_release} %{source1_name} +mv %{source2_name}-%{source2_release} %{source2_name} +mv %{source3_name}-%{source3_release} %{source3_name} + +mkdir %{_builddir}/libboundscheck-v1.1.11 + +mv %{_builddir}/yocto-embedded-tools/dsoftbus ${dsoftbus_build_tools} +unzip -d %{_builddir}/gn_aarch/ %{SOURCE4} + +# Extract the subpackage contained in the Source +build="build-OpenHarmony-v3.0.2-LTS" +gn="gn-linux-x86-1717" +ninja="ninja-linux-x86-1.10.1" +cJSON="third_party_cJSON-OpenHarmony-v3.1.2-Release" +jinja2="third_party_jinja2-OpenHarmony-v3.1.2-Release" +libcoap="third_party_libcoap-OpenHarmony-v3.1.2-Release" +markupsafe="third_party_markupsafe-OpenHarmony-v3.1.2-Release" +mbedtls="third_party_mbedtls-OpenHarmony-v3.1.2-Release" +openssl="third_party_openssl-OpenHarmony-v3.1.2-Release" +utils="commonlibrary_c_utils-OpenHarmony-v3.1.2-Release" +huks="security_huks-OpenHarmony-v3.1.2-Release" +deviceauth="security_device_auth-OpenHarmony-v3.1.2-Release" + + +#unpack build +unzip -qd ${dsoftbus_build_dir} ${dsoftbus_build_tools}/build/${build}.zip +mv ${dsoftbus_build_dir}/${build} ${dsoftbus_build_dir}/build + +#unpack build_tools +%ifarch x86_64 +for i in $gn $ninja +do + tar -C ${dsoftbus_prebuilts_build_tools} -zxf ${dsoftbus_build_tools}/build_tools/${i}.tar.gz +done +%endif + +%ifarch aarch64 + ninja_dir=$(which ninja) + cp -rf %{_builddir}/gn_aarch/* ${dsoftbus_prebuilts_build_tools} + cp ${ninja_dir[0]} ${dsoftbus_prebuilts_build_tools} +%endif + +#unpack third_party +for i in cJSON jinja2 libcoap markupsafe mbedtls openssl +do +pkg=`eval echo '$'"$i"` + unzip -qd ${dsoftbus_thirdparty} ${dsoftbus_build_tools}/third_party/${i}/${pkg}.zip + mv ${dsoftbus_thirdparty}/${pkg} ${dsoftbus_thirdparty}/${i} +done + +#unpack hichain +for i in huks deviceauth +do +pkg=`eval echo '$'"$i"` + unzip -qd ${dsoftbus_hichain} ${dsoftbus_build_tools}/hichain/${i}/${pkg}.zip + mv ${dsoftbus_hichain}/${pkg} ${dsoftbus_hichain}/${i} +done + +#unpack boundcheck +mv %{_builddir}/libboundscheck ${dsoftbus_thirdparty}/bounds_checking_function + +#unpack utils +unzip -qd ${dsoftbus_utils} ${dsoftbus_build_tools}/utils/${utils}.zip +mv ${dsoftbus_utils}/${utils} ${dsoftbus_utils}/native + +#init_dsoftbus_selfcode +toolchain_path="/usr1/openeuler/gcc/openeuler_gcc_arm64le" +build_patch="0001-add-dsoftbus-build-support-for-embedded-env.patch" +hichain_patch="0002-support-hichian-for-openeuler.patch" +ipc_patch="0003-add-deviceauth-ipc-sdk-compile.patch" +utils_patch="0001-Adaptation-for-dsoftbus.patch" +boundscheck_patch="0001-Adaptation-for-dsoftbus.patch" + +mbedtls_patch="0001-Adaptation-for-dsoftbus-v3.1.2.patch" +mbedtls_cve_001_patch="0002-fix-CVE-2021-43666.patch" +mbedtls_cve_002_patch="0003-fix-CVE-2021-45451.patch" +openssl_patch="0001-support-openssl-for-dsoftbus.patch" +huks_patch="0001-support-huks-for-openeuler.patch" +deviceauth_patch_001="0001-support-deviceauth-for-openeuler.patch" +deviceauth_patch_002="0002-adapter-deviceauth-ipc-service.patch" + +#init gn root +ln -s ${dsoftbus_build_dir}/build/build_scripts/build.sh ${dsoftbus_build_dir}/build.sh +ln -s ${dsoftbus_build_dir}/build/core/gn/dotfile.gn ${dsoftbus_build_dir}/.gn + +#link selfcode +ln -s ${dsoftbus_build_tools}/productdefine ${dsoftbus_build_dir}/productdefine +ln -s ${dsoftbus_build_tools}/depend ${dsoftbus_build_dir}/depend +ln -s %{_builddir}/embedded-ipc ${dsoftbus_build_dir}/depend/ipc +ln -s %{_builddir}/dsoftbus_standard ${dsoftbus_src}/dsoftbus + +#link toolchain +ln -s ${toolchain_path} ${dsoftbus_build_dir}/toolchain + +#do patch +patch -p1 -d ${dsoftbus_build_dir}/build < ${dsoftbus_build_tools}/build/${build_patch} +patch -p1 -d ${dsoftbus_build_dir}/build < ${dsoftbus_build_tools}/build/${hichain_patch} +patch -p1 -d ${dsoftbus_build_dir}/build < ${dsoftbus_build_tools}/build/${ipc_patch} +patch -p1 -d ${dsoftbus_utils}/native < ${dsoftbus_build_tools}/utils/${utils_patch} +patch -p1 -d ${dsoftbus_thirdparty}/bounds_checking_function < ${dsoftbus_build_tools}/bounds_checking_function/${boundscheck_patch} +patch -p1 -d ${dsoftbus_thirdparty}/mbedtls < ${dsoftbus_build_tools}/third_party/mbedtls/${mbedtls_patch} +patch -p1 -d ${dsoftbus_thirdparty}/mbedtls < ${dsoftbus_build_tools}/third_party/mbedtls/${mbedtls_cve_001_patch} +patch -p1 -d ${dsoftbus_thirdparty}/mbedtls < ${dsoftbus_build_tools}/third_party/mbedtls/${mbedtls_cve_002_patch} +patch -p1 -d ${dsoftbus_thirdparty}/openssl < ${dsoftbus_build_tools}/third_party/openssl/${openssl_patch} +patch -p1 -d ${dsoftbus_hichain}/huks < ${dsoftbus_build_tools}/hichain/huks/${huks_patch} +patch -p1 -d ${dsoftbus_hichain}/deviceauth < ${dsoftbus_build_tools}/hichain/deviceauth/${deviceauth_patch_001} +patch -p1 -d ${dsoftbus_hichain}/deviceauth < ${dsoftbus_build_tools}/hichain/deviceauth/${deviceauth_patch_002} + +%patch -p1 -d ${dsoftbus_build_dir}/build + +%ifarch x86_64 + sed -i 's/"target_cpu": "arm64"/"target_cpu": "x86_64"/' ${dsoftbus_build_tools}/productdefine/common/device/openEuler.json +%endif + +%build +rm -rf %{_builddir}/dsoftbus_build/out +cd %{_builddir}/dsoftbus_build +./build.sh --product-name openEuler + +%install +dsoftbus_build_dir="%{_builddir}/dsoftbus_build" +%ifarch x86_64 + dsoftbus_release_dir_name="ohos-x86_64-release" +%endif +%ifarch aarch64 + dsoftbus_release_dir_name="ohos-arm64-release" +%endif + +install -d %{buildroot}/%{_includedir}/dsoftbus +install -d %{buildroot}/%{_libdir} +install -d %{buildroot}/%{_bindir} + +install -d %{buildroot}/data/data/deviceauth/ + +# prepare so +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/common/common/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/huks/*.so %{buildroot}/%{_libdir} +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/security/deviceauth_standard/*.so %{buildroot}/%{_libdir} + +# prepare bin +install -m 0755 ${dsoftbus_build_dir}/out/${dsoftbus_release_dir_name}/communication/dsoftbus_standard/softbus_server_main %{buildroot}/%{_bindir} + +# prepare head files +install -m 554 \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/discovery/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/common/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/bus_center/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/interfaces/kits/transport/*.h \ +${dsoftbus_build_dir}/foundation/communication/dsoftbus/core/common/include/softbus_errcode.h \ +${dsoftbus_build_dir}/base/security/deviceauth/interfaces/innerkits/*.h \ +${dsoftbus_build_dir}/third_party/cJSON/*.h \ +${dsoftbus_build_dir}/third_party/bounds_checking_function/include/*.h \ + %{buildroot}/%{_includedir}/dsoftbus + +%files +%{_includedir}/dsoftbus/* +%{_bindir}/softbus_server_main +%{_libdir}/*.so +/data/data + +%changelog +* Wed Nov 23 2022 xuchongyu - 1.0.0-2 +- add URL,change branch of libboundscheck to 22.03-LTS-SP1 + +* Tue Nov 22 2022 xuchongyu - 1.0.0-1 +- init dsoftbus + diff --git a/dsoftbus_standard-v3.1.2-release.tar.gz b/dsoftbus_standard-v3.1.2-release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..7ab7050da5e35472a821544f156876faf5ad02de Binary files /dev/null and b/dsoftbus_standard-v3.1.2-release.tar.gz differ diff --git a/embedded-ipc-v1.0.0-release.tar.gz b/embedded-ipc-v1.0.0-release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..292f76b5e50ff61aa764cf3066986c704686f8d0 Binary files /dev/null and b/embedded-ipc-v1.0.0-release.tar.gz differ diff --git a/gn-linux-arm64.zip b/gn-linux-arm64.zip new file mode 100644 index 0000000000000000000000000000000000000000..4daca8d4b2787a553bb67f6935c687d5b5af8a05 Binary files /dev/null and b/gn-linux-arm64.zip differ diff --git a/libboundscheck-v1.1.11.tar.gz b/libboundscheck-v1.1.11.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..2a4d2717669d4abdb81af062e80cdc00f27e82ec Binary files /dev/null and b/libboundscheck-v1.1.11.tar.gz differ diff --git a/yocto-embedded-tools-v1.0.0-release.tar.gz b/yocto-embedded-tools-v1.0.0-release.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..6613ae1eb60170ed45cba69e8a1525668f864019 Binary files /dev/null and b/yocto-embedded-tools-v1.0.0-release.tar.gz differ