From c6737365fc966c338a284500962035d46a36a47e Mon Sep 17 00:00:00 2001 From: mamingshuai Date: Thu, 11 Mar 2021 18:42:43 +0800 Subject: [PATCH] update openharmony 1.0.1 --- .gitee/ISSUE_TEMPLATE.zh-CN.md | 13 - .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 15 - .gitignore | 3 +- BUILD.gn | 185 +++-- README_zh.md | 193 +++++ build.py | 78 +- build_ext_components.py | 48 +- compile.py | 49 -- compile_process.py | 63 -- components/aafwk.json | 53 ++ components/ace.json | 52 ++ components/ai.json | 37 + components/appexecfwk.json | 48 ++ components/applications.json | 202 +++++ components/communication.json | 174 ++++ components/distributed_schedule.json | 144 ++++ components/drivers.json | 178 +++++ components/global.json | 73 ++ components/graphic.json | 157 ++++ components/hiviewdfx.json | 156 ++++ components/iot.json | 26 + components/iot_hardware.json | 28 + components/kernel.json | 149 ++++ components/multimedia.json | 162 ++++ components/pms.json | 37 + components/security.json | 226 ++++++ components/sensors.json | 35 + components/startup.json | 191 +++++ components/test.json | 166 ++++ components/update.json | 57 ++ components/utils.json | 166 ++++ components/vendor.json | 377 +++++++++ config.ini | 29 - config.py | 197 ----- config/BUILD.gn | 393 +++++---- config/BUILDCONFIG.gn | 191 +++-- config/component/cJSON/BUILD.gn | 52 ++ config/component/lite_component.gni | 274 +++---- config/component/openssl/BUILD.gn | 52 ++ config/component/zlib/BUILD.gn | 72 ++ config/hap_pack.gni | 260 +++--- config/kernel/liteos/cortex_m/BUILD.gn | 107 --- config/subsystem/aafwk/BUILD.gn | 24 + config/subsystem/aafwk/config.gni | 6 +- config/subsystem/aafwk/path.gni | 19 + config/subsystem/graphic/config.gni | 19 + config/subsystem/hiviewdfx/BUILD.gn | 34 + config/test.gni | 323 +++++--- config_convert.py | 72 -- figures/编译构建流程.jpg | Bin 0 -> 47580 bytes filter.py | 49 -- filter_process.py | 156 ---- gen_module_notice_file.py | 3 +- gen_rootfs.py | 233 ++++-- hap_pack.py | 71 +- hb/__init__.py | 42 + __main__.py => hb/__main__.py | 49 +- __init__.py => hb/build/__init__.py | 0 hb/build/build.py | 93 +++ hb/build/build_process.py | 209 +++++ .../hi3861v100.gni => hb/clean/__init__.py | 32 +- hb/clean/clean.py | 31 + .../common/__init__.py | 32 +- hb/common/config.json | 8 + hb/common/config.py | 210 +++++ hb/common/device.py | 113 +++ hb/common/product.py | 108 +++ hb/common/utils.py | 204 +++++ .../hi3516dv300.gni => hb/cts/__init__.py | 32 +- hb/cts/checkbox.py | 260 ++++++ hb/cts/common.py | 195 +++++ hb/cts/cts.py | 488 ++++++++++++ hb/cts/list.py | 185 +++++ hb/cts/menuconfig.py | 55 ++ hb/cts/prompt.py | 107 +++ .../hi3518ev300.gni => hb/deps/__init__.py | 32 +- hb/deps/check_deps.py | 101 +++ hb/deps/deps.py | 45 ++ hb/deps/gen_deps.py | 99 +++ hb/env/__init__.py | 17 + hb/env/env.py | 42 + hb/set/__init__.py | 17 + hb/set/set.py | 75 ++ make_rootfs/dmverity_linux.sh | 39 + make_rootfs/linux_cmd_links.config | 208 +++++ make_rootfs/populate-extfs.sh | 173 ++++ make_rootfs/rootfs_linux_hi3516dv300.config | 4 + make_rootfs/rootfs_linux_hi3518ev300.config | 2 + make_rootfs/rootfs_liteos.config | 2 + make_rootfs/rootfsimg_linux.sh | 116 +++ make_rootfs/rootfsimg_liteos.sh | 92 +++ ndk/BUILD.gn | 270 ++++--- ndk/build/build.py | 19 +- ndk/build/config/BUILD.gn | 387 +++++---- ndk/build/config/BUILDCONFIG.gn | 131 +-- ndk/build/config/variable.gni | 64 +- ndk/build/toolchain/clang.gni | 3 +- ndk/doc/config/Doxyfile_C | 1 + ndk/doc/config/Doxyfile_CPP | 3 + ndk/ndk.gni | 301 +++---- ohos_var.gni | 135 +++- platform/hi3516dv300_liteos_a/init.ld | 0 platform/hi3516dv300_liteos_a/platform.json | 751 ------------------ .../hi3516dv300_openharmony_liteos_a/init.ld | 90 +++ platform/hi3518ev300_liteos_a/init.ld | 0 platform/hi3518ev300_liteos_a/platform.json | 683 ---------------- .../hi3518ev300_openharmony_liteos_a/init.ld | 90 +++ platform/hi3861v100_liteos_m/platform.json | 324 -------- product/ipcamera_hi3516dv300.json | 154 ---- product/ipcamera_hi3518ev300.json | 144 ---- product/qemu_arm_virt_ca7.json | 52 -- product/wifiiot.json | 96 --- readme.md | 3 - setup.py | 48 ++ testfwk/gen_module_list_files.py | 81 ++ testfwk/gen_testfwk_info.py | 82 ++ toolchain/BUILD.gn | 100 ++- toolchain/clang.gni | 227 +++--- toolchain/gcc.gni | 251 +++--- 119 files changed, 9398 insertions(+), 4786 deletions(-) delete mode 100755 .gitee/ISSUE_TEMPLATE.zh-CN.md delete mode 100755 .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md create mode 100755 README_zh.md delete mode 100755 compile.py delete mode 100755 compile_process.py create mode 100755 components/aafwk.json create mode 100755 components/ace.json create mode 100755 components/ai.json create mode 100755 components/appexecfwk.json create mode 100755 components/applications.json create mode 100755 components/communication.json create mode 100755 components/distributed_schedule.json create mode 100644 components/drivers.json create mode 100755 components/global.json create mode 100755 components/graphic.json create mode 100755 components/hiviewdfx.json create mode 100755 components/iot.json create mode 100755 components/iot_hardware.json create mode 100755 components/kernel.json create mode 100755 components/multimedia.json create mode 100755 components/pms.json create mode 100755 components/security.json create mode 100755 components/sensors.json create mode 100755 components/startup.json create mode 100755 components/test.json create mode 100755 components/update.json create mode 100755 components/utils.json create mode 100644 components/vendor.json delete mode 100755 config.ini delete mode 100755 config.py create mode 100755 config/component/cJSON/BUILD.gn create mode 100755 config/component/openssl/BUILD.gn create mode 100755 config/component/zlib/BUILD.gn delete mode 100755 config/kernel/liteos/cortex_m/BUILD.gn create mode 100755 config/subsystem/aafwk/BUILD.gn create mode 100755 config/subsystem/aafwk/path.gni create mode 100755 config/subsystem/graphic/config.gni create mode 100755 config/subsystem/hiviewdfx/BUILD.gn delete mode 100755 config_convert.py create mode 100755 figures/编译构建流程.jpg delete mode 100755 filter.py delete mode 100755 filter_process.py create mode 100755 hb/__init__.py rename __main__.py => hb/__main__.py (57%) rename __init__.py => hb/build/__init__.py (100%) create mode 100755 hb/build/build.py create mode 100755 hb/build/build_process.py rename config/boards/hi3861v100.gni => hb/clean/__init__.py (90%) create mode 100755 hb/clean/clean.py rename config/boards/qemu_arm_virt_ca7.gni => hb/common/__init__.py (90%) create mode 100755 hb/common/config.json create mode 100755 hb/common/config.py create mode 100755 hb/common/device.py create mode 100755 hb/common/product.py create mode 100755 hb/common/utils.py rename config/boards/hi3516dv300.gni => hb/cts/__init__.py (90%) create mode 100755 hb/cts/checkbox.py create mode 100755 hb/cts/common.py create mode 100755 hb/cts/cts.py create mode 100755 hb/cts/list.py create mode 100755 hb/cts/menuconfig.py create mode 100755 hb/cts/prompt.py rename config/boards/hi3518ev300.gni => hb/deps/__init__.py (90%) create mode 100755 hb/deps/check_deps.py create mode 100755 hb/deps/deps.py create mode 100755 hb/deps/gen_deps.py create mode 100755 hb/env/__init__.py create mode 100755 hb/env/env.py create mode 100755 hb/set/__init__.py create mode 100755 hb/set/set.py create mode 100755 make_rootfs/dmverity_linux.sh create mode 100644 make_rootfs/linux_cmd_links.config create mode 100755 make_rootfs/populate-extfs.sh create mode 100644 make_rootfs/rootfs_linux_hi3516dv300.config create mode 100644 make_rootfs/rootfs_linux_hi3518ev300.config create mode 100644 make_rootfs/rootfs_liteos.config create mode 100755 make_rootfs/rootfsimg_linux.sh create mode 100755 make_rootfs/rootfsimg_liteos.sh mode change 100755 => 100644 platform/hi3516dv300_liteos_a/init.ld delete mode 100755 platform/hi3516dv300_liteos_a/platform.json create mode 100755 platform/hi3516dv300_openharmony_liteos_a/init.ld mode change 100755 => 100644 platform/hi3518ev300_liteos_a/init.ld delete mode 100755 platform/hi3518ev300_liteos_a/platform.json create mode 100755 platform/hi3518ev300_openharmony_liteos_a/init.ld delete mode 100755 platform/hi3861v100_liteos_m/platform.json delete mode 100755 product/ipcamera_hi3516dv300.json delete mode 100755 product/ipcamera_hi3518ev300.json delete mode 100755 product/qemu_arm_virt_ca7.json delete mode 100755 product/wifiiot.json create mode 100755 setup.py create mode 100755 testfwk/gen_module_list_files.py create mode 100755 testfwk/gen_testfwk_info.py diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md deleted file mode 100755 index f09d98d..0000000 --- a/.gitee/ISSUE_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,13 +0,0 @@ -### 该问题是怎么引起的? - - - -### 重现步骤 - - - -### 报错信息 - - - - diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md deleted file mode 100755 index 33948fd..0000000 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,15 +0,0 @@ -### 相关的Issue - - -### 原因(目的、解决的问题等) - - -### 描述(做了什么,变更了什么) - - -### 测试用例(新增、改动、可能影响的功能) - - - - - diff --git a/.gitignore b/.gitignore index 029519e..ecc00b7 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ __pycache__/ -*.py[cod] \ No newline at end of file +*.py[cod] +.vscode \ No newline at end of file diff --git a/BUILD.gn b/BUILD.gn index 04070b2..adca900 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,60 +1,125 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/lite/toolchain/${ohos_build_compiler}.gni") -import("//build/lite/ndk/ndk.gni") - -group("ohos") { - deps = [] - if (ohos_build_target == "") { - product_cfg = read_file("//build/lite/product/${product}.json", "json") - foreach(subsystem, product_cfg.subsystem) { - foreach(component, subsystem.component) { - deps += [ component.dir ] - } - } - } else { - deps += [ ohos_build_target ] - } -} - -group("ndk") { - # Add native API targets - deps = [] - if (ohos_build_ndk) { - deps += [ - "//build/lite/ndk:ndk" - ] - } -} - -action("gen_rootfs") { - deps = [ ":ohos" ] - - script = "//build/lite/gen_rootfs.py" - outputs = [ "$target_gen_dir/gen_rootfs.log" ] - out_dir = rebase_path(root_build_dir, ".") - - compiler_dir = ohos_build_compiler_dir + "/bin/" - - ohos_build_compiler_so_strip = compiler_dir + ohos_build_compiler_so_strip - ohos_build_compiler_bin_strip = compiler_dir + ohos_build_compiler_bin_strip - - args = [ - "--path=$out_dir", - "--board=$board_name", - "--kernel=$ohos_kernel_type", - "--compile_so=$ohos_build_compiler_so_strip", - "--compile_bin=$ohos_build_compiler_bin_strip" - ] -} \ No newline at end of file +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/lite/ndk/ndk.gni") + +group("ohos") { + deps = [] + if (ohos_build_target == "") { + # Step 1: Read product configuration profile. + product_cfg = read_file("${product_path}/config.json", "json") + kernel = product_cfg.kernel_type + + # Step 2: Loop subsystems configured by product. + foreach(product_configed_subsystem, product_cfg.subsystems) { + subsystem_name = product_configed_subsystem.subsystem + subsystem_info = { + } + + # Step 3: Read OS subsystems profile. + subsystem_info = + read_file("//build/lite/components/${subsystem_name}.json", "json") + + # Step 4: Loop components configured by product. + foreach(product_configed_component, + product_configed_subsystem.components) { + # Step 5: Check whether the component configured by product is exist. + component_found = false + foreach(system_component, subsystem_info.components) { + if (product_configed_component.component == + system_component.component) { + component_found = true + } + } + assert( + component_found, + "Component \"${product_configed_component.component}\" not found" + + ", please check your product configuration.") + + # Step 6: Loop OS components and check validity of product configuration. + foreach(component, subsystem_info.components) { + kernel_valid = false + board_valid = false + + # Step 6.1: Skip component which not configured by product. + if (component.component == product_configed_component.component) { + # Step 6.1.1: Loop OS components adapted kernel type. + foreach(component_adapted_kernel, component.adapted_kernel) { + if (component_adapted_kernel == kernel && kernel_valid == false) { + kernel_valid = true + } + } + + assert( + kernel_valid, + "Invalid component configed, ${subsystem_name}:${product_configed_component.component} " + "not available for kernel: $kernel!") + + # Step 6.1.2: Add valid component for compiling. + foreach(component_target, component.targets) { + deps += [ component_target ] + } + } + } + } + } + # Step 7: Add device and product target by default. + deps += [ + "${device_path}/../", + "${product_path}" ] + } else { + deps += string_split(ohos_build_target, "&&") + } +} + +group("ndk") { + # Add native API targets. + deps = [] + if (ohos_build_ndk) { + deps += [ "//build/lite/ndk:ndk" ] + } +} + +if (ohos_build_target == "") { + action("gen_rootfs") { + deps = [ ":ohos" ] + + script = "//build/lite/gen_rootfs.py" + outputs = [ "$target_gen_dir/gen_rootfs.log" ] + out_dir = rebase_path("$root_out_dir") + + args = [ + "--path=$out_dir", + "--kernel=$ohos_kernel_type", + "--storage=$storage_type", + "--strip_command=$ohos_current_strip_command", + "--dmverity=$enable_ohos_security_dmverity", + ] + } +} + +if (ohos_build_type == "debug" && product != "") { + action("gen_testfwk_info") { + outputs = [ "$root_out_dir/gen_testfwk_info.log" ] + script = "//build/lite/testfwk/gen_testfwk_info.py" + archive_dir_name = "test_info" + args = [ + "--component-info-file", + rebase_path("${product_path}/config.json"), + "--output-json-fold", + rebase_path("${root_out_dir}/${archive_dir_name}/build_configs/"), + "--output-json-file-name", + "infos_for_testfwk.json", + "--output-module-list-files-fold", + rebase_path("${root_out_dir}/${archive_dir_name}/module_list_files/"), + ] + } +} diff --git a/README_zh.md b/README_zh.md new file mode 100755 index 0000000..944fa42 --- /dev/null +++ b/README_zh.md @@ -0,0 +1,193 @@ +# 轻量级编译构建组件 + +- [简介](#section11660541593) +- [目录](#section161941989596) +- [说明](#section1312121216216) + - [使用说明](#section129654513264) + +- [相关仓](#section1371113476307) + +## 简介 + +一个基于gn和ninja的支持OpenHarmony组件化开发的编译框架,主要提供以下功能: + +- 构建产品。 + +- 独立构建芯片厂商组件。 +- 独立构建单个组件。 + +在开发编译构建前,应了解如下基本概念: + +- 组件 + + 可复用的软件单元,它可包含源码、配置文件、资源文件和编译脚本等。 + +- gn + + Generate ninja的缩写,一种元构建系统,用于产生ninja文件。 + +- ninja + + ninja是一个专注于速度的小型构建系统。 + + +构建流程如下: + +编译构建流程如图1所示,主要包括设置和编译两步: + +**图 1** 编译构建流程 +![](figures/编译构建流程.jpg "编译构建流程") + +1. hb set: 设置OpenHarmony源码目录和要编译的产品。 +2. hb build: 编译产品、开发板或者组件。解决方案编译实现如下: + - 读取开发板配置:主要包括开发板使用的编译工具链、编译链接命令和选项等。 + - 调用gn: 调用gn gen命令,读取产品配置\(主要包括开发板、内核、选择的组件等\)生成解决方案out目录和ninja文件。 + - 调用ninja:调用ninja -C out/company/product启动编译。 + - 系统镜像打包:将组件编译产物打包,制作文件系统镜像。 + + +## 目录 + +``` +build/lite # 编译构建主目录 +├── components # 组件描述文件。 +├── hb # hb pip安装包源码。 +├── make_rootfs # 文件系统制作脚本。 +├── config # 编译相关的配置项 +│ ├── component # 组件相关的模板定义。包括:静态库、动态库、扩展组件、模拟器库等 +│ ├── kernel # 内核的编译配置参数 +│ └── subsystem # 子系统模板 +├── ndk # Native API相关编译脚本与配置参数 +├── product # 产品全量配置表,包括:配置单元、子系统列表、编译器等。 +└── toolchain # 编译工具链相关,包括:编译器路径、编译选项、链接选项等。 +``` + +## 说明 + +### 使用说明 + +1. **前提条件** + - Linux服务器,Ubuntu16.04及以上64位系统版本。 + - Python 3.7.4及以上。 + - OpenHarmony源码build\_lite仓下载成功。 + +2. **安装hb** + - 在源码根目录下执行: + + ``` + python3 -m pip install --user build/lite + ``` + + - 执行hb -h有相关帮助信息,有打印信息即表示安装成功: + + ``` + usage: hb + + OHOS build system + + positional arguments: + {build,set,env,clean} + build Build source code + set OHOS build settings + env Show OHOS build env + clean Clean output + + optional arguments: + -h, --help show this help message and exit + ``` + + - 卸载方法: + + ``` + python3 -m pip uninstall ohos-build + ``` + + +3. **编译命令** + 1. **hb set** + + ``` + hb set -h + usage: hb set [-h] [-root [ROOT_PATH]] [-p] + + optional arguments: + -h, --help Show this help message and exit. + -root [ROOT_PATH], --root_path [ROOT_PATH] + Set OHOS root path. + -p, --product Set OHOS board and kernel. + ``` + + - hb set 后无参数,进入默认设置流程 + - hb set -root \[ROOT\_PATH\] 直接设置代码根目录 + - hb set -p --product 设置要编译的产品 + + 2. **hb env** + + 查看当前设置信息 + + ``` + hb env + [OHOS INFO] root path: xxx + [OHOS INFO] board: hispark_taurus + [OHOS INFO] kernel: liteos + [OHOS INFO] product: ipcamera + [OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera + [OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19 + ``` + + 3. **hb build** + + ``` + hb build -h + usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] + [--dmverity] [-p PRODUCT] [-f] [-n] + [component [component ...]] + + positional arguments: + component Name of the component. + + optional arguments: + -h, --help Show this help message and exit. + -b BUILD_TYPE, --build_type BUILD_TYPE + Release or debug version. + -c COMPILER, --compiler COMPILER + Specify compiler. + -t [TEST [TEST ...]], --test [TEST [TEST ...]] + Compile test suit. + --dmverity Enable dmverity. + -p PRODUCT, --product PRODUCT + Build a specified product with + {product_name}@{company}, eg: ipcamera@hisilcon. + -f, --full Full code compilation. + -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] + Compile single target + ``` + + - hb build后无参数,会按照设置好的代码路径、产品进行编译,编译选项使用与之前保持一致。 + - hb build component:基于设置好的产品对应的单板、内核,单独编译组件(e.g.:hb build kv\_store\)。 + - hb build -p PRODUCT:免set编译产品,该命令可以跳过set步骤,直接编译产品。 + - 在device/device\_company/board下单独执行hb build会进入内核选择界面,选择完成后会根据当前路径的单板、选择的内核编译出仅包含内核、驱动的镜像。 + + 4. **hb clean** + + 清除out目录对应产品的编译产物,仅剩下args.gn、build.log。清除指定路径可输入路径参数:hb clean xxx/out/xxx,否则将清除hb set的产品对应out路径 + + ``` + hb clean + usage: hb clean [-h] [out_path] + + positional arguments: + out_path Clean a specified path. + + optional arguments: + -h, --help Show this help message and exit. + ``` + + + +## 相关仓 + +编译构建子系统 + +**[build\_lite](https://gitee.com/openharmony/build_lite)** + diff --git a/build.py b/build.py index 3d004f1..1c7836d 100755 --- a/build.py +++ b/build.py @@ -16,54 +16,48 @@ # limitations under the License. # -import sys -import argparse -import importlib -import logging import os +import sys +import subprocess -def usage(): - msg = "\n python build.py ipcamera_hi3516dv300\n "\ - "python build.py ipcamera_hi3518ev300\n "\ - "python build.py wifiiot\n "\ - "python build.py qemu_arm_virt_ca7\n"\ - "\n Quickstart: https://device.harmonyos.com/cn/docs/start/"\ - "introduce/oem_start_guide-0000001054913231\n" - return msg +def check_output(cmd, **kwargs): + process = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True, + **kwargs) + for line in iter(process.stdout.readline, ''): + sys.stdout.write(line) + sys.stdout.flush() + + process.wait() + ret_code = process.returncode + + if ret_code != 0: + for line in iter(process.stderr.readline, ''): + sys.stdout.write(line) + sys.stdout.flush() + + return ret_code + + +def set_root_path(path): + cmd = ['python3', 'build/lite/hb/__main__.py', 'set', '-root', path] + return check_output(cmd, cwd=path) + + +def build(path, args_list): + cmd = ['python3', 'build/lite/hb/__main__.py', 'build'] + args_list + return check_output(cmd, cwd=path) def main(): - if not __package__: - path = os.path.join(os.path.abspath(os.path.dirname(__file__)), - 'build') - sys.path.insert(0, path) - - parser = argparse.ArgumentParser(usage=usage()) - parser_list = [] - parser_list.append({ - 'name': 'compile', - 'help': 'Build source code' - }) - - for each in parser_list: - module = importlib.import_module('.{}'.format(each.get('name')), - 'lite') - module.add_options(parser) - parser.set_defaults(command=module.exec_command) - - args = parser.parse_args() - - try: - status = args.command(args, parser) - except KeyboardInterrupt: - logging.warning('interrupted') - status = -1 - except Exception as e: - print(e) - status = -1 - - return status + root_path = os.path.dirname(os.path.abspath(__file__)) + ret_code = set_root_path(root_path) + if ret_code != 0: + return ret_code + return build(root_path, sys.argv[1:]) if __name__ == "__main__": diff --git a/build_ext_components.py b/build_ext_components.py index 512d46c..f964035 100755 --- a/build_ext_components.py +++ b/build_ext_components.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - # # Copyright (c) 2020 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,18 +17,28 @@ import os import sys -from subprocess import Popen +import subprocess import argparse import shlex +from tempfile import NamedTemporaryFile +from shutil import copyfile -def cmd_exec(command): +def cmd_exec(command, temp_file, error_log_path): cmd = shlex.split(command) - proc = Popen(cmd) + + proc = subprocess.Popen(cmd, + stdout=temp_file, + stderr=temp_file, + universal_newlines=True) + proc.wait() ret_code = proc.returncode if ret_code != 0: - raise Exception("{} failed, return code is {}".format(cmd, ret_code)) + copyfile(temp_file.name, error_log_path) + return ret_code + + return ret_code def main(): @@ -38,6 +47,8 @@ def main(): parser.add_argument('--prebuilts', help='Build prebuilts.') parser.add_argument('--command', help='Build command.') parser.add_argument('--enable', help='enable python.', nargs='*') + parser.add_argument('--target_dir', nargs=1) + parser.add_argument('--out_dir', nargs=1) args = parser.parse_args() if args.enable: @@ -47,17 +58,26 @@ def main(): if args.path: curr_dir = os.getcwd() os.chdir(args.path) - if args.prebuilts: - cmd_exec(args.prebuilts) - if args.command: - if '&&' in args.command: - command = args.command.split('&&') - for data in command: - cmd_exec(data) - else: - cmd_exec(args.command) + with NamedTemporaryFile(mode='wt') as temp_file: + if args.prebuilts: + status = cmd_exec(args.prebuilts, temp_file, args.out_dir[0]) + if status != 0: + return status + if args.command: + if '&&' in args.command: + command = args.command.split('&&') + for data in command: + status = cmd_exec(data, temp_file, args.out_dir[0]) + if status != 0: + return status + else: + status = cmd_exec(args.command, temp_file, args.out_dir[0]) + if status != 0: + return status + copyfile(temp_file.name, args.target_dir[0]) os.chdir(curr_dir) + return 0 if __name__ == '__main__': diff --git a/compile.py b/compile.py deleted file mode 100755 index 045369f..0000000 --- a/compile.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from utils import CallbackDict -from compile_process import config_create -from compile_process import run_build -from config import Config - - -def add_options(parser): - parser.add_argument('product', help='Name of the product', nargs='*') - parser.add_argument('-b', '--build_type', help='release or debug version.', - nargs=1, default=['release']) - parser.add_argument('-t', '--test', help='Compile test suit', nargs='*') - parser.add_argument('-T', '--target', help='Compile single target', - nargs=1, default=['']) - parser.add_argument('-n', '--ndk', help='Compile ndk', action='store_true') - - -def exec_command(args, parser): - callback_dict = CallbackDict() - - # parse product - if args.product: - config = Config(args) - callback_dict.register(config.product, config_create) - callback_dict.register(config.product, run_build) - - callback_dict.excute(config.product, - config=config, - args=args) - else: - parser.print_help() - raise Exception("Error: product not found.") diff --git a/compile_process.py b/compile_process.py deleted file mode 100755 index 20cd651..0000000 --- a/compile_process.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import os -import shutil -from utils import makedirs -from utils import read_json_file -from config import Compile - - -def run_build(**kwargs): - print("\n=== start build ===\n") - config = kwargs['config'] - compile = Compile() - compile.compile(config) - print("ohos {} build success!".format(config.product)) - - -def parse_product_json(config): - product = config.product - product_json = os.path.join(config.get_build_path(), 'product', - '{}.json'.format(product)) - json_content = read_json_file(product_json) - Compile.get_tool_path(config, json_content) - return load_subsystem_feature(json_content, config) - - -def check_build(config): - # Delete and create output directory - out_path = config.get_out_path() - if os.path.exists(out_path): - shutil.rmtree(out_path) - makedirs(out_path) - return parse_product_json(config) - - -def load_subsystem_feature(json_content, config): - for subsystem in json_content['subsystem']: - for component in subsystem['component']: - for feature in component['features']: - config.args_list.append(feature) - return True - - -def config_create(**kwargs): - config = kwargs['config'] - check_build(config) - return True diff --git a/components/aafwk.json b/components/aafwk.json new file mode 100755 index 0000000..7641008 --- /dev/null +++ b/components/aafwk.json @@ -0,0 +1,53 @@ +{ + "components": [ + { + "component": "ability", + "description": "", + "optional": "true", + "dirs": [ + "foundation/aafwk/aafwk_lite" + ], + "targets": [ + "//foundation/aafwk/aafwk_lite/frameworks/ability_lite:aafwk_abilitykit_lite", + "//foundation/aafwk/aafwk_lite/frameworks/abilitymgr_lite:aafwk_abilityManager_lite", + "//foundation/aafwk/aafwk_lite/services/abilitymgr_lite:aafwk_services_lite" + ], + "rom": "300KB", + "ram": ">20KB", + "output": [ + "libability.so", + "libabilitymanager.so" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [ + "enable_ohos_appexecfwk_feature_ability = true" + ], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "hilog_lite", + "permission", + "ipc_lite", + "samgr_lite", + "appspawn", + "wms" + ] + } + } + ] +} diff --git a/components/ace.json b/components/ace.json new file mode 100755 index 0000000..a57287f --- /dev/null +++ b/components/ace.json @@ -0,0 +1,52 @@ +{ + "components": [ + { + "component": "ace_engine_lite", + "description": "JS APP development frameworks.", + "optional": "true", + "dirs": [ + "foundation/ace/ace_engine_lite", + "utils/native/lite/timer_task", + "utils/native/lite/js/builtin" + ], + "targets": [ + "//foundation/ace/ace_engine_lite/frameworks:jsfwk", + "//foundation/ace/ace_engine_lite/test:unittest" + ], + "rom": "600KB", + "ram": "~90KB", + "output": [ "libace_lite.so" ], + "adapted_kernel": [ "liteos_a", "linux"], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson", + "freetype" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "syspara", + "surface", + "i18n", + "global_resource_manager", + "samgr_lite", + "hilog_lite", + "permission", + "ipc_lite", + "kal_timer", + "liteos_a", + "kv_store" + ] + } + } + ] +} diff --git a/components/ai.json b/components/ai.json new file mode 100755 index 0000000..ea028aa --- /dev/null +++ b/components/ai.json @@ -0,0 +1,37 @@ +{ + "components": [ + { + "component": "ai_engine", + "description": "AI engine framework.", + "optional": "true", + "dirs": [ + "foundation/ai/engine" + ], + "targets": [ + "//foundation/ai/engine/services:ai" + ], + "rom": "", + "ram": "", + "output": [ + "ai_server", + "ai_communication_adapter.a" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "iniparser" + ], + "kernel_special": {}, + "board_special": {}, + "components": [ + "hilog_lite", + "utils_base", + "ipc_lite", + "samgr_lite" + ] + } + } + ] +} diff --git a/components/appexecfwk.json b/components/appexecfwk.json new file mode 100755 index 0000000..ff83cbc --- /dev/null +++ b/components/appexecfwk.json @@ -0,0 +1,48 @@ +{ + "components": [ + { + "component": "bundle_mgr", + "description": "Bundle installation management frameworks.", + "optional": "true", + "dirs": [ + "foundation/appexecfwk/appexecfwk_lite" + ], + "targets": [ + "//foundation/appexecfwk/appexecfwk_lite/services/bundlemgr_lite:appexecfwk_services_lite", + "//foundation/appexecfwk/appexecfwk_lite/frameworks/bundle_lite:appexecfwk_kits_lite" + ], + "rom": "300KB", + "ram": ">2MB", + "output": [ + "libbundlems.so", + "libbundle.so", + "bundle_daemon", + "bm" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "zlib", + "bounds_checking_function", + "cjson" + ], + "kernel_special": {}, + "board_special": {}, + "components": [ + "hilog_lite", + "aafwk_lite", + "permission", + "ipc_lite", + "samgr_lite", + "resmgr_lite", + "ability", + "app_verify" + ] + } + } + ] +} diff --git a/components/applications.json b/components/applications.json new file mode 100755 index 0000000..54a386d --- /dev/null +++ b/components/applications.json @@ -0,0 +1,202 @@ +{ + "components": [ + { + "component": "camera_sample_communication", + "description": "Communication related samples.", + "optional": "true", + "dirs": [ + "applications/sample/camera/communication" + ], + "targets": [ + "//applications/sample/camera/communication:sample" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "components": [], + "third_party": [ ] + } + }, + { + "component": "camera_sample_app", + "description": "Camera related samples.", + "optional": "true", + "dirs": [ + "applications/sample/camera/launcher", + "applications/sample/camera/cameraApp", + "applications/sample/camera/setting", + "applications/sample/camera/gallery", + "applications/sample/camera/media" + ], + "targets": [ + "//applications/sample/camera/launcher:launcher_hap", + "//applications/sample/camera/cameraApp:cameraApp_hap", + "//applications/sample/camera/setting:setting_hap", + "//applications/sample/camera/gallery:gallery_hap", + "//applications/sample/camera/media:media_sample" + ], + "rom": "", + "ram": "", + "output": [ + "cameraApp.so", + "launcher.so", + "setting.so", + "gallery.so", + "camera_sample" + ], + "adapted_kernel": [ "liteos_a","linux" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "libjpeg", + "giflib", + "libpng", + "iniparser", + "cjson" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "liteos_a", + "media_lite", + "syspara", + "hilog", + "media_service", + "permission", + "ipc", + "camera_lite", + "system_ability_manager", + "wpa_supplicant", + "utils_base", + "graphic", + "ability", + "bundle_mgr" + ] + } + }, + { + "component": "camera_screensaver_app", + "description": "Camera related samples.", + "optional": "true", + "dirs": [ + "applications/sample/camera/screensaver" + ], + "targets": [ + "//applications/sample/camera/screensaver:screensaver_hap" + ], + "rom": "", + "ram": "", + "output": [ + "screensaver.so" + ], + "adapted_kernel": [ "liteos_a","linux" ], + "features": [], + "deps": { + "third_party": [ + "libjpeg", + "libpng", + "bounds_checking_function", + "cjson", + "giflib" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "syspara", + "bundle_mgr", + "media_lite", + "media_service", + "camera_lite", + "permission", + "ability", + "ipc", + "wpa_supplicant", + "liteos_a", + "graphic", + "hilog", + "utils_base", + "system_ability_manager" + ] + } + }, + { + "component": "wifi_iot_sample_app", + "description": "Wifi iot samples.", + "optional": "true", + "dirs": [ + "applications/sample/wifi-iot/app" + ], + "targets": [ + "//applications/sample/wifi-iot/app" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ "hi3861v100" ], + "adapted_kernel": [ "liteos_m" ], + "features": [], + "deps": { + "components": [ + "liteos_m", + "hi3861_sdk", + "utils_base" + ] + } + }, + { + "component": "kit_framework", + "description": "", + "optional": "true", + "dirs": [ + "applications/kit_framework" + ], + "targets": [ + "//applications/kit_framework:kit_framework" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_m", + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "components": [ + "hilog_a", + "huks", + "token", + "syspara", + "ipc", + "ability", + "bundle_mgr", + "kv_store" + ], + "third_party": [ + "cjson", + "mbedtls", + "bounds_checking_function" + ] + } + } + ] +} diff --git a/components/communication.json b/components/communication.json new file mode 100755 index 0000000..1a8d0b9 --- /dev/null +++ b/components/communication.json @@ -0,0 +1,174 @@ +{ + "components": [ + { + "component": "ipc", + "description": "Lite interprosses communication.", + "optional": "true", + "dirs": [ + "foundation/communication/ipc_lite" + ], + "targets": [ + "//foundation/communication/ipc_lite:liteipc_adapter" + ], + "rom": "", + "ram": "", + "output": [ "libliteipc_adapter.so" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hilog_lite", + "utils_base" + ] + } + }, + { + "component": "soft_bus", + "description": "", + "optional": "true", + "dirs": [ + "foundation/communication/softbus_lite" + ], + "targets": [ + "//foundation/communication/softbus_lite:softbus" + ], + "rom": "", + "ram": "", + "output": [ + "softbus_lite.so", + "discovery.a" + ], + "adapted_kernel": [ + "liteos_a", + "linux", + "liteos_m" + ], + "features": [], + "deps": { + "third_party": [ + "mbedtls", + "bounds_checking_function", + "cjson" + ], + "kernel_special": { + "liteos_a": [ + "permission", + "wpa_supplicant" + ], + "liteos_m": [ + "wlan", + "liteos_m", + "hi3861_sdk", + "utils_base" + ] + }, + "board_special": { + "hi3516dv300": [ + "permission", + "wpa_supplicant" + ], + "hi3518ev300": [ + "permission", + "wpa_supplicant" + ], + "hi3861v100": [ + "wlan", + "liteos_m", + "hi3861_sdk", + "utils_base" + ] + }, + "components": [ + "liteos_a", + "syspara", + "hichainsdk" + ] + } + }, + { + "component": "wpa_supplicant", + "description": "WPA supplicant open sources software.", + "optional": "true", + "dirs": [ + "third_party/wpa_supplicant" + ], + "targets": [ + "//third_party/wpa_supplicant/wpa_supplicant-2.9:wpa_supplicant" + ], + "rom": "", + "ram": "", + "output": [ "wpa_supplicant.so" ], + "adapted_kernel": [ "liteos_a", "linux" ], + "features": [], + "deps": { + "third_party": [], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [] + } + }, + { + "component": "wlan", + "description": "Wifi service based on liteos-m.", + "optional": "true", + "dirs": [ + "foundation/communication/wifi_lite" + ], + "targets": [ + "//foundation/communication/wifi_lite:wifi" + ], + "rom": "", + "ram": "", + "output": [ ], + "adapted_kernel": [ "liteos_m" ], + "features": [], + "deps": { + "third_party": [], + "kernel_special": {}, + "board_special": {}, + "components": [ + "liteos_m", + "hi3861_adapter", + "hi3861_sdk", + "utils_base" + ] + } + }, + { + "component": "wifi_aware", + "description": "WiFi Aware", + "optional": "true", + "dirs": [ + "foundation/communication/wifi_aware" + ], + "targets": [ + "//foundation/communication/wifi_aware:wifiaware" + ], + "rom": "", + "ram": "", + "output": [ ], + "adapted_kernel": [ "liteos_m" ], + "features": [], + "deps": { + "components": [ + "hi3861_adapter", + "hi3861_sdk" + ], + "third_party": [] + } + } + ] +} diff --git a/components/distributed_schedule.json b/components/distributed_schedule.json new file mode 100755 index 0000000..759d264 --- /dev/null +++ b/components/distributed_schedule.json @@ -0,0 +1,144 @@ +{ + "components": [ + { + "component": "system_ability_manager", + "description": "", + "optional": "false", + "dirs": [ + "foundation/distributedschedule/samgr_lite" + ], + "targets": [ + "//foundation/distributedschedule/samgr_lite:samgr" + ], + "rom": "62KB", + "ram": "", + "output": [ + "libsamgr.so", + "libbroadcast.so", + "libserver.so" + ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson" + ], + "kernel_special": { + "liteos_a": [ + "liteos_a", + "hilog", + "permission", + "ipc" + ], + "liteos_m": [ + "liteos_m", + "hilog_lite", + "hi3861_sdk" + ] + }, + "board_special": { + "hi3516dv300": [ + "liteos_a", + "hilog", + "permission", + "ipc" + ], + "hi3518ev300": [ + "liteos_a", + "hilog", + "permission", + "ipc" + ], + "hi3861v100": [ + "liteos_m", + "hilog_lite", + "hi3861_sdk" + ] + }, + "components": [ + "utils_base", + "ipc_lite", + "permission", + "hilog_lite" + ] + } + }, + { + "component": "foundation", + "description": "", + "optional": "true", + "dirs": [ + "foundation/distributedschedule/safwk_lite" + ], + "targets": [ + "//foundation/distributedschedule/safwk_lite" + ], + "rom": "15KB", + "ram": "", + "output": [ "foundation" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson" + ], + "kernel_special": {}, + "board_special": {}, + "components": [ + "aafwk_lite", + "appexecfwk_lite", + "hilog_lite", + "permission", + "dmsfwk_lite", + "samgr_lite", + "powermgr_lite" + ] + } + }, + { + "component": "distributed_schedule", + "description": "", + "optional": "true", + "dirs": [ + "foundation/distributedschedule/dmsfwk_lite" + ], + "targets": [ + "//foundation/distributedschedule/dmsfwk_lite:dtbschedmgr", + "//foundation/distributedschedule/dmsfwk_lite/moduletest/dtbschedmgr_lite:distributed_schedule_test_dms" + ], + "rom": "26KB", + "ram": "", + "output": [ "dmslite.so" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson" + ], + "kernel_special": {}, + "board_special": {}, + "components": [ + "hilog_lite", + "samgr_lite", + "aafwk_lite", + "appexecfwk_lite", + "softbus_lite", + "huks" + ] + } + } + ] +} diff --git a/components/drivers.json b/components/drivers.json new file mode 100644 index 0000000..565d631 --- /dev/null +++ b/components/drivers.json @@ -0,0 +1,178 @@ +{ + "components": [ + { + "component": "hdf_hi3516dv300_liteos_a", + "description": "", + "optional": "false", + "dirs": [ + "drivers/adapter/uhdf", + "drivers/peripheral", + "device/hisilicon/drivers" + ], + "targets": [ + "//drivers/adapter/uhdf/posix:hdf_posix", + "//drivers/adapter/uhdf/manager:hdf_manager", + "//drivers/adapter/uhdf/platform:hdf_platform_driver", + "//drivers/peripheral/display/hal:hdi_display", + "//drivers/peripheral/input/hal:hdi_input", + "//drivers/peripheral/sensor/hal:hdi_sensor", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + "//device/hisilicon/drivers/firmware/common/wlan:wifi_firmware", + "//drivers/adapter/uhdf/test:hdf_test" + ], + "rom": "", + "ram": "", + "output": [ + "libhdf_osal.so", + "libhdf_core.so", + "libdisplay_gralloc.so", + "libdisplay_layer.so", + "libdisplay_gfx.so", + "libhdi_input.so" + ], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "googletest" + ], + "components": [ + "hilog", + "hi3516dv300_sdk", + "hi3516dv300_adapter", + "liteos_a", + "utils_base", + "developer_test" + ] + } + }, + { + "component": "hdf_hi3516dv300_linux", + "description": "", + "optional": "false", + "dirs": [ + "drivers/adapter/uhdf", + "drivers/peripheral", + "device/hisilicon/drivers" + ], + "targets": [ + "//drivers/adapter/uhdf/posix:hdf_posix", + "//drivers/adapter/uhdf/manager:hdf_manager", + "//drivers/adapter/uhdf/platform:hdf_platform_driver", + "//drivers/peripheral/input/hal:hdi_input", + "//drivers/peripheral/display/hal:hdi_display", + "//drivers/peripheral/sensor/hal:hdi_sensor", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + "//device/hisilicon/drivers/firmware/common/wlan:wifi_firmware", + "//drivers/adapter/uhdf/test:hdf_test" + ], + "rom": "", + "ram": "", + "output": [ + "libhdf_posix_osal.so", + "libhdf_core.so", + "libhdf_platform.so", + "hi3881_fw.bin", + "wifi_cfg" + ], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "linux" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hilog" + ] + } + }, + { + "component": "hdf_hi3518ev300_linux", + "description": "", + "optional": "false", + "dirs": [ + "drivers/peripheral/display", + "vendor/huawei/hdf" + ], + "targets": [ + "//drivers/peripheral/display/hal:hdi_display" + ], + "rom": "", + "ram": "", + "output": [ + "libdisplay_layer.so" + ], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "linux" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hi3518ev300_linux" + ] + } + }, + { + "component": "hdf_hi3518ev300_liteos_a", + "description": "", + "optional": "false", + "dirs": [ + "drivers/adapter/uhdf", + "drivers/peripheral", + "device/hisilicon/drivers" + ], + "targets": [ + "//drivers/adapter/uhdf/posix:hdf_posix", + "//drivers/adapter/uhdf/manager:hdf_manager", + "//drivers/adapter/uhdf/platform:hdf_platform_driver", + "//drivers/peripheral/display/hal:hdi_display", + "//drivers/peripheral/input/hal:hdi_input", + "//drivers/peripheral/wlan/client:hdi_wifi", + "//drivers/peripheral/wlan/hal:wifi_hal_interface", + "//device/hisilicon/drivers/firmware/common/wlan:wifi_firmware", + "//drivers/adapter/uhdf/test:hdf_test" + ], + "rom": "", + "ram": "", + "output": [ + "libhdf_osal.so", + "libhdf_core.so", + "libdisplay_gralloc.so", + "libdisplay_layer.so", + "libdisplay_gfx.so", + "libhdi_input.so" + ], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hilog", + "hi3516dv300_sdk" + ] + } + } + ] +} diff --git a/components/global.json b/components/global.json new file mode 100755 index 0000000..0a84ba4 --- /dev/null +++ b/components/global.json @@ -0,0 +1,73 @@ +{ + "components": [ + { + "component": "global_resource_manager", + "description": "resource scheduler.", + "optional": "true", + "dirs": [ + "base/global/resmgr_lite" + ], + "targets": [ + "//base/global/resmgr_lite/frameworks/resmgr_lite:global_resmgr" + ], + "rom": "21KB", + "ram": "~48KB", + "output": [ "global_resmgr.so" ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "utils_base" + ] + } + }, + { + "component": "global_i18n_kits", + "description": "i18n interfaces", + "optional": "true", + "dirs": [ + "base/global/i18n_lite" + ], + "targets": [ + "//base/global/i18n_lite/frameworks/i18n:global_i18n" + ], + "rom": "2.5MB", + "ram": "~112KB", + "output": [ "global_i18n.so" ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "utils_base" + ] + } + }, + { + "component": "global_cust", + "description": "", + "optional": "true", + "dirs": [ + "base/global/cust_lite" + ], + "targets": [ + "//base/global/cust_lite/frameworks/cust_lite:cust" + ], + "rom": "9KB", + "ram": "~40KB", + "output": [ "cust.so" ], + "adapted_kernel": [ "linux" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ] + } + } + ] +} diff --git a/components/graphic.json b/components/graphic.json new file mode 100755 index 0000000..3f6a529 --- /dev/null +++ b/components/graphic.json @@ -0,0 +1,157 @@ +{ + "components": [ + { + "component": "graphic_utils", + "description": "", + "optional": "true", + "dirs": ["foundation/graphic/utils"], + "targets": [ + "//foundation/graphic/utils:lite_graphic_utils", + "//foundation/graphic/utils/test:lite_graphic_utils_test" + ], + "rom": "", + "ram": "", + "output": ["libgraphic_utils.so"], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hilog_lite" + ] + } + }, + { + "component": "graphic_hals", + "description": "", + "optional": "true", + "dirs": ["foundation/graphic/utils"], + "targets": ["//foundation/graphic/utils:lite_graphic_hals"], + "rom": "", + "ram": "", + "output": ["libgraphic_hals.so"], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "lite_graphic_utils", + "hdi_display" + ] + } + }, + { + "component": "surface", + "description": "", + "optional": "true", + "dirs": ["foundation/graphic/surface"], + "targets": [ + "//foundation/graphic/surface:lite_surface", + "//foundation/graphic/surface/test:lite_surface_test" + ], + "rom": "110KB", + "ram": "~50KB", + "output": ["libsurface.so"], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hilog_lite", + "ipc_lite" + ], + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + } + } + }, + { + "component": "wms", + "description": "", + "optional": "true", + "dirs": ["foundation/graphic/wms"], + "targets": [ + "//foundation/graphic/wms:lite_wms", + "//foundation/graphic/wms/test:lite_wms_test" + ], + "rom": "110KB", + "ram": "~50KB", + "output": ["wms_server", "libwms_client.so"], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hilog_lite", + "ipc_lite", + "samgr_lite", + "surface" + ], + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + } + } + }, + { + "component": "ui", + "description": "", + "optional": "true", + "dirs": ["foundation/graphic/ui"], + "targets": [ + "//foundation/graphic/ui:lite_ui", + "//foundation/graphic/ui/test/unittest:lite_graphic_ui_test" + ], + "rom": "900KB", + "ram": "~90KB", + "output": ["libui.so"], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "libjpeg", + "cjson", + "freetype" + ], + "components": [ + "hilog_lite", + "media_lite", + "surface", + "wms" + ] + } + } + ] +} diff --git a/components/hiviewdfx.json b/components/hiviewdfx.json new file mode 100755 index 0000000..ce223bf --- /dev/null +++ b/components/hiviewdfx.json @@ -0,0 +1,156 @@ +{ + "components": [ + { + "component": "hilog", + "description": "Log services for liteos-a kernel.", + "optional": "false", + "dirs": [ + "base/hiviewdfx/hilog_lite/frameworks/featured", + "base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog", + "base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog", + "base/hiviewdfx/hilog_lite/interfaces/native/innerkits", + "base/hiviewdfx/hilog_lite/interfaces/native/kits", + "base/hiviewdfx/hilog_lite/frameworks/featured/hilog" + ], + "targets": [ + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static", + "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", + "//base/hiviewdfx/hilog_lite/services/hilogcat:hilogcat", + "//base/hiviewdfx/hilog_lite/services/apphilogcat:apphilogcat" + ], + "rom": "10KB", + "ram": "~10KB", + "output": [ + "libhilog_shared.so", + "libhilog_static.a", + "hilogcat", + "libhilogcat.a", + "apphilogcat" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "hiview_lite", + "samgr_lite" + ] + } + }, + { + "component": "hiview_lite", + "description": "DFX services for liteos-m kernel.", + "optional": "false", + "dirs": [ + "base/hiviewdfx/hiview_lite" + ], + "targets": [ + "//base/hiviewdfx/hiview_lite:hiview_lite" + ], + "rom": "10KB", + "ram": "~10KB", + "output": [], + "adapted_kernel": [ + "liteos_m" + ], + "features": [], + "deps": { + "components": [ + ], + "third_party": [ + "cjson", + "bounds_checking_function" + ] + } + }, + { + "component": "hilog_lite", + "description": "Log services for liteos-m kernel.", + "optional": "false", + "dirs": [ + "base/hiviewdfx/hilog_lite/frameworks/mini", + "base/hiviewdfx/hilog_lite/command", + "base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" + ], + "targets": [ + "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite", + "//base/hiviewdfx/hilog_lite/command:hilog_lite_command" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_m" + ], + "features": [], + "deps": { + "components": [ + "hiview_lite", + "utils_base", + "liteos_m" + ], + "third_party": [] + } + }, + { + "component": "hievent_lite", + "description": "event log for liteos-m kernel.", + "optional": "false", + "dirs": [ + "base/hiviewdfx/hievent_lite" + ], + "targets": [ + "//base/hiviewdfx/hievent_lite:hievent_lite" + ], + "rom": "10KB", + "ram": "~10KB", + "output": [], + "adapted_kernel": [ + "liteos_m" + ], + "features": [], + "deps": { + "components": [ + "utils_base", + "hiview_lite", + "samgr_lite" + ], + "third_party": [] + } + }, + { + "component": "hiview", + "description": "", + "optional": "false", + "dirs": [ + "base/hiviewdfx/huawei_proprietary/hiview_service" + ], + "targets": [ + "//base/hiviewdfx/huawei_proprietary/hiview_service:hiview" + ], + "rom": "500KB", + "ram": "~500KB", + "output": [ + "hiview", + "libhiview", + "libhiview_hievent" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [] + } + } + ] +} diff --git a/components/iot.json b/components/iot.json new file mode 100755 index 0000000..f20bb5a --- /dev/null +++ b/components/iot.json @@ -0,0 +1,26 @@ +{ + "components": [ + { + "component": "iot_link", + "description": "", + "optional": "true", + "dirs": [ + "domains/iot/link" + ], + "targets": [ + "//domains/iot/link" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_m" + ], + "features": [], + "deps": { + "third_party": [], + "components": [] + } + } + ] +} \ No newline at end of file diff --git a/components/iot_hardware.json b/components/iot_hardware.json new file mode 100755 index 0000000..7d7e654 --- /dev/null +++ b/components/iot_hardware.json @@ -0,0 +1,28 @@ +{ + "components": [ + { + "component": "iot_controller", + "description": "Iot peripheral controller.", + "optional": "false", + "dirs": [ + "base/iot_hardware/peripheral" + ], + "targets": [ + "//base/iot_hardware/peripheral:iothardware" + ], + "output": [], + "rom": "", + "ram": "", + "adapted_kernel": [ + "liteos_m" + ], + "features": [], + "deps": { + "components": [ + + ], + "third_party": [] + } + } + ] +} diff --git a/components/kernel.json b/components/kernel.json new file mode 100755 index 0000000..e2019b9 --- /dev/null +++ b/components/kernel.json @@ -0,0 +1,149 @@ +{ + "components": [ + { + "component": "liteos_a", + "description": "liteos-a kernel", + "optional": "false", + "dirs": [ + "kernel/liteos_a" + ], + "targets": [ + "//kernel/liteos_a:kernel" + ], + "rom": "1.98MB", + "ram": "", + "output": [ + "liteos.bin" + ], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony", + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "components": [], + "third_party": [ + "FreeBSD", + "musl", + "zlib", + "FatFs", + "Linux_Kernel", + "lwip", + "NuttX", + "mtd-utils" + ] + } + }, + { + "component": "liteos_m", + "description": "liteos-m kernel", + "optional": "false", + "dirs": [ + "kernel/liteos_m" + ], + "targets": [ + "//kernel/liteos_m:kernel" + ], + "rom": "40KB", + "ram": "", + "output": [], + "features": [], + "adapted_board": [], + "adapted_kernel": [ "liteos_m" ], + "deps": { + "components": [], + "third_party": [ + "bounds_checking_function", + "FatFs" + ] + } + }, + { + "component": "linux_hi3516dv300", + "description": "linux 4.9", + "optional": "false", + "dirs": [ + "vendor/hisi/camera/dvkit_product/linux/hi3516dv300" + ], + "targets": [ + "//vendor/hisi/camera/dvkit_product/linux/hi3516dv300/Hi3516CV500_SDK_V2.0.2.0:linux_kernel" + ], + "rom": "", + "ram": "", + "output": [ + "u-boot-hi3516dv300.bin", + "uImage_hi3516dv300_smp", + "rootfs.img" + ], + "features": [], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "linux" ], + "deps": { + "components": [], + "third_party": [] + } + }, + { + "component": "linux_4_1_9", + "description": "linux 4.1.9", + "optional": "false", + "dirs": [ + "vendor/hisi/camera/dvkit_product/linux/hi3516dv300/Hi3516CV500_SDK_V2.0.3.0" + ], + "targets": [ + "//vendor/hisi/camera/dvkit_product/linux/hi3516dv300/Hi3516CV500_SDK_V2.0.3.0:linux_kernel" + ], + "rom": "", + "ram": "", + "output": [ + "u-boot-hi3516dv300.bin", + "uImage_hi3516dv300_smp", + "rootfs.img" + ], + "features": [], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "linux" ], + "deps": { + "components": [], + "third_party": [] + } + }, + { + "component": "linux_hi3518ev300", + "description": "linux 4.9", + "optional": "false", + "dirs": [ + "vendor/hisi/camera/dvkit_product/linux/hi3518ev300" + ], + "targets": [ + "//vendor/hisi/camera/dvkit_product/linux/hi3518ev300/Hi3516EV200_SDK_V1.0.1.2_LINUX:linux_kernel" + ], + "rom": "", + "ram": "", + "output": [ + "u-boot-hi3518ev300.bin", + "uImage_hi3518ev300", + "rootfs.img" + ], + "features": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "linux" ], + "deps": { + "components": [], + "third_party": [] + } + } + ] +} diff --git a/components/multimedia.json b/components/multimedia.json new file mode 100755 index 0000000..ca4058a --- /dev/null +++ b/components/multimedia.json @@ -0,0 +1,162 @@ +{ + "components": [ + { + "component": "media_service", + "description": "Media service.", + "optional": "true", + "dirs": [ + "foundation/multimedia/media_lite", + "foundation/multimedia/utils/lite" + ], + "targets": [ + "//foundation/multimedia/media_lite/services:media_server" + ], + "rom": "622KB", + "ram": "", + "output": [ + "media_server" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "iniparser" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hi3516dv300_adapter" + ], + "hi3518ev300": [ + "hi3518ev300_adapter" + ] + }, + "components": [ + "hilog_lite", + "audio_lite", + "camera_lite", + "permission", + "ipc_lite", + "ui" + ] + } + }, + { + "component": "camera_lite", + "description": "Camera service.", + "optional": "true", + "dirs": [ + "foundation/multimedia/camera_lite", + "foundation/multimedia/utils/lite/hals" + ], + "targets": [ + "//foundation/multimedia/camera_lite/frameworks:camera_lite" + ], + "rom": "131KB", + "ram": "", + "output": [ "camera_lite.so" ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hi3516dv300_adapter", + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hi3518ev300_adapter", + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "hilog_lite", + "permission", + "surface" + ] + } + }, + { + "component": "media_lite", + "description": "recoder service and player service.", + "optional": "true", + "dirs": [ + "foundation/multimedia/media_lite" + ], + "targets": [ + "//foundation/multimedia/media_lite/frameworks/recorder_lite:recorder_lite", + "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite" + ], + "rom": "622KB", + "ram": "", + "output": [ "recorder_lite.so", "player_lite.so" ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "iniparser" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hi3516dv300_adapter", + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hi3518ev300_adapter", + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "hilog_lite", + "audio_lite", + "camera_lite", + "permission", + "ipc_lite", + "ui" + ] + } + }, + { + "component": "audio_manager_lite", + "description": "Audio encoder and decoder.", + "optional": "true", + "dirs": [ + "foundation/multimedia/audio_lite" + ], + "targets": [ + "//foundation/multimedia/audio_lite/frameworks:audio_capturer_lite" + ], + "rom": "59KB", + "ram": "", + "output": [ "audio_capturer_lite.so" ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "surface" + ] + } + } + ] +} diff --git a/components/pms.json b/components/pms.json new file mode 100755 index 0000000..029e46c --- /dev/null +++ b/components/pms.json @@ -0,0 +1,37 @@ +{ + "components": [ + { + "component": "powermanageservice", + "optional": "true", + "dirs": [ + "base/powermgr" + ], + "targets": [ + "//base/powermgr/powermgr_lite/services:power_manage_service" + ], + "rom": "22KB", + "ram": "~10KB", + "output": [ + "libpms.so" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [ + "enable_ohos_appexecfwk_feature_ability = true" + ], + "deps": { + "components": [ + "aafwk_lite", + "appexecfwk_lite", + "samgr_lite", + "ui" + ], + "third_party": [ + "bounds_checking_function" + ] + } + } + ] +} diff --git a/components/security.json b/components/security.json new file mode 100755 index 0000000..eb4bb96 --- /dev/null +++ b/components/security.json @@ -0,0 +1,226 @@ +{ + "components": [ + { + "component": "hichainsdk", + "description": "", + "optional": "true", + "dirs": [ + "base/security/deviceauth" + ], + "targets": [ + "//base/security/deviceauth/frameworks/deviceauth_lite:hichainsdk" + ], + "rom": "", + "ram": "", + "output": [ "libhichainsdk.so" ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson" + + ], + "kernel_special": { + "liteos_a": [ + "huks" + ], + "liteos_m": [ + "liteos_m", + "hi3861_sdk", + "utils_base" + ] + }, + "board_special": { + "hi3516dv300": [ + "huks" + ], + "hi3518ev300": [ + "huks" + ], + "hi3861v100": [ + "liteos_m", + "hi3861_sdk", + "utils_base" + ] + }, + "components": [ + "huks" + ] + } + }, + { + "component": "huks", + "description": "", + "optional": "true", + "dirs": [ + "base/security/huks" + ], + "targets": [ + "//base/security/huks/frameworks/huks_lite:huks_sdk" + ], + "rom": "", + "ram": "", + "output": [ "libhuks.so" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "mbedtls", + "openssl", + "bounds_checking_function" + ], + "components": [] + } + }, + { + "component": "secure_os", + "description": "", + "optional": "true", + "dirs": [ + "device/hisilicon/itrustee/itrustee_ree_lite/" + ], + "targets": [ + "//device/hisilicon/itrustee/itrustee_ree_lite/services/teecd:teecd", + "//device/hisilicon/itrustee/itrustee_ree_lite/frameworks/libteec:libteec_vendor" + ], + "rom": "400KB", + "ram": "~4MB", + "output": [ + "teecd", + "libteecd_bin.a" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [ + "enable_tee_ree = false" + ], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [] + } + }, + { + "component": "permission", + "description": "", + "optional": "true", + "dirs": [ + "base/security/permission" + ], + "targets": [ + "//base/security/permission/services/permission_lite:permission_lite" + ], + "rom": "100KB", + "ram": "~90KB", + "output": [ "libipc_auth_target.so" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "components": [ + "hilog_lite", + "samgr_lite", + "ipc_lite" + ], + "third_party": [ + "bounds_checking_function", + "cjson" + ] + } + }, + { + "component": "app_verify", + "description": "", + "optional": "true", + "dirs": [ + "base/security/appverify" + ], + "targets": [ + "//base/security/appverify/interfaces/innerkits/appverify_lite:verify" + ], + "rom": "", + "ram": "", + "output": [ + "libverify_base.so", + "libverify.so" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "components": [ + "hilog_lite", + "syspara" + ], + "third_party": [ + "bounds_checking_function", + "mbedtls", + "cjson" + ] + } + }, + { + "component": "crypto", + "description": "", + "optional": "true", + "dirs": [ + "base/security/huks/frameworks/crypto_lite" + ], + "targets": [ + "//base/security/huks/frameworks/crypto_lite/cipher:cipher_shared" + ], + "rom": "", + "ram": "", + "output": [ "cipher_shared.so" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "components": [ + "hilog_lite" + ], + "third_party": [ + "bounds_checking_function", + "mbedtls" + ] + } + }, + { + "component": "dm-verity", + "description": "", + "optional": "true", + "dirs": [ "//third_party/cryptsetup" ], + "targets": [ + "//third_party/cryptsetup:veritysetup" + ], + "rom": "", + "ram": "", + "output": [ "veritysetup" ], + "adapted_kernel": [ "linux" ], + "features": [], + "deps": { + "components": [], + "third_party": [ + "popt", + "libuuid", + "LVM2", + "cjson" + ] + } + } + ] +} diff --git a/components/sensors.json b/components/sensors.json new file mode 100755 index 0000000..02f7e5d --- /dev/null +++ b/components/sensors.json @@ -0,0 +1,35 @@ +{ + "components": [ + { + "component": "sensor_lite", + "description": "Sensor services", + "optional": "true", + "dirs": [ + "base/sensors/sensor_lite" + ], + "targets": [ + "//base/sensors/sensor_lite/services:sensor_service", + "//base/sensors/sensor_lite/frameworks:sensor_lite", + "//base/sensors/sensor_lite/interfaces/kits/native:unittest" + ], + "rom": "92KB", + "ram": "~200KB", + "output": [ "libsensor_frameworks.so" ], + "adapted_kernel": [ "liteos_a" ], + "adapted_board": [ + "hi3516dv300_openharmony" + ], + "features": [], + "deps": { + "components": [ + "samgr_lite", + "ipc_lite" + + ], + "third_party": [ + "bounds_checking_function" + ] + } + } + ] +} diff --git a/components/startup.json b/components/startup.json new file mode 100755 index 0000000..8f22c46 --- /dev/null +++ b/components/startup.json @@ -0,0 +1,191 @@ +{ + "components": [ + { + "component": "syspara", + "discription": "", + "optional": "true", + "dirs": [ + "base/startup/syspara_lite" + ], + "targets": [ + "//base/startup/syspara_lite/frameworks/parameter", + "//base/startup/syspara_lite/frameworks/token" + ], + "rom": "23KB", + "ram": "", + "output": [ + "libhal_sysparam.so", + "libsysparam.so", + "libtoken.a", + "libtoken.so" + ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "kernel_special": { + "liteos_a": [ + "hilog", + "oem_smartvision" + ], + "liteos_m": [ + "hilog_lite", + "liteos_m", + "hi3861_sdk", + "oem_iotlink" + ] + }, + "board_special": { + "hi3516dv300": [ + "hilog", + "oem_smartvision" + ], + "hi3518ev300": [ + "hilog", + "oem_smartvision" + ], + "hi3861v100": [ + "hilog_lite", + "liteos_m", + "hi3861_sdk", + "oem_iotlink" + ] + }, + "components": [ + "utils_base", + "hilog_a" + ] + } + }, + { + "component": "bootstrap", + "discription": "", + "optional": "true", + "dirs": [ + "base/startup/bootstrap_lite" + ], + "targets": [ + "//base/startup/bootstrap_lite/services/source:bootstrap" + ], + "rom": "14KB", + "ram": "~128KB", + "output": [ + "libbootstrap.a" + ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "kernel_special": { + "liteos_a": [ + "liteos_a" + ], + "liteos_m": [ + "liteos_m", + "hi3861_sdk" + ] + }, + "board_special": { + "hi3516dv300": [ + "liteos_a" + ], + "hi3518ev300": [ + "liteos_a" + ], + "hi3861v100": [ + "liteos_m", + "hi3861_sdk" + ] + }, + "components": [ + "utils_base", + "samgr_lite" + ] + } + }, + { + "component": "init", + "discription": "", + "optional": "false", + "dirs": [ + "base/startup/init_lite" + ], + "targets": [ + "//base/startup/init_lite/services:init_lite" + ], + "output": [ + "init" + ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "components": [ + "syspara" + ], + "third_party": [ + "bounds_checking_function", + "cjson" + ] + } + }, + { + "component": "appspawn", + "discription": "", + "optional": "true", + "dirs": [ + "base/startup/appspawn_lite" + ], + "targets": [ + "//base/startup/appspawn_lite/services:appspawn_lite" + ], + "rom": "26KB", + "ram": "~1.8M", + "output": [ "appspawn" ], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "cjson" + ], + "kernel_special": {}, + "board_special": { + "hi3516dv300": [ + "hdf_hi3516dv300_liteos_a" + ], + "hi3518ev300": [ + "hdf_hi3518ev300_liteos_a" + ] + }, + "components": [ + "hilog_lite", + "samgr_lite", + "ipc_lite", + "kv_store", + "aafwk_lite", + "ace_engine_lite", + "surface", + "ui" + ] + } + } + ] +} diff --git a/components/test.json b/components/test.json new file mode 100755 index 0000000..e838cb2 --- /dev/null +++ b/components/test.json @@ -0,0 +1,166 @@ +{ + "components": [ + { + "component": "xts_acts", + "description": "", + "optional": "true", + "dirs": [ + "test/xts/acts/build_lite" + ], + "targets": [ + "//test/xts/acts/build_lite:acts" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "components": [ + "xts_xdevice" + ] + } + }, + { + "component": "xts_tools", + "description": "", + "optional": "true", + "dirs": [ + "test/xts/tools/lite" + ], + "targets": [ + "//test/xts/tools/lite:tools" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": {} + }, + { + "component": "xts_hits", + "description": "", + "optional": "true", + "dirs": [ + "test/xts/huawei_proprietary/hits/build_lite" + ], + "targets": [ + "//test/xts/huawei_proprietary/hits/build_lite:hits" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "components": [ + "xts_xdevice" + ] + } + }, + { + "component": "xts_ssts", + "description": "", + "optional": "true", + "dirs": [ + "test/xts/huawei_proprietary/ssts" + ], + "targets": [ + "//test/xts/huawei_proprietary/ssts" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "components": [ + "xts_xdevice" + ] + } + }, + { + "component": "developer_test", + "description": "", + "optional": "true", + "dirs": [ + "test/developertest/examples/lite", + "test/developertest/third_party" + ], + "targets": [ + "//test/developertest/examples/lite:test", + "//test/developertest/third_party/lib/cpp:gtest_main" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": {} + }, + { + "component": "xts_ists", + "description": "", + "optional": "true", + "dirs": [ + "test/xts/huawei_proprietary/ists" + ], + "targets": [ + "//test/xts/huawei_proprietary/ists" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "components": [ + "xts_xdevice" + ] + } + }, + { + "component": "xts_xdevice", + "description": "", + "optional": "true", + "dirs": [ + "test/xdevice" + ], + "targets": [ + "//test/xdevice:xdevice" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": {} + } + ] +} diff --git a/components/update.json b/components/update.json new file mode 100755 index 0000000..809a8ad --- /dev/null +++ b/components/update.json @@ -0,0 +1,57 @@ +{ + "components": [ + { + "component": "hota", + "description": "", + "optional": "false", + "dirs": [ + "base/update/ota_lite" + ], + "targets": [ + "//base/update/ota_lite/frameworks:ota_lite" + ], + "rom": "20KB", + "ram": "~10KB", + "output": [ "hota.a" ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "lwip_sack", + "mbedtls", + "bounds_checking_function" + ], + "kernel_special": { + "liteos_a": [ + "hi3518ev300_adapter" + ], + "liteos_m": [ + "liteos_m", + "hi3861_adapter", + "hi3861_sdk" + ] + }, + "board_special": { + "hi3516dv300": [ + "hi3516dv300_adapter" + ], + "hi3518ev300": [ + "hi3518ev300_adapter" + ], + "hi3861v100": [ + "liteos_m", + "hi3861_adapter", + "hi3861_sdk" + ] + }, + "components": [ + "syspara" + ] + } + } + ] +} diff --git a/components/utils.json b/components/utils.json new file mode 100755 index 0000000..b819422 --- /dev/null +++ b/components/utils.json @@ -0,0 +1,166 @@ +{ + "components": [ + { + "component": "kv_store", + "discription": "", + "optional": "true", + "dirs": [ + "utils/native/lite/kv_store", + "utils/native/lite/include", + "utils/native/lite/unittest/kv_store" + ], + "targets": [ + "//utils/native/lite/kv_store" + ], + "rom": "13KB", + "ram": "80k", + "output": [ + "libutils_kv_store.so", + "libutils_kv_store.a" + ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "kernel_special": { + "liteos_m": [ + "file", + "liteos_m", + "hi3861_sdk" + ] + }, + "board_special": { + "hi3861v100": [ + "file", + "liteos_m", + "hi3861_sdk" + ] + }, + "components": [] + } + }, + { + "component": "os_dump", + "description": "Providing commands for dumping system property.", + "optional": "true", + "dirs": [ + "utils/native/lite/os_dump" + ], + "targets": [ + "//utils/native/lite/os_dump:utils_os_dump" + ], + "rom": "3.7KB", + "ram": "~4.75KB", + "output": [ "os_dump" ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "kernel_special": { + "liteos_m": [ + "liteos_m", + "iot_controller", + "hi3861_sdk", + "utils_base" + ] + }, + "board_special": { + "hi3861v100": [ + "liteos_m", + "iot_controller", + "hi3861_sdk", + "utils_base" + ] + }, + "components": [ + "syspara", + "iot_hardware" + ] + } + }, + { + "component": "file", + "description": "", + "optional": "false", + "dirs": [ + "utils/native/lite/file", + "utils/native/lite/include" + ], + "targets": [ + "//utils/native/lite/file" + ], + "rom": "0.55KB", + "ram": "", + "output": [ "native_file.a" ], + "adapted_kernel": [ + "liteos_m" + ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + ] + } + }, + { + "component": "utils_base", + "description": "Basic macro and type definitions", + "optional": "true", + "dirs": [ + "utils/native/lite/include" + ], + "targets": [], + "rom": "0KB", + "ram": "0KB", + "output": [ ], + "adapted_kernel": [ + "liteos_a", + "liteos_m", + "linux" + ], + "features": [], + "deps": {} + }, + { + "component": "kal_timer", + "description": "", + "optional": "true", + "dirs": [ + "utils/native/lite/kal/timer" + ], + "targets": [ + "//utils/native/lite/kal/timer:kal_timer" + ], + "rom": "15KB", + "ram": "", + "output": [], + "adapted_kernel": [ + "liteos_a", + "linux" + ], + "features": [], + "deps": { + "third_party": [], + "kernel_special": {}, + "board_special": {}, + "components": [ + "utils_base" + ] + } + } + ] +} \ No newline at end of file diff --git a/components/vendor.json b/components/vendor.json new file mode 100644 index 0000000..792e0ac --- /dev/null +++ b/components/vendor.json @@ -0,0 +1,377 @@ +{ + "components": [ + { + "component": "hi3516dv300_init", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/build/hi3516dv300" + ], + "targets": [ + "//device/hisilicon/build/hi3516dv300:hi3516dv300_image" + ], + "rom": "", + "ram": "", + "output": [ "OHOS_image.bin" ], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [], + "kernel_special": {}, + "board_special": {}, + "components": [ + "liteos_a" + ] + } + }, + { + "component": "hi3518ev300_init", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/build/hi3518ev300" + ], + "targets": [ + "//device/hisilicon/build/hi3518ev300:hi3518ev300_make_kernel" + ], + "rom": "", + "ram": "", + "output": [ "OHOS_image.bin" ], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [], + "kernel_special": {}, + "board_special": {}, + "components": [ + "liteos_a" + ] + } + }, + { + "component": "hardware", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hardware" + ], + "targets": [ + "//device/hisilicon/hardware:hardware_media_sdk" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony", + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "middleware", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/modules/middleware" + ], + "targets": [ + "//device/hisilicon/modules/middleware:middleware_source_sdk" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony", + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "hi3516dv300_adapter", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hardware" + ], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function", + "iniparser" + ], + "kernel_special": {}, + "board_special": {}, + "components": [ + "hilog", + "hdf_hi3516dv300_liteos_a", + "camera_lite", + "hi3516dv300_sdk" + ] + } + }, + { + "component": "hi3518ev300_adapter", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hardware" + ], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "hi3516dv300_uboot", + "description": "", + "optional": "false", + "dirs": [], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "hi3518ev300_uboot", + "description": "", + "optional": "false", + "dirs": [], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hhi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "oem_smartvision", + "description": "", + "optional": "false", + "dirs": [ + "vendor/huawei/camera", + "base/startup/syspara_lite/hals" + ], + "targets": [ + "//vendor/huawei/camera/hals/utils/sys_param:hal_sysparam", + "//vendor/huawei/camera/hals/utils/token:haltoken_shared" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony", + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "bounds_checking_function" + ], + "components": [ + "utils_base" + ] + } + }, + { + "component": "hi3516dv300_sdk", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hi3516dv300/sdk_liteos" + ], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3516dv300", + "hi3516dv300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "hi3518ev300_sdk", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hi3518ev300/sdk_liteos" + ], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": {} + }, + { + "component": "hi3861_sdk", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hispark_pegasus/sdk_liteos" + ], + "targets": [ + "//device/hisilicon/hispark_pegasus/sdk_liteos:wifiiot_sdk" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3861v100" + ], + "adapted_kernel": [ "liteos_m" ], + "features": [], + "deps": { + "components": [ + "utils_base", + "liteos_m" + ] + } + }, + { + "component": "dvkit_sample", + "description": "", + "optional": "true", + "dirs": [ + "vendor/hisi/camera/dvkit_product/sample" + ], + "targets": [ + "//vendor/hisi/camera/dvkit_product/sample/ohos3518ev300:dvkit_hilink_media_sdk" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3518ev300", + "hi3518ev300_openharmony" + ], + "adapted_kernel": [ "liteos_a" ], + "features": [], + "deps": { + "third_party": [ + "iniparser", + "mbedtls" + ], + "kernel_special": {}, + "board_special": {}, + "components": [ + "liteos_a", + "permission" + ] + } + }, + { + "component": "hi3861_adapter", + "description": "", + "optional": "false", + "dirs": [ + "device/hisilicon/hispark_pegasus/hi3861_adapter/hals/utils/file", + "utils/native/lite/hals/file", + "base/iot_hardware/hals/wifiiot_lite", + "device/hisilicon/hispark_pegasus/hi3861_adapter/hals/iot_hardware/wifiiot_lite", + "base/update/ota_lite/hals", + "device/hisilicon/hispark_pegasus/hi3861_adapter/hals/update", + "foundation/communication/hals/wifi_lite/wifiaware", + "device/hisilicon/hispark_pegasus/hi3861_adapter/hals/communication/wifi_lite/wifiaware", + "foundation/communication/wifi_lite/interfaces/wifiservice", + "device/hisilicon/hispark_pegasus/hi3861_adapter/hals/communication/wifi_lite/wifiservice" + ], + "targets": [], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3861v100" + ], + "adapted_kernel": [ "liteos_m" ], + "features": [], + "deps": { + "components": [ + "hi3861_sdk" + ] + } + }, + { + "component": "oem_iotlink", + "description": "", + "optional": "false", + "dirs": [ + "vendor/huawei/wifi-iot/hals/utils", + "base/startup/syspara_lite/hals" + ], + "targets": [ + "//vendor/huawei/wifi-iot/hals/utils/sys_param:hal_sysparam", + "//vendor/huawei/wifi-iot/hals/utils/token:hal_token_static" + ], + "rom": "", + "ram": "", + "output": [], + "adapted_board": [ + "hi3861v100" + ], + "adapted_kernel": [ "liteos_m" ], + "features": [], + "deps": { + "components": [ + "liteos_m", + "hi3861_sdk", + "utils_base" + ] + } + } + ] +} diff --git a/config.ini b/config.ini deleted file mode 100755 index e6277b4..0000000 --- a/config.ini +++ /dev/null @@ -1,29 +0,0 @@ -[env] -build_path= -gn_path= -out_path= -gn_args= -gn_cmd=%(gn_path)s gen %(out_path)s --root=. --dotfile=build/lite/.gn --args='%(gn_args)s' -ninja_path= -ninja_cmd=%(ninja_path)s -w dupbuild=warn -C %(out_path)s -quickstart=https://device.harmonyos.com/cn/docs/start/introduce/oem_start_guide-0000001054913231 - -[gn_args] -product= -product_args=product = "%(product)s" -ndk_args=ohos_build_ndk = true -build_type= -build_type_args=ohos_build_type = "%(build_type)s" -test= -test_args=ohos_xts_test_args = "%(test)s" -compiler_path= -compiler_args=ohos_build_compiler_dir="%(compiler_path)s" -build_target= -build_target_args=ohos_build_target = "%(build_target)s" - -[ndk] -ndk_path= -clang_path= -gcc_path= -ninja_path= -gn_path= \ No newline at end of file diff --git a/config.py b/config.py deleted file mode 100755 index 09a3d4d..0000000 --- a/config.py +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import os -import distutils.spawn -from utils import exec_command -from utils import check_output -try: - # Python3 - from configparser import ConfigParser -except ImportError: - # Python2 - from ConfigParser import ConfigParser - - -class Config(): - def __init__(self, args): - self.product = args.product[0] - self.build_type = args.build_type[0] - self.build_target = args.target[0] - self.__set_path() - self.config = os.path.join(self.get_build_path(), 'config.ini') - self.log_path = os.path.join(self.get_out_path(), 'build.log') - self.cfg = ConfigParser() - self.cfg.read(self.config) - self.quickstart = self.cfg.get('env', 'quickstart') - self.args_list = [] - self.__test_cmd_check(args.test) - self.__ndk_check(args.ndk) - - def __set_path(self): - self.__root_path = os.getcwd() - self.__build_path = os.path.join(self.__root_path, 'build', 'lite') - if not os.path.exists(self.__build_path): - raise Exception('Error: {} not exist, please check.'.format( - self.__build_path)) - self.__out_path = os.path.join(self.__root_path, 'out', self.product) - - def get_root_path(self): - if self.__root_path is None: - raise Exception('Error: set root_path first.') - - return self.__root_path - - def get_build_path(self): - if self.__build_path is None: - raise Exception('Error: set build_path first.') - - return self.__build_path - - def get_out_path(self): - if self.__out_path is None: - raise Exception('Error: set out_path first.') - - return self.__out_path - - def get_cmd(self, gn_path, ninja_path): - if not os.path.exists(self.config): - raise Exception('Error: {} not exist, please check.'.format( - self.config)) - return self.__parse_compile_config(gn_path, ninja_path) - - def __parse_compile_config(self, gn_path, ninja_path): - self.cfg.set('env', 'build_path', self.get_build_path()) - self.cfg.set('env', 'out_path', self.get_out_path()) - self.cfg.set('env', 'gn_path', gn_path) - self.cfg.set('env', 'ninja_path', ninja_path) - self.cfg.set('env', 'gn_args', self.get_gn_args()) - return [self.cfg.get('env', 'gn_cmd'), - self.cfg.get('env', 'ninja_cmd')] - - def __test_cmd_check(self, test_args): - if test_args: - cmd_list = ['xts'] - if test_args[0] in cmd_list: - if len(test_args) > 1: - self.cfg.set('gn_args', 'test', test_args[1]) - self.args_list.append(self.cfg.get('gn_args', 'test_args')) - else: - raise Exception('Error: wrong input of test') - - def __ndk_check(self, ndk): - if ndk: - self.args_list.append(self.cfg.get('gn_args', 'ndk_args')) - - def get_gn_args(self): - self.cfg.set('gn_args', 'product', self.product) - self.cfg.set('gn_args', 'build_type', self.build_type) - self.cfg.set('gn_args', 'build_target', self.build_target) - self.args_list.append(self.cfg.get('gn_args', 'product_args')) - self.args_list.append(self.cfg.get('gn_args', 'build_type_args')) - self.args_list.append(self.cfg.get('gn_args', 'build_target_args')) - return " ".join(self.args_list) - - -class Compile(): - compiler_path = None - gn_path = None - ninja_path = None - sysroot_path = None - - def compile(self, config): - cmd_list = config.get_cmd(self.gn_path, self.ninja_path) - for cmd in cmd_list: - exec_command(cmd, log_path=config.log_path, shell=True) - - @classmethod - def get_tool_path(cls, config, json_content): - compiler = json_content['compiler'] - - if compiler == "clang": - compiler_bin = "clang" - elif compiler == "gcc": - compiler_bin = "riscv32-unknown-elf-gcc" - else: - raise Exception('Error: Unsupport compiler {}\nYou can visit {} ' - 'for more infomation'. - format(compiler, config.quickstart)) - - cls.compiler_path = distutils.spawn.find_executable(compiler_bin) - if cls.compiler_path is None: - compiler_cfg_path = config.cfg.get('ndk', '{}_path' - .format(compiler)) - if os.path.exists(compiler_cfg_path): - cls.compiler_path = os.path.abspath(compiler_cfg_path) - else: - raise Exception('Error: Can\'t find compiler {}, ' - 'install it please\nYou can visit {} for more ' - 'infomation'.format(compiler_bin, - config.quickstart)) - cls.check_compiler(compiler, config) - - cls.gn_path = distutils.spawn.find_executable('gn') - if cls.gn_path is None: - gn_cfg_path = config.cfg.get('ndk', 'gn_path') - if os.path.exists(gn_cfg_path): - cls.gn_path = gn_cfg_path - else: - raise Exception('Error: Can\'t find gn, install it please\n' - 'You can visit {} for more infomation'. - format(config.quickstart)) - - cls.ninja_path = distutils.spawn.find_executable('ninja') - if cls.ninja_path is None: - ninja_cfg_path = config.cfg.get('ndk', 'ninja_path') - if os.path.exists(ninja_cfg_path): - cls.ninja_path = ninja_cfg_path - else: - raise Exception('Error: Can\'t find ninja, install it please\n' - 'You can visit {} for more infomation'. - format(config.quickstart)) - - @classmethod - def check_compiler(cls, compiler, config): - cmd = [cls.compiler_path, '-v'] - ret = check_output(cmd) - - if compiler == 'gcc': - if 'gcc version 7.3.0 (GCC)' not in ret: - raise Exception('Error: {} is not OHOS compiler, please ' - 'install compiler\nYou can visit {} for more' - ' infomation'.format(cls.compiler_path, - config.quickstart)) - return True - - if 'OHOS' not in ret: - raise Exception('Error: {} is not OHOS compiler, please install' - ' compiler\nYou can visit {} for more infomation'. - format(cls.compiler_path, config.quickstart)) - - compiler_path = os.path.join(os.path.dirname(cls.compiler_path), - os.pardir) - config.cfg.set('gn_args', 'compiler_path', compiler_path) - config.args_list.append(config.cfg.get('gn_args', 'compiler_args')) - - hc_gen_path = distutils.spawn.find_executable('hc-gen') - if hc_gen_path is None: - raise Exception('Error: Can\'t find hc-gen, install it please\n' - 'You can visit {} for more infomation'. - format(config.quickstart)) - - return True diff --git a/config/BUILD.gn b/config/BUILD.gn index 53ea86b..9488643 100755 --- a/config/BUILD.gn +++ b/config/BUILD.gn @@ -1,209 +1,184 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -config("cpu_arch") { - cflags = [] - if (target_cpu == "cortex-a7") { - cflags += [ - "-march=armv7-a", - "-mfloat-abi=softfp" - ] - } else if (target_cpu == "riscv32") { - cflags += [ - "-mabi=ilp32", - "-march=rv32imc" - ] - } - asmflags = cflags - cflags_cc = cflags - ldflags = cflags -} - -config("language_c") { - cflags_c = [ - "-std=c99" - ] -} - -config("language_cpp") { - cflags_cc = [ - "-std=c++11" - ] -} - -config("kernel_macros") { - if (ohos_kernel_type == "liteos_a") { - defines = [ - "__LITEOS__", - "__LITEOS_A__", - ] - } else if (ohos_kernel_type == "liteos_m") { - defines = [ - "__LITEOS__", - "__LITEOS_M__" - ] - } else if (ohos_kernel_type == "linux") { - defines = [ "__LINUX__" ] - } -} - -config("werror") { - cflags = [ - "-Werror" - ] - cflags_cc = cflags -} - -config("common") { - defines = [ "_XOPEN_SOURCE=700" ] - cflags = [ - "-nostdlib", - "-fno-common", - "-fno-builtin", - "-fno-strict-aliasing", - ] - cflags_cc = cflags - ldflags = [ - "-lc" - ] - cflags += [ "-fsigned-char" ] -} - -config("security") { - defines = [ - "_FORTIFY_SOURCE=2" - ] - - cflags = [ - "-fstack-protector-all" - ] - cflags_cc = cflags - - ldflags = [ - "-Wl,-z,now", - "-Wl,-z,relro", - "-Wl,-z,noexecstack" - ] -} - -config("exceptions") { - cflags_cc = [ "-fexceptions" ] - cflags_objcc = cflags_cc -} - -config("no_exceptions") { - cflags_cc = [ "-fno-exceptions" ] - cflags_objcc = cflags_cc - ldflags = cflags_cc -} - -config("stack_protector") { - cflags = [ "-fstack-protector-all" ] - cflags_cc = cflags -} - -config("static_pie_config") { - cflags = [ "-fPIE" ] - cflags_cc = cflags -} - -config("shared_library_config") { - cflags = [ "-fPIC" ] - cflags_cc = cflags -} - -config("pie_executable_config") { - ldflags = [ "-pie" ] -} - -config("clang") { - include_dirs = [ - "${ohos_build_compiler_dir}/include/c++/v1", - "//prebuilts/lite/sysroot/usr/include/arm-liteos", - ] - - cflags = [ - "--target=arm-liteos", - "--sysroot=${ohos_root_path}prebuilts/lite/sysroot" - ] - cflags_cc = cflags - ldflags = cflags - - ldflags += [ - "-L${ohos_build_compiler_dir}/lib/arm-liteos/c++", - "-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/arm-liteos", - "-L${ohos_build_compiler_dir}/lib/clang/9.0.0/lib/arm-liteos", - "-lclang_rt.builtins", - "-lc++", - "-lc++abi" - ] -} - -config("release") { - defines = [ - "OHOS_RELEASE", - ] - cflags = [ - "-Oz", - "-flto" - ] - cflags_cc = cflags -} - -config("debug") { - defines = [ - "OHOS_DEBUG", - ] - cflags = [ - "-Oz", - "-flto" - ] - cflags_cc = cflags -} - -config("default_link_path") { - out_dir = rebase_path(root_build_dir) - ldflags = [ - "-L${out_dir}", - "-Wl,-rpath-link=${out_dir}" - ] -} - -config("liteos_a") { - configs = [ - ":common", - ":werror", - "kernel/liteos/cortex_a:default", - ":clang", - ":cpu_arch", - ":security", - ":exceptions", - ":default_link_path" - ] - - if (ohos_build_type == "release") { - configs += [ ":release" ] - } else if (ohos_build_type == "debug") { - configs += [ ":debug" ] - } -} - -config("liteos_m") { - configs = [ - ":common", - ":werror", - "kernel/liteos/cortex_m:riscv32", - ":cpu_arch", - ":default_link_path" - ] -} \ No newline at end of file +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config("cpu_arch") { + cflags = [] + if (board_arch != "") { + cflags += [ "-march=$board_arch" ] + } + if (board_cpu != "") { + cflags += [ "-mcpu=$board_cpu" ] + } + cflags_cc = cflags + ldflags = cflags +} + +config("language_c") { + cflags_c = [ "-std=c99" ] +} + +config("language_cpp") { + cflags_cc = [ "-std=c++11" ] +} + +config("kernel_macros") { + if (ohos_kernel_type == "liteos_a") { + defines = [ + "__LITEOS__", + "__LITEOS_A__", + ] + } else if (ohos_kernel_type == "liteos_m") { + defines = [ + "__LITEOS__", + "__LITEOS_M__", + ] + } else if (ohos_kernel_type == "linux") { + defines = [ "__LINUX__" ] + } +} + +config("werror") { + cflags = [ "-Werror" ] + cflags_cc = cflags +} + +config("common") { + defines = [ "_XOPEN_SOURCE=700" ] + cflags = [ + "-nostdlib", + "-fno-common", + "-fno-builtin", + "-fno-strict-aliasing", + "-Wall", + ] + cflags_cc = cflags + ldflags = [ "-lc" ] + cflags += [ "-fsigned-char" ] +} + +config("security") { + defines = [ "_FORTIFY_SOURCE=2" ] + + cflags = [ "-fstack-protector-all" ] + cflags_cc = cflags + + ldflags = [ + "-Wl,-z,now", + "-Wl,-z,relro", + "-Wl,-z,noexecstack", + ] +} + +config("exceptions") { + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +config("no_exceptions") { + cflags_cc = [ "-fno-exceptions" ] + cflags_objcc = cflags_cc + ldflags = cflags_cc +} + +config("stack_protector") { + cflags = [ "-fstack-protector-all" ] + cflags_cc = cflags +} + +config("static_pie_config") { + cflags = [ "-fPIE" ] + cflags_cc = cflags +} + +config("shared_library_config") { + cflags = [ "-fPIC" ] + cflags_cc = cflags +} + +config("pie_executable_config") { + ldflags = [ "-pie" ] +} + +config("clang") { + clang_dir = "" + if (ohos_build_compiler_dir != "") { + clang_dir = rebase_path("${ohos_build_compiler_dir}") + } + include_dirs = [ + "${clang_dir}/include/c++/v1", + "//prebuilts/lite/sysroot/usr/include/arm-liteos", + ] + + cflags = [ + "--target=arm-liteos", + "--sysroot=${ohos_root_path}prebuilts/lite/sysroot", + ] + cflags_cc = cflags + ldflags = cflags + + ldflags += [ + "-L${clang_dir}/lib/arm-liteos/c++", + "-L${ohos_root_path}prebuilts/lite/sysroot/usr/lib/arm-liteos", + "-L${clang_dir}/lib/clang/9.0.0/lib/arm-liteos", + "-lclang_rt.builtins", + "-lc", + "-lc++", + "-lc++abi", + "--sysroot=${ohos_root_path}prebuilts/lite/sysroot", + ] +} + +config("release") { + defines = [ "OHOS_RELEASE" ] +} + +config("debug") { + defines = [ "OHOS_DEBUG" ] +} + +config("clang_opt") { + cflags = [ + "-Oz", + "-flto", + ] + cflags_cc = cflags +} + +config("gcc_opt") { + cflags = [ "-Os" ] + cflags_cc = cflags +} + +config("default_link_path") { + out_dir = rebase_path(root_build_dir) + ldflags = [ + "-L${out_dir}", + "-Wl,-rpath-link=${out_dir}", + ] +} + +config("board_config") { + cflags = [] + cflags_cc = [] + ldflags = [] + include_dirs = [] + cflags += board_cflags + if (board_configed_sysroot != "") { + cflags += [ "--sysroot=${board_configed_sysroot}" ] + cflags_cc += [ "--sysroot=${board_configed_sysroot}" ] + ldflags += [ "--sysroot=${board_configed_sysroot}" ] + } + cflags_cc += board_cxx_flags + ldflags += board_ld_flags + include_dirs += board_include_dirs +} diff --git a/config/BUILDCONFIG.gn b/config/BUILDCONFIG.gn index fb3e306..e92638e 100755 --- a/config/BUILDCONFIG.gn +++ b/config/BUILDCONFIG.gn @@ -1,60 +1,131 @@ -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import("//build/lite/ohos_var.gni") -import("//build/lite/config/boards/${board_name}.gni") - -if (target_os == "") { - target_os = "ohos" -} - -if (target_cpu == "") { - target_cpu = board_cpu -} - -if(target_os == "ohos") { - if(ohos_kernel_type == "liteos_a") { - set_default_toolchain("//build/lite/toolchain:linux_x86_64_clang") - default_target_configs = [ "//build/lite/config:liteos_a" ] - } else if (ohos_kernel_type == "liteos_m") { - set_default_toolchain("//build/lite/toolchain:linux_x86_64_riscv32_gcc") - default_target_configs = [ "//build/lite/config:liteos_m" ] - } - default_target_configs += [ - "//build/lite/config:language_c", - "//build/lite/config:language_cpp", - "//build/lite/config:kernel_macros" - ] -} - -default_shared_library_configs = default_target_configs + [ "//build/lite/config:shared_library_config" ] -default_static_library_configs = default_target_configs + [ "//build/lite/config:static_pie_config" ] -default_executable_configs = default_static_library_configs + [ "//build/lite/config:pie_executable_config" ] - -set_defaults("executable") { - configs = default_executable_configs -} - -set_defaults("static_library") { - configs = default_static_library_configs -} - -set_defaults("shared_library") { - configs = default_shared_library_configs -} - -set_defaults("source_set") { - configs = default_target_configs -} +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/lite/ohos_var.gni") +import("${device_path}/config.gni") + +if (target_os == "") { + target_os = "ohos" +} + +if (target_cpu == "") { + target_cpu = board_cpu +} + +# Only gcc avaiable for liteos_m. +if (ohos_kernel_type == "liteos_m" || ohos_kernel_type == "linux") { + use_board_toolchain = true +} + +# Set current toolchain with to board configuration. +if (board_toolchain != "" && use_board_toolchain) { + ohos_current_toolchain = board_toolchain + ohos_current_toolchain_type = board_toolchain_type + ohos_build_compiler = ohos_current_toolchain_type + hos_build_compiler = ohos_current_toolchain_type + if (board_toolchain_path != "") { + compile_prefix = "${board_toolchain_path}/${board_toolchain_prefix}" + } else { + compile_prefix = "${board_toolchain_prefix}" + } + ohos_current_toolchain_prefix = compile_prefix + ohos_current_sysroot = board_configed_sysroot + set_default_toolchain("//build/lite/toolchain:${board_toolchain}") + if (board_toolchain_type == "gcc") { + ohos_current_cc_command = "${compile_prefix}gcc" + ohos_current_cxx_command = "${compile_prefix}g++" + ohos_current_ar_command = "${compile_prefix}ar" + ohos_current_ld_command = ohos_current_cc_command + ohos_current_strip_command = "${compile_prefix}strip --strip-unneeded" + default_target_configs = [ "//build/lite/config:gcc_opt" ] + } else if (board_toolchain_type == "clang") { + ohos_current_cc_command = "${compile_prefix}clang" + ohos_current_cxx_command = "${compile_prefix}clang++" + ohos_current_ar_command = "${compile_prefix}llvm-ar" + ohos_current_as_command = ohos_current_cc_command + ohos_current_ld_command = ohos_current_cc_command + ohos_current_strip_command = "$compile_prefix/llvm-objcopy --strip-all" + default_target_configs = [ "//build/lite/config:clang" ] + default_target_configs += [ "//build/lite/config:clang_opt" ] + } +} else { + # OHOS default toolchain: ohos_clang + ohos_current_toolchain = "ohos_clang" + ohos_build_compiler = "clang" + hos_build_compiler = "clang" + ohos_clang_toolchain_dir = rebase_path("${ohos_build_compiler_dir}/bin") + compile_prefix = rebase_path("${ohos_build_compiler_dir}/bin") + ohos_current_cc_command = "${compile_prefix}/clang" + ohos_current_cxx_command = "${compile_prefix}/clang++" + ohos_current_ar_command = "${compile_prefix}/llvm-ar" + ohos_current_as_command = ohos_current_cc_command + ohos_current_ld_command = ohos_current_cc_command + ohos_build_strip_command = + "$ohos_clang_toolchain_dir/llvm-objcopy --strip-all" + set_default_toolchain("//build/lite/toolchain:linux_x86_64_ohos_clang") + default_target_configs = [ "//build/lite/config:clang" ] + default_target_configs += [ "//build/lite/config:clang_opt" ] +} + +default_target_configs += [ + "//build/lite/config:board_config", + "//build/lite/config:cpu_arch", + "//build/lite/config:common", + "//build/lite/config:default_link_path", +] + +if (ohos_build_type == "debug") { + default_target_configs += [ "//build/lite/config:debug" ] +} else if (ohos_build_type == "release") { + default_target_configs += [ "//build/lite/config:release" ] +} + +if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + default_target_configs += [ + "//build/lite/config/kernel/liteos/cortex_a:default", + "//build/lite/config:security", + "//build/lite/config:exceptions", + ] +} else if (ohos_kernel_type == "liteos_m") { + default_target_configs += [ "//build/lite/config:stack_protector" ] +} + +default_target_configs += [ + "//build/lite/config:language_c", + "//build/lite/config:language_cpp", + "//build/lite/config:kernel_macros", +] + +default_shared_library_configs = + default_target_configs + [ "//build/lite/config:shared_library_config" ] +default_static_library_configs = default_target_configs +if (ohos_kernel_type != "liteos_m") { + default_static_library_configs += [ "//build/lite/config:static_pie_config" ] +} +default_executable_configs = default_static_library_configs + + [ "//build/lite/config:pie_executable_config" ] + +set_defaults("executable") { + configs = default_executable_configs +} + +set_defaults("static_library") { + configs = default_static_library_configs +} + +set_defaults("shared_library") { + configs = default_shared_library_configs +} + +set_defaults("source_set") { + configs = default_target_configs +} diff --git a/config/component/cJSON/BUILD.gn b/config/component/cJSON/BUILD.gn new file mode 100755 index 0000000..e0f8e6c --- /dev/null +++ b/config/component/cJSON/BUILD.gn @@ -0,0 +1,52 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import("//build/lite/config/component/lite_component.gni") +import("//build/lite/ndk/ndk.gni") + +config("cjson_config") { + include_dirs = [ "//third_party/cJSON" ] + ldflags = [ "-lm" ] +} + +cjson_sources = [ + "//third_party/cJSON/cJSON.c", + "//third_party/cJSON/cJSON_Utils.c", +] + +lite_library("cjson_static") { + target_type = "static_library" + sources = cjson_sources + public_configs = [ ":cjson_config" ] +} + +lite_library("cjson_shared") { + target_type = "shared_library" + sources = cjson_sources + public_configs = [ ":cjson_config" ] +} + +ndk_lib("cjson_ndk") { + if (board_name != "hispark_pegasus") { + lib_extension = ".so" + deps = [ ":cjson_shared" ] + } else { + deps = [ ":cjson_static" ] + } + head_files = [ + "//third_party/cJSON/cJSON.h", + "//third_party/cJSON/cJSON_Utils.h", + ] +} diff --git a/config/component/lite_component.gni b/config/component/lite_component.gni index cb7981c..3b9a2eb 100755 --- a/config/component/lite_component.gni +++ b/config/component/lite_component.gni @@ -11,53 +11,55 @@ # See the License for the specific language governing permissions and # limitations under the License. -template("lite_library") { - assert(defined(invoker.target_type), "Library target_type is required.") - assert(defined(invoker.sources), "Library sources is required.") - target_type = invoker.target_type - shared_lib = (target_type == "shared_library") +import("//build/lite/config/subsystem/aafwk/path.gni") - if (shared_lib && ohos_kernel_type == "liteos_m") { - group(target_name) { - if(defined(invoker.sources)) { - assert(invoker.sources != "") - } - if(defined(invoker.public_configs)) { - assert(invoker.public_configs != "") - } - if(defined(invoker.public_deps)) { - assert(invoker.public_deps != "") - } - if(defined(invoker.output_name)) { - assert(invoker.output_name!= "") - } - } - } else { - target(target_type, target_name) { - forward_variables_from(invoker, "*") - cflags = [] - cflags_cc = [] - ldflags = [] - if (defined(invoker.cflags)) { - cflags += invoker.cflags - } - if (defined(invoker.cflags_cc)) { - cflags_cc += invoker.cflags_cc - ldflags += ["-lstdc++"] - } - if (defined(invoker.ldflags)) { - ldflags += invoker.ldflags - } - shared_lib = (target_type == "shared_library") - if(shared_lib) { - cflags += [ "-fPIC" ] - cflags_cc += [ "-fPIC" ] - } else { - cflags += [ "-fPIE" ] - cflags_cc += [ "-fPIE" ] - } - } +template("lite_library") { + assert(defined(invoker.target_type), "Library target_type is required.") + assert(defined(invoker.sources), "Library sources is required.") + target_type = invoker.target_type + shared_lib = target_type == "shared_library" + + if (shared_lib && ohos_kernel_type == "liteos_m") { + group(target_name) { + if (defined(invoker.sources)) { + assert(invoker.sources != "") + } + if (defined(invoker.public_configs)) { + assert(invoker.public_configs != "") + } + if (defined(invoker.public_deps)) { + assert(invoker.public_deps != "") + } + if (defined(invoker.output_name)) { + assert(invoker.output_name != "") + } } + } else { + target(target_type, target_name) { + forward_variables_from(invoker, "*") + cflags = [] + cflags_cc = [] + ldflags = [] + if (defined(invoker.cflags)) { + cflags += invoker.cflags + } + if (defined(invoker.cflags_cc)) { + cflags_cc += invoker.cflags_cc + ldflags += [ "-lstdc++" ] + } + if (defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + shared_lib = target_type == "shared_library" + if (shared_lib) { + cflags += [ "-fPIC" ] + cflags_cc += [ "-fPIC" ] + } else { + cflags += [ "-fPIE" ] + cflags_cc += [ "-fPIE" ] + } + } + } } # Defines a component @@ -69,112 +71,114 @@ template("lite_library") { # component_features (required) # [list of scopes] Defines all features in the component. template("lite_component") { - assert(defined(invoker.features), "Component features is required.") + assert(defined(invoker.features), "Component features is required.") - forward_variables_from(invoker, "*") + forward_variables_from(invoker, "*") - if (!defined(invoker.target_type)) { - target_type = "group" - } else if (invoker.target_type == "static_library") { - target_type = "group" - } else { - target_type = invoker.target_type + if (!defined(invoker.target_type)) { + target_type = "group" + } else if (invoker.target_type == "static_library") { + target_type = "group" + } else { + target_type = invoker.target_type + } + assert(target_type != "") + + target(target_type, target_name) { + deps = [] + + # add component deps + if (defined(invoker.deps)) { + deps += invoker.deps } - assert(target_type != "") - target(target_type, target_name) { - deps = [] - # add component deps - if(defined(invoker.deps)) { - deps += invoker.deps - } - # add component features - foreach(feature_label, features) { - deps += [ feature_label ] - } + # add component features + foreach(feature_label, features) { + deps += [ feature_label ] } + } } -template("build_ext_component") -{ - if(defined(invoker.version)) { - print(invoker.version) +template("build_ext_component") { + if (defined(invoker.version)) { + print(invoker.version) + } + action(target_name) { + deps = [] + if (defined(invoker.deps)) { + deps += invoker.deps } - action(target_name){ - deps = [] - if(defined(invoker.deps)) { - deps += invoker.deps - } - args = [] - if(defined(invoker.exec_path)) { - args += [ - "--path=${invoker.exec_path}" - ] - } - if(defined(invoker.enable)) { - args += [ - "--enable=${invoker.enable}" - ] - } - if(defined(invoker.prebuilts)) { - args += [ - "--prebuilts=${invoker.prebuilts}" - ] - } - if(defined(invoker.command)) { - args += [ - "--command=${invoker.command}" - ] - } - script = "//build/lite/build_ext_components.py" - outputs = [ "$target_out_dir/${target_name}_build_ext_components.txt" ] + args = [] + if (defined(invoker.exec_path)) { + args += [ "--path=${invoker.exec_path}" ] } + if (defined(invoker.enable)) { + args += [ "--enable=${invoker.enable}" ] + } + if (defined(invoker.prebuilts)) { + args += [ "--prebuilts=${invoker.prebuilts}" ] + } + if (defined(invoker.command)) { + args += [ "--command=${invoker.command}" ] + } + + # external component build log + target_dir = rebase_path("${target_out_dir}/build.log") + args += [ "--target_dir=${target_dir}" ] + + # external component error log if compile failed + out_dir = rebase_path("${root_out_dir}/error.log") + args += [ "--out_dir=${out_dir}" ] + script = "//build/lite/build_ext_components.py" + outputs = [ "$target_out_dir/${target_name}_build_ext_components.txt" ] + } } template("ohos_tools") { - target(invoker.target_type, target_name) { - forward_variables_from(invoker, "*") - output_dir = "$root_out_dir/tools/$target_name" - if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { - configs -= [ "//build/lite/config:ohos" ] - } else if (ohos_kernel_type == "liteos_m") { - configs -= [ "//build/lite/config:liteos" ] - } - configs -= [ "//build/lite/config:pie_executable_config" ] - configs -= [ "//build/lite/config:static_pie_config" ] - configs += [ "//build/lite/config:tools" ] + target(invoker.target_type, target_name) { + forward_variables_from(invoker, "*") + output_dir = "$root_out_dir/tools/$target_name" + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + configs -= [ "//build/lite/config:ohos" ] + } else if (ohos_kernel_type == "liteos_m") { + configs -= [ "//build/lite/config:liteos" ] } + configs -= [ "//build/lite/config:pie_executable_config" ] + configs -= [ "//build/lite/config:static_pie_config" ] + configs += [ "//build/lite/config:tools" ] + } } template("generate_notice_file") { - assert(defined(invoker.module_name), "module_name in required.") - assert(defined(invoker.module_source_dir_list), "module_source_dir_list in required.") - assert(target_name != "") - forward_variables_from(invoker, - [ - "module_name", - "module_source_dir_list", - ]) - gen_script = rebase_path("//build/lite/gen_module_notice_file.py") + assert(defined(invoker.module_name), "module_name in required.") + assert(defined(invoker.module_source_dir_list), + "module_source_dir_list in required.") + assert(target_name != "") + forward_variables_from(invoker, + [ + "module_name", + "module_source_dir_list", + ]) + gen_script = rebase_path("//build/lite/gen_module_notice_file.py") - foreach(module_source_dir, module_source_dir_list) { - arguments = [] - arguments = [ - "--root-out-dir", - rebase_path(root_out_dir), - "--module-source-dir", - rebase_path(module_source_dir), - "--module-relative-source-dir", - rebase_path(module_source_dir, "//"), - "--target-name", - module_name, - ] - ret_msg = "" - ret_msg = exec_script(gen_script, arguments, "list lines") - if (ret_msg != "") { - foreach(msg, ret_msg) { - print(msg) - } - } + foreach(module_source_dir, module_source_dir_list) { + arguments = [] + arguments = [ + "--root-out-dir", + rebase_path(root_out_dir), + "--module-source-dir", + rebase_path(module_source_dir), + "--module-relative-source-dir", + rebase_path(module_source_dir, "//"), + "--target-name", + module_name, + ] + ret_msg = "" + ret_msg = exec_script(gen_script, arguments, "list lines") + if (ret_msg != "") { + foreach(msg, ret_msg) { + print(msg) + } } + } } diff --git a/config/component/openssl/BUILD.gn b/config/component/openssl/BUILD.gn new file mode 100755 index 0000000..6ebb430 --- /dev/null +++ b/config/component/openssl/BUILD.gn @@ -0,0 +1,52 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import("//build/lite/config/component/lite_component.gni") + +config("openssl_config") { + include_dirs = [ + "//third_party/openssl/include", + "//third_party/openssl/crypto/include", + "//third_party/openssl/crypto/ec", + "//third_party/openssl" + ] + + cflags = [ + "-fPIC", + ] +} + +openssl_source = [ + "//third_party/openssl/crypto/cryptlib.c", + "//third_party/openssl/crypto/ec/curve25519.c", + "//third_party/openssl/crypto/mem_clr.c", + "//third_party/openssl/crypto/sha/sha512.c", +] + +lite_library("openssl_shared") { + target_type = "shared_library" + sources = openssl_source + public_configs = [ + ":openssl_config" + ] +} + +lite_library("openssl_static") { + target_type = "static_library" + sources = openssl_source + public_configs = [ + ":openssl_config" + ] +} diff --git a/config/component/zlib/BUILD.gn b/config/component/zlib/BUILD.gn new file mode 100755 index 0000000..3b88fe5 --- /dev/null +++ b/config/component/zlib/BUILD.gn @@ -0,0 +1,72 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import("//build/lite/config/component/lite_component.gni") + +config("zlib_config") { + include_dirs = [ + "//third_party/zlib", + ] +} + +zlib_source = [ + "//third_party/zlib/adler32.c", + "//third_party/zlib/compress.c", + "//third_party/zlib/crc32.c", + "//third_party/zlib/crc32.h", + "//third_party/zlib/deflate.c", + "//third_party/zlib/deflate.h", + "//third_party/zlib/gzclose.c", + "//third_party/zlib/gzguts.h", + "//third_party/zlib/gzlib.c", + "//third_party/zlib/gzread.c", + "//third_party/zlib/gzwrite.c", + "//third_party/zlib/infback.c", + "//third_party/zlib/inffast.c", + "//third_party/zlib/inffast.h", + "//third_party/zlib/inffixed.h", + "//third_party/zlib/inflate.h", + "//third_party/zlib/inflate.c", + "//third_party/zlib/inftrees.c", + "//third_party/zlib/inftrees.h", + "//third_party/zlib/trees.c", + "//third_party/zlib/trees.h", + "//third_party/zlib/uncompr.c", + "//third_party/zlib/zconf.h", + "//third_party/zlib/zlib.h", + "//third_party/zlib/zutil.c", + "//third_party/zlib/zutil.h", + "//third_party/zlib/contrib/minizip/ioapi.c", + "//third_party/zlib/contrib/minizip/unzip.c", + "//third_party/zlib/contrib/minizip/zip.c", +] + +lite_library("zlib_shared") { + target_type = "shared_library" + sources = zlib_source + + public_configs = [ + ":zlib_config", + ] +} + +lite_library("zlib_static") { + target_type = "static_library" + sources = zlib_source + + public_configs = [ + ":zlib_config", + ] +} diff --git a/config/hap_pack.gni b/config/hap_pack.gni index b3fb168..de5b30d 100755 --- a/config/hap_pack.gni +++ b/config/hap_pack.gni @@ -1,118 +1,142 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -declare_args() { - hapsigner = "developtools/hapsigntoolv2.jar" - packtool = "developtools/hmos_app_packing_tool.jar" - jks_file = "//base/security/frameworks/app_verify/OpenHarmonyCer/OpenHarmony.jks" - cert_file = "//base/security/frameworks/app_verify/OpenHarmonyCer/OpenHarmony.cer" - default_hap_signature_algorithm = "SHA256withECDSA" - privatekey = "OpenHarmony Software Signature" - keystorepasswd = "123456" -} - -template("hap_pack") { - assert(defined(invoker.cert_profile), "cert_profile in required.") - assert(defined(invoker.hap_name), "hap_name in required.") - unsignhap_path = "$root_out_dir/system/internal/unsigned_${invoker.hap_name}.hap" - signhap_path = "$root_out_dir/system/internal/${invoker.hap_name}.hap" - - action(target_name){ - if (defined(invoker.deps)) { - deps = [] - deps += invoker.deps - } - script = "//build/lite/hap_pack.py" - args = [ - "--packing-tool-path", - packtool - ] - if (defined(invoker.mode)) { - args += [ - "--mode", - invoker.mode - ] - } - if (defined(invoker.json_path)) { - args += [ - "--json-path", - rebase_path(invoker.json_path) - ] - } - if (defined(invoker.resources_path)) { - args += [ - "--resources-path", - rebase_path(invoker.resources_path) - ] - } - if (defined(invoker.assets_path)) { - args += [ - "--assets-path", - rebase_path(invoker.assets_path) - ] - } - if (defined(invoker.lib_path)) { - args += [ - "--lib-path", - rebase_path(invoker.lib_path) - ] - } - if (defined(invoker.shared_libs_path)) { - args += [ - "--shared-libs-path", - rebase_path(invoker.shared_libs_path) - ] - } - if (defined(invoker.ability_so_path)) { - args += [ - "--ability-so-path", - rebase_path(invoker.ability_so_path) - ] - } - if (defined(invoker.index_path)) { - args += [ - "--index-path", - rebase_path(invoker.index_path) - ] - } - if (defined(invoker.force)) { - args += [ - "--force", - invoker.force - ] - } - args += [ - "--signtool-path", - hapsigner, - "--privatekey", - privatekey, - "--sign-algo", - default_hap_signature_algorithm, - "--unsignhap-path", - rebase_path(unsignhap_path), - "--signhap-path", - rebase_path(signhap_path), - "--jks-path", - rebase_path(jks_file), - "--cert-path", - rebase_path(cert_file), - ] - if (defined(invoker.cert_profile)) { - args += [ - "--cert-profile", - rebase_path(invoker.cert_profile) - ] - } - outputs = [ "$target_out_dir/${target_name}_build_log.txt" ] - } -} +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/subsystem/aafwk/path.gni") + +declare_args() { + ohos_sign_haps_by_server = false + hapsigner = "//prebuilts/signcenter/hapsigntool/hapsigntoolv2.jar" + packtool = "//developtools/packing_tool/jar/hmos_app_packing_tool.jar" + jks_file = "//base/security/appverify/interfaces/innerkits/appverify_lite/OpenHarmonyCer/OpenHarmony.jks" + cert_file = "//base/security/appverify/interfaces/innerkits/appverify_lite/OpenHarmonyCer/OpenHarmony.cer" + default_hap_signature_algorithm = "SHA256withECDSA" + sign_server = "rnd-signserver.huawei.com" + privatekey = "OpenHarmony Software Signature" + keystorepasswd = "123456" +} + +template("hap_pack") { + assert(defined(invoker.cert_profile), "cert_profile in required.") + assert(defined(invoker.hap_name), "hap_name in required.") + assert(defined(invoker.privatekey), "privatekey in required.") + + if(ohos_sign_haps_by_server == false) { + invoker.privatekey = "OpenHarmony Software Signature" + } + + unsignhap_path = + "$root_out_dir/system/internal/unsigned_${invoker.hap_name}.hap" + signhap_path = "$root_out_dir/system/internal/${invoker.hap_name}.hap" + + action(target_name) { + if (defined(invoker.deps)) { + deps = [] + deps += invoker.deps + } + script = "//build/lite/hap_pack.py" + args = [ + "--packing-tool-path", + rebase_path(packtool), + ] + if (defined(invoker.mode)) { + args += [ + "--mode", + invoker.mode, + ] + } + if (defined(invoker.json_path)) { + args += [ + "--json-path", + rebase_path(invoker.json_path), + ] + } + if (defined(invoker.resources_path)) { + args += [ + "--resources-path", + rebase_path(invoker.resources_path), + ] + } + if (defined(invoker.assets_path)) { + args += [ + "--assets-path", + rebase_path(invoker.assets_path), + ] + } + if (defined(invoker.lib_path)) { + args += [ + "--lib-path", + rebase_path(invoker.lib_path), + ] + } + if (defined(invoker.shared_libs_path)) { + args += [ + "--shared-libs-path", + rebase_path(invoker.shared_libs_path), + ] + } + if (defined(invoker.ability_so_path)) { + args += [ + "--ability-so-path", + rebase_path(invoker.ability_so_path), + ] + } + if (defined(invoker.index_path)) { + args += [ + "--index-path", + rebase_path(invoker.index_path), + ] + } + if (defined(invoker.force)) { + args += [ + "--force", + invoker.force, + ] + } + args += [ + "--signtool-path", + rebase_path(hapsigner), + "--privatekey", + invoker.privatekey, + "--sign-algo", + default_hap_signature_algorithm, + "--unsignhap-path", + rebase_path(unsignhap_path), + "--signhap-path", + rebase_path(signhap_path), + "--sign-server", + sign_server, + "--jks-path", + rebase_path(jks_file), + "--cert-path", + rebase_path(cert_file), + ] + if (ohos_sign_haps_by_server) { + args += [ + "--sign-by-server", + "True", + ] + } else { + args += [ + "--sign-by-server", + "False", + ] + } + if (defined(invoker.cert_profile)) { + args += [ + "--cert-profile", + rebase_path(invoker.cert_profile), + ] + } + outputs = [ "$target_out_dir/${target_name}_build_log.txt" ] + } +} diff --git a/config/kernel/liteos/cortex_m/BUILD.gn b/config/kernel/liteos/cortex_m/BUILD.gn deleted file mode 100755 index 3d8e23d..0000000 --- a/config/kernel/liteos/cortex_m/BUILD.gn +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -config("riscv32") { - defines = [] - cflags = [] - include_dirs = [] - - defines = [ - "LOS_COMPILE_LDM", - "PRODUCT_USR_SOFT_VER_STR=\"None\"", - "CYGPKG_POSIX_SIGNALS", - "__ECOS__", - "__RTOS_", - "PRODUCT_CFG_HAVE_FEATURE_SYS_ERR_INFO", - "__LITEOS__", - "LIB_CONFIGURABLE", - "LOSCFG_SHELL", - "LOSCFG_CACHE_STATICS", - "CUSTOM_AT_COMMAND", - "LOS_COMPILE_LDM", - "LOS_CONFIG_IPERF3", - "CMSIS_OS_VER=2", - "SECUREC_ENABLE_SCANF_FILE=0", - "CONFIG_AT_COMMAND", - "PRODUCT_CFG_CHIP_VER_STR=\"Hi3861V100\"", - "CHIP_VER_Hi3861", - "PRODUCT_CFG_SOFT_VER_STR=\"Hi3861\"", - "HI_BOARD_ASIC", - "HI_ON_FLASH", - "LITEOS_WIFI_IOT_VERSION", - ] - - cflags = [ - "-falign-functions=2", - "-msave-restore", - "-fno-optimize-strlen", - "-freorder-blocks-algorithm=simple", - "-fno-schedule-insns", - "-fno-inline-small-functions", - "-fno-inline-functions-called-once", - "-mtune=size", - "-mno-small-data-limit=0", - "-fno-aggressive-loop-optimizations", - "-std=c99", - "-Wpointer-arith", - "-Wstrict-prototypes", - "-fstack-protector-all", - "-Os", - "-ffunction-sections", - "-fdata-sections", - "-fno-exceptions", - "-fno-short-enums", - "-Wextra", - "-Wall", - "-Wundef", - "-U", - "PRODUCT_CFG_BUILD_TIME", - ] - - include_dirs += [ - "//vendor/hisi/hi3861/hi3861/include", - "//vendor/hisi/hi3861/hi3861/platform/include", - "//vendor/hisi/hi3861/hi3861/platform/system/include", - "//vendor/hisi/hi3861/hi3861/config", - "//vendor/hisi/hi3861/hi3861/config/nv", - "//utils/native/lite/include", - "//vendor/hisi/hi3861/hi3861_adapter/kal/cmsis", - "//vendor/hisi/hi3861/hi3861_adapter/kal/posix/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/base/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/arch/risc-v/rv32im", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libm/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libsec/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/net/wpa_supplicant-2.7/src/common", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/plat/riscv", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/kernel/extended/runstop", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/posix/include", - "//vendor/hisi/hi3861/hi3861/third_party/lwip_sack/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/musl/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/generic", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/musl/arch/riscv32", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/hw/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/nuttx/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libsec/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/config", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/user", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/plat", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/targets/hi3861v100/extend/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/arch", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/components/lib/libc/bionic/libm", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/shell/include", - "//vendor/hisi/hi3861/hi3861/platform/os/Huawei_LiteOS/net/telnet/include", - ] -} diff --git a/config/subsystem/aafwk/BUILD.gn b/config/subsystem/aafwk/BUILD.gn new file mode 100755 index 0000000..a852f1d --- /dev/null +++ b/config/subsystem/aafwk/BUILD.gn @@ -0,0 +1,24 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import("//build/lite/config/subsystem/lite_subsystem.gni") + +lite_subsystem("aafwk") { + subsystem_components = [ + "${aafwk_lite_path}/frameworks/ability_lite:aafwk_abilitykit_lite", + "${aafwk_lite_path}/frameworks/abilitymgr_lite:aafwk_abilityManager_lite", + "${aafwk_lite_path}/services/abilitymgr_lite:aafwk_services_lite", + ] +} diff --git a/config/subsystem/aafwk/config.gni b/config/subsystem/aafwk/config.gni index 1f80e6f..50b9987 100755 --- a/config/subsystem/aafwk/config.gni +++ b/config/subsystem/aafwk/config.gni @@ -13,7 +13,9 @@ # limitations under the License. # +import("//build/lite/config/subsystem/aafwk/path.gni") + declare_args() { - # build feature ability, dependent window - enable_ohos_appexecfwk_feature_ability = true + # build feature ability, dependent window + enable_ohos_appexecfwk_feature_ability = true } diff --git a/config/subsystem/aafwk/path.gni b/config/subsystem/aafwk/path.gni new file mode 100755 index 0000000..129d956 --- /dev/null +++ b/config/subsystem/aafwk/path.gni @@ -0,0 +1,19 @@ +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +declare_args() { + aafwk_lite_path = "//foundation/aafwk/aafwk_lite" + appexecfwk_lite_path = "//foundation/appexecfwk/appexecfwk_lite" +} diff --git a/config/subsystem/graphic/config.gni b/config/subsystem/graphic/config.gni new file mode 100755 index 0000000..9a49f45 --- /dev/null +++ b/config/subsystem/graphic/config.gni @@ -0,0 +1,19 @@ +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +declare_args() { + enable_graphic_font = false + enable_graphic_dualcore = false +} diff --git a/config/subsystem/hiviewdfx/BUILD.gn b/config/subsystem/hiviewdfx/BUILD.gn new file mode 100755 index 0000000..bcf1890 --- /dev/null +++ b/config/subsystem/hiviewdfx/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/component/lite_component.gni") +import("//build/lite/config/subsystem/lite_subsystem.gni") + +group("hilog_ndk") { + if (ohos_kernel_type == "liteos_m") { + deps = [ "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite_ndk" ] + } else { + deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_ndk" ] + } +} + +generate_notice_file("hiviewdfx_notice_file") { + module_name = "hiviewdfx" + module_source_dir_list = [ + "//third_party/bounds_checking_function", + "//third_party/musl", + "//third_party/cJSON", + "//third_party/zlib", + "//third_party/mbedtls", + ] +} diff --git a/config/test.gni b/config/test.gni index e477b2e..30d9641 100755 --- a/config/test.gni +++ b/config/test.gni @@ -1,102 +1,221 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# liteos c test template - -test_common_include_dirs = [ - "//third_party/googletest/googletest/include", -] - -test_liteos_include_dirs = [ - "//utils/native/lite/include", - "//drivers/liteos/platform/board/hisi/common", - "//kernel/liteos_a/kernel/include", - "//third_party/bounds_checking_function/include", -] - -template("unittest") { - executable(target_name) { - output_dir = "${root_out_dir}/test/unittest" - forward_variables_from(invoker,"*") - if (!defined(include_dirs)) { - include_dirs = [] - } - include_dirs += test_common_include_dirs - if (ohos_kernel_type == "liteos_a") { - include_dirs += test_liteos_include_dirs - } - if (!defined(deps)) { - deps = [] - } - if (ohos_kernel_type == "liteos_a") { - deps += [ - "//test/developertest/third_party/lib/cpp:gtest_main", - ] - } - if (!defined(configs)) { - configs = [] - } - cflags = [ "-Wno-error" ] - ldflags = [] - if(defined(invoker.ldflags)) { - ldflags += invoker.ldflags - } - if (ohos_build_compiler != "clang") { - ldflags += [ "-lstdc++" ] - } - } -} - -template("moduletest") { - executable(target_name) { - output_dir = "${root_out_dir}/test/moduletest" - forward_variables_from(invoker, "*") - if (!defined(include_dirs)) { - include_dirs = [] - } - include_dirs += test_common_include_dirs - if (ohos_kernel_type == "liteos_a") { - include_dirs += test_liteos_include_dirs - } - if (!defined(deps)) { - deps = [] - } - if (ohos_kernel_type == "liteos_a") { - deps += [ - "//test/developertest/third_party/lib/cpp:gtest_main", - ] - } - if (!defined(configs)) { - configs = [] - } - cflags = [ "-Wno-error" ] - ldflags = [] - if(defined(invoker.ldflags)) { - ldflags += invoker.ldflags - } - if (ohos_build_compiler != "clang") { - ldflags += [ "-lstdc++" ] - } - } -} - -template("subsystem_test") { - assert(defined(invoker.test_components), "Test Components is required.") - group(target_name) { - deps = [] - if(defined(invoker.test_components)) { - deps += invoker.test_components - } - } -} +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/subsystem/aafwk/path.gni") + +# liteos c test template + +test_common_include_dirs = [ "//third_party/googletest/googletest/include" ] + +test_include_dirs = [ + "//utils/native/lite/include", + "//kernel/liteos_a/kernel/include", + "//third_party/bounds_checking_function/include", +] + +archive_dir_name = "test_info" +template("unittest") { + _output_dir = "" + if (defined(invoker.output_extension)) { + output_extension = invoker.output_extension + } + if (defined(invoker.output_dir)) { + _output_dir = invoker.output_dir + } else { + _output_dir = "${root_out_dir}/${archive_dir_name}/unittest" + } + + # generate module list file in gn stage + # format like: unittest("componentName_test_xx") + list_tmp = string_split(target_name, "_test") + _part_name = list_tmp[0] + _module_list_file = string_join("", + [ + root_out_dir, + "/${archive_dir_name}/module_list_files/", + _part_name, + "/", + _part_name, + "/", + target_name, + ".mlf", + ]) + _sources_file_search_root_dir = string_join("", + [ + root_out_dir, + "/${archive_dir_name}/gen", + ]) + _sources = "" + foreach(s, invoker.sources) { + _sources += s + "," + } + _arguments = [ + "--target", + target_name, + "--target_label", + get_label_info(target_name, "label_with_toolchain"), + "--source_dir", + rebase_path(get_label_info(target_name, "dir"), root_out_dir), + "--test_type", + "unittest", + "--output_dir", + rebase_path(_output_dir), + "--module_list_file", + rebase_path(_module_list_file), + "--sources_file_search_root_dir", + rebase_path(_sources_file_search_root_dir), + "--sources", + _sources, + ] + _gen_module_list_script = "//build/lite/testfwk/gen_module_list_files.py" + exec_script(_gen_module_list_script, _arguments) + + executable(target_name) { + if (defined(invoker.output_dir)) { + output_dir = invoker.output_dir + } + if (defined(invoker.sources)) { + sources = invoker.sources + } + if (defined(invoker.include_dirs)) { + include_dirs = invoker.include_dirs + } else { + include_dirs = [] + } + include_dirs += test_common_include_dirs + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + include_dirs += test_include_dirs + } + if (defined(invoker.deps)) { + deps = invoker.deps + } else { + deps = [] + } + if (defined(invoker.public_deps)) { + public_deps = invoker.public_deps + } + if (defined(invoker.defines)) { + defines = invoker.defines + } + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + deps += [ "//test/developertest/third_party/lib/cpp:gtest_main" ] + } + if (defined(invoker.configs)) { + configs += invoker.configs + } + cflags = [ "-Wno-error" ] + if (defined(invoker.cflags)) { + cflags += invoker.cflags + } + ldflags = [] + if (defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + if (ohos_current_toolchain_type != "clang") { + ldflags += [ "-lstdc++" ] + } + if (ohos_kernel_type == "linux") { + ldflags += [ + "-lm", + "-pthread", + ] + } + } +} + +template("moduletest") { + executable(target_name) { + output_dir = "${root_out_dir}/test/moduletest" + forward_variables_from(invoker, "*") + if (!defined(include_dirs)) { + include_dirs = [] + } + include_dirs += test_common_include_dirs + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + include_dirs += test_include_dirs + } + if (!defined(deps)) { + deps = [] + } + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { + deps += [ "//test/developertest/third_party/lib/cpp:gtest_main" ] + } + if (!defined(configs)) { + configs = [] + } + cflags = [ "-Wno-error" ] + ldflags = [] + if (defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + if (ohos_current_toolchain_type != "clang") { + ldflags += [ "-lstdc++" ] + } + if (ohos_kernel_type == "linux") { + ldflags += [ + "-lm", + "-pthread", + ] + } + } +} + +template("subsystem_test") { + assert(defined(invoker.test_components), "Test Components is required.") + group(target_name) { + deps = [] + if (defined(invoker.test_components)) { + deps += invoker.test_components + } + } +} + +template("fuzztest") { + executable(target_name) { + output_dir = "${root_out_dir}/test/fuzztest" + forward_variables_from(invoker, "*") + if (!defined(include_dirs)) { + include_dirs = [] + } + include_dirs += test_common_include_dirs + include_dirs += [ + "//test/tools/Secodefuzz/", + "//test/tools/Secodefuzz/common", + ] + if (ohos_kernel_type == "liteos_a") { + include_dirs += test_include_dirs + } + if (!defined(deps)) { + deps = [] + } + if (ohos_kernel_type == "liteos_a") { + deps += [ + "//test/developertest/third_party/lib/cpp:gtest_main", + "//test/tools/Secodefuzz:secodefuzz", + ] + } + if (!defined(configs)) { + configs = [] + } + cflags = [ "-Wno-error" ] + ldflags = [] + if (defined(invoker.ldflags)) { + ldflags += invoker.ldflags + } + if (ohos_current_toolchain_type != "clang") { + ldflags += [ "-lstdc++" ] + } + _fuzztest_output_dir = "$root_build_dir/fuzztest" + rebase_path(_fuzztest_output_dir, root_build_dir) + } +} diff --git a/config_convert.py b/config_convert.py deleted file mode 100755 index d73a80d..0000000 --- a/config_convert.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import os -import shutil -from utils import file_write -from utils import CallbackDict, makedirs -from utils import read_json_file - - -def args_gn_create(config): - # Delete and create output directory - out_path = config.get_out_path() - if os.path.exists(out_path): - shutil.rmtree(out_path) - makedirs(out_path) - - -def args_gn_write(config): - product_args_path = os.path.join(config.get_out_path(), 'args.gn') - ndk = config.ndk - build_type = config.build_type - - file_write(product_args_path, 'at', 'product = "{}"\n'.format( - config.product)) - # Add import to the file header - if ndk is not None: - ndk_gn_args = ('ohos_build_ndk = true\n' - 'ohos_build_ndk_target_host = "{}"' - '\n'.format(ndk)) - file_write(product_args_path, 'at', ndk_gn_args) - if config.test_args: - file_write(product_args_path, 'at', - 'ohos_xts_test_args = "{}"\n'.format(config.test_args[1])) - file_write(product_args_path, 'at', - 'ohos_build_type = "{}"\n'.format(build_type)) - for feature in CallbackDict.args_list: - file_write(product_args_path, 'at', '{}\n'.format(feature)) - - -def load_subsystem_feature(config): - product = config.product - product_json = os.path.join(os.path.dirname(os.path.abspath(__file__)), - 'product', '{}.json'.format(product)) - json_content = read_json_file(product_json) - for subsystem in json_content['subsystem']: - for component in subsystem['component']: - for feature in component['features']: - CallbackDict.args_list.append(feature) - - -def config_create(**kwargs): - config = kwargs['config'] - args_gn_create(config) - load_subsystem_feature(config) - args_gn_write(config) - return True diff --git a/figures/编译构建流程.jpg b/figures/编译构建流程.jpg new file mode 100755 index 0000000000000000000000000000000000000000..3e296c97b64e317bb92849d80588d5ab5419b31e GIT binary patch literal 47580 zcmdSB2_Tg3yEi^UvQGB0O=U?Tm91=3Nl22Eov9>SsB9x+rpUg9P?RaV!q|qaW0xe^ zGh)n8vSr3H9*mjy>37b1-gCa4^Zvi*{lEYBJ^$fmJnrSX@8`a+>vLV7>lxNp))Zv# z#S11EAZ%=GkQ?9^gf$K^fb3#p`~CgTFLqA$->=;q9PFH2yScc2mp$CP+wvmJu$5@cf+ zWMj2MU=Ro!Cn)W2f&cl%wu_yEb2lgw4=-2&zZVproqZQ5EGGvCSUUv#KZHY&Q|RD{ zv%7^YZgL&EFLLs6(wjZ9=gM0|ul7^r)NVZp<>nC+-?v{vUg5Cfk)!Gwnp&q$Ya5(5 zykKN(a?$eIbt`KdTRZ35E_Ynr+&z5#`~w1!K@Y>8ghxb1MaLwkJWEYWfBqsPJ0~|U zzo4+_ZAE1jzPjdpZCz_ydq-#2hwhI9gG0k3qhH5}WXkl+_aC!A=jLfEt844@4PbNY z_q^C3?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i4bea1`R+iWh|lJyg)2qT0c+ zkO@p2A9rKZ-}sqmI;_^VW6ujdd+gG^10jN>yKd&Y{VuPWt5#aP=9^)~Ke?Zc+xZm- zX*mWJYu2lmqO)ZH(6=eE&~^X)Q@XM!g@)Ip_l!YziVD8Zrhzsbd4&CS!$5omNvlpc zgBfbIuSs7^exZ47hHFW^zFhCw{D;~3=jC4M`o@WX@T;axdS#UdQ^q=pF1mWEq95wNhqMO!>x%jHepd_2rMcq8grkGZwf4{Of=y< zoOm-4anae@){8l$^r5QE*G{Tn!PWyY{LZi9^W&rYNKGX9QE0iob|9)nS!mM*xDy*c zs2B&d)r>3ug3u~d3#$0)U4KWE|7V_YlEwkJ$nx{hsjGa#86a%8GgAww^s$zHxLT_w za<;{T!EH=6$JzFWv)BE2YO1fp=!}44vCpe`FH&mbI&_WCtdJW1RYD@92Mh!?K_O10 zG(Bx}K;%cTYHX)@DW=o|aQG_gjU zuWm1qDr-Srwg}dW%ApR2^c(}?w~Nh*@f!L->HMxLE~%J?Eh`+gXr^R7uN=Q!eDFVV zMnad!_xj0(tUC6x>vZ7jD#QZBu_F~UmD*B|wwuOly(v%k`P=9HPk TtG?~i|0m;#f9kUpzkK)?VHlsy literal 0 HcmV?d00001 diff --git a/filter.py b/filter.py deleted file mode 100755 index 9c37e68..0000000 --- a/filter.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from utils import CallbackDict -from filter_process import code_filter - - -def add_options(parser): - parser.add_argument('-c', '--config', help='Config for code filtering', - nargs='*') - parser.add_argument('--no_commit_msg', help='Remove commit msg', - action='store_true') - parser.add_argument('-p', '--path', help='Code targer path after ' - 'filtering out', nargs='*') - - -def exec_command(args): - callback_dict = CallbackDict() - target = 'filter' - - if args.config: - callback_dict.config = args.config[0] - no_commit_msg = args.no_commit_msg - if args.path: - target_path = args.path[0] - else: - target_path = 'ohos_opensource' - - callback_dict.register(target, code_filter) - - callback_dict.excute(target, - callback_dict=callback_dict, - no_commit_msg=no_commit_msg, - target_path=target_path) diff --git a/filter_process.py b/filter_process.py deleted file mode 100755 index 589dca0..0000000 --- a/filter_process.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -import sys -import os -import shutil -from utils import read_json_file -from xml.etree.ElementTree import parse -from utils import remove_path - - -def is_opensource(bundle): - """Get opensource infomation from bundle.json.""" - bundle_data = read_json_file(bundle) - bundle_publish = bundle_data.get('publishAs') - if not bundle_publish: - raise Exception('Could not find "publishAs" in {}'.format(bundle)) - - if bundle_publish == 'source': - return True - - return False - - -def filter_out_code(code_path): - if not os.path.exists(code_path): - raise Exception('Could not find code path: {}'.format(code_path)) - shutil.rmtree(code_path) - - -def get_source_list(tag): - if tag is None: - return None - - source_list = [] - for source in tag.iterfind('project'): - path = source.attrib['path'] - source_list.append(path) - - return source_list - - -def get_filter_list(xml): - """Parse the config xml and get selected code path.""" - filter_xml = parse(xml) - opensource_tag = filter_xml.find('opensource') - non_opensource_tag = filter_xml.find('non_opensource') - - opensource_list = get_source_list(opensource_tag) - non_opensource_list = get_source_list(non_opensource_tag) - - return opensource_list, non_opensource_list - - -def check_ignore(no_commit_msg): - if no_commit_msg: - ignore = shutil.ignore_patterns('.git', '.repo') - else: - ignore = None - - return ignore - - -def filter_by_bundle(config, path, no_commit_msg): - """Filter out code by bundle.json in every code repository.""" - cwd_path = os.getcwd() - ignore = check_ignore(no_commit_msg) - shutil.copytree(cwd_path, path, symlinks=False, ignore=ignore) - - for relpath, dirs, files in os.walk(path): - if config in files: - full_path = os.path.join(path, relpath, config) - bundle_path = os.path.normpath(os.path.abspath(full_path)) - if not is_opensource(bundle_path): - code_path = os.path.join(path, relpath) - filter_out_code(code_path) - - -def filter_by_path(config, path, no_commit_msg): - """Filter out code by the config.""" - if not os.path.exists(config): - raise Exception("Could not find config: {}".format(config)) - opensouce_list, non_opensource_list = get_filter_list(config) - - # remove target path if exsits - remove_path(path) - cwd_path = os.getcwd() - ignore = check_ignore(no_commit_msg) - - # copy opensource code directly - if opensouce_list: - for each in opensouce_list: - source_path = os.path.join(cwd_path, each) - dst_path = os.path.join(path, each) - if os.path.isfile(source_path): - shutil.copy(source_path, dst_path) - else: - try: - shutil.copytree(source_path, dst_path, symlinks=False, - ignore=ignore) - except Exception as e: - print(e.args[0]) - - if non_opensource_list: - for source_code in non_opensource_list: - source_path = os.path.join(path, source_code) - if os.path.exists(source_path): - shutil.rmtree(source_path) - # copy whole source code to target path and remove selected code in config - elif non_opensource_list: - shutil.copytree(cwd_path, path, symlinks=False, ignore=ignore) - for source_code in non_opensource_list: - source_path = os.path.join(path, source_code) - if os.path.exists(source_path): - shutil.rmtree(source_path) - - -def code_filter(**kwargs): - """ - description: Filter out code by config or bundle.json - param: - callback_dict: building class, contains the path of config - or bundle.json - no_commit_msg: true if remove git message, like .git and .repo - target_path: target code path after filtering out - return: NA - """ - callback_dict = kwargs['callback_dict'] - no_commit_msg = kwargs['no_commit_msg'] - target_path = kwargs['target_path'] - - if callback_dict.config is None: - target_config = 'bundle.json' - filter_by_bundle(target_config, target_path, no_commit_msg) - else: - target_config = callback_dict.config - filter_by_path(target_config, target_path, no_commit_msg) - - -if __name__ == "__main__": - sys.exit(0) diff --git a/gen_module_notice_file.py b/gen_module_notice_file.py index d4284e3..9b6db1f 100755 --- a/gen_module_notice_file.py +++ b/gen_module_notice_file.py @@ -55,7 +55,8 @@ def get_notice_file_name(readme_file_path, copyright_file, for info in opensource_config: license_file = info.get('License File') license_name = info.get('License') - software_name = '{} {}'.format(info.get('Name'), info.get('Version Number')) + software_name = '{} {}'.format(info.get('Name'), + info.get('Version Number')) license_file_path = os.path.join(os.path.dirname(readme_file_path), license_file.strip()) diff --git a/gen_rootfs.py b/gen_rootfs.py index 21069e1..858a69e 100755 --- a/gen_rootfs.py +++ b/gen_rootfs.py @@ -20,18 +20,40 @@ import shutil import argparse from utils import exec_command from utils import makedirs -import platform import tarfile +BUFSIZE = 8*1024 + + +def cmp_file(old, new): + old_file_st = os.stat(old) + new_file_st = os.stat(new) + + if old_file_st.st_size != new_file_st.st_size: + return False + + buf_size = BUFSIZE + with open(old, 'rb') as file_old, open(new, 'rb') as file_new: + while True: + old_buf = file_old.read(buf_size) + new_buf = file_new.read(buf_size) + if old_buf != new_buf: + return False + if not old_buf: + return True + + def move_file(old_path, new_path): + if os.path.exists(new_path): + shutil.rmtree(new_path) if os.path.exists(old_path): shutil.copytree(old_path, new_path) def is_needed_copy(file, ignore_list): for ignore in ignore_list: - if file.endswith(ignore): + if file.endswith(ignore) or file.startswith(ignore): return False return True @@ -39,9 +61,16 @@ def is_needed_copy(file, ignore_list): def copy(source, target, ignore_list): for file in os.listdir(source): + source_file = os.path.join(source, file) + target_file = os.path.join(target, file) + if os.path.exists(target_file) and \ + cmp_file(source_file, target_file): + continue + if os.path.exists(target_file) and \ + cmp_file(source_file, target_file) == False: + os.remove(target_file) if is_needed_copy(file, ignore_list) and \ - os.path.isfile(os.path.join(source, file)): - source_file = os.path.join(source, file) + os.path.isfile(source_file): shutil.copy(source_file, target) @@ -53,7 +82,8 @@ def mv_usr_libs(path): makedirs(target_path) for lib in libs: source_file = os.path.join(path, lib) - shutil.move(source_file, target_path) + target_file = os.path.join(target_path, lib) + shutil.move(source_file, target_file) def check_strip(path, strip_cmd, log): @@ -141,24 +171,15 @@ def change_rootfs_filemode(path): os.chmod(tmppath, 320) -def create_file_symlink(file_name, src_dir, dst_dir): - src = os.path.join(src_dir, file_name) - dst = os.path.join(dst_dir, file_name) - tmppath = os.path.join("/usr/lib/", file_name) - if os.path.exists(src): - os.symlink(tmppath, dst) - - def create_symlinks_for_dv(path): - src_path = os.path.join(path, "usr/lib") - dst_path = os.path.join(path, "lib") - create_file_symlink("libmbedtls_shared.so", src_path, dst_path) - create_file_symlink("libcjson_shared.so", src_path, dst_path) - create_file_symlink("libsys_parameter.so", src_path, dst_path) - create_file_symlink("libsec_shared.so", src_path, dst_path) - create_file_symlink("libsamgr.so", src_path, dst_path) - create_file_symlink("libliteipc_adapter.so", src_path, dst_path) - create_file_symlink("libhilog_a_shared.so", src_path, dst_path) + dst = os.path.join(path, "usr/lib/a7_softfp_neon-vfpv4") + if os.path.exists(dst): + os.remove(dst) + os.symlink("./", dst) + dst = os.path.join(path, "bin/shell") + if os.path.exists(dst): + os.remove(dst) + os.symlink("sh", dst) def change_rootfs_filemode_linux(path): @@ -175,8 +196,9 @@ def change_rootfs_filemode_linux(path): tmppath = os.path.join(path, "usr/lib") chmod_files_mode(tmppath, 493, 420) tmppath = os.path.join(path, "etc/init.cfg") - os.chmod(tmppath, 256) - if "dv300" in path: + if os.path.exists(tmppath): + os.chmod(tmppath, 256) + if "dv300" or "taurus" in path: create_symlinks_for_dv(path) @@ -189,6 +211,12 @@ def change_userfs_filemode(path): os.chmod(tmppath, 365) +def remove_file_in_rootfs_linux(output_path): + rootfs_data = os.path.join(output_path, 'rootfs/data') + if os.path.exists(rootfs_data): + shutil.rmtree(rootfs_data) + + def remove_file_in_rootfs(output_path): rootfs_app = os.path.join(output_path, 'rootfs/app') rootfs_data = os.path.join(output_path, 'rootfs/data') @@ -203,36 +231,55 @@ def make_rootfs_tar(tar_filename, source_dir): tar.add(source_dir, arcname=os.path.basename(source_dir)) -def gen_rootfs(mkfs, fstype, output_path, rootfs_dirs_dict, kernel): +def add_mount_userfs_linux(rootfs): + mount_userfs_path = os.path.join(rootfs, 'storage') + if not os.path.exists(mount_userfs_path): + os.makedirs(mount_userfs_path) + + +def gen_rootfs(mkfs, output_path, rootfs_dirs_dict, kernel, storage_type): mv_usr_libs(output_path) rootfs = os.path.join(output_path, 'rootfs') rootfs_tar = os.path.join(output_path, 'rootfs.tar') if not os.path.exists(rootfs): print('rootfs dir not exist in {}'.format(rootfs)) return 0 - log = os.path.join(output_path, 'build.log') for path_part, value_list in rootfs_dirs_dict.items(): source_path = os.path.join(output_path, path_part) target_path = os.path.join(rootfs, value_list[0]) strip_cmd = value_list[2] + if os.path.exists(source_path): if not os.path.exists(target_path): makedirs(target_path) ignore_list = value_list[1] copy(source_path, target_path, ignore_list) - - check_strip(target_path, strip_cmd, log) + if kernel == "liteos_a": + check_strip(target_path, strip_cmd, log) if kernel == "linux": + remove_file_in_rootfs_linux(output_path) change_rootfs_filemode_linux(rootfs) - cmd = [mkfs, rootfs, "jffs2"] - exec_command(cmd, log_path=log) + add_mount_userfs_linux(rootfs) + if storage_type == "emmc": + cmd = [mkfs, rootfs, 'ext4'] + exec_command(cmd, log_path=log) + if storage_type == "spinor": + cmd = [mkfs, rootfs, "jffs2"] + exec_command(cmd, log_path=log) if kernel == "liteos_a": remove_file_in_rootfs(output_path) change_rootfs_filemode(rootfs) - cmd = [mkfs, rootfs, fstype] - exec_command(cmd, log_path=log) + if storage_type == "emmc": + cmd = [mkfs, rootfs, 'vfat'] + exec_command(cmd, log_path=log) + if storage_type == "spinor": + cmd = [mkfs, rootfs, 'jffs2'] + exec_command(cmd, log_path=log) + if storage_type == "spinand": + cmd = [mkfs, rootfs, 'yaffs2'] + exec_command(cmd, log_path=log) make_rootfs_tar(rootfs_tar, rootfs) if os.path.exists(rootfs): chmod_files_mode(rootfs, 511, 511) @@ -254,11 +301,13 @@ def move_rootfs_to_userfs(output_path): rootfs_data = os.path.join(output_path, 'rootfs/data') userfs_app = os.path.join(output_path, 'userfs/app') userfs_data = os.path.join(output_path, 'userfs/data') - move_file(rootfs_app, userfs_app) - move_file(rootfs_data, userfs_data) + if os.path.exists(rootfs_app): + move_file(rootfs_app, userfs_app) + if os.path.exists(rootfs_data): + move_file(rootfs_data, userfs_data) -def gen_userfs(mkfs, fstype, output_path, userfs_dirs_dict): +def gen_userfs(mkfs, output_path, userfs_dirs_dict, kernel, storage_type): userfs = os.path.join(output_path, 'userfs') userfs_etc = os.path.join(output_path, 'userfs/etc') if make_userfs_dir(userfs): @@ -280,61 +329,97 @@ def gen_userfs(mkfs, fstype, output_path, userfs_dirs_dict): check_strip(target_path, strip_cmd, log) change_userfs_filemode(userfs) - if fstype == "vfat": - cmd = [mkfs, userfs, fstype, '52428800'] - else: - cmd = [mkfs, userfs, fstype] - exec_command(cmd, log_path=log) + if kernel == "linux": + if storage_type == "emmc": + cmd = [mkfs, userfs, 'ext4'] + exec_command(cmd, log_path=log) + if storage_type == "spinor": + cmd = [mkfs, userfs, "jffs2"] + exec_command(cmd, log_path=log) + if kernel == "liteos_a": + if storage_type == "emmc": + cmd = [mkfs, userfs, 'vfat', '52428800'] + exec_command(cmd, log_path=log) + if storage_type == "spinor": + cmd = [mkfs, userfs, 'jffs2'] + exec_command(cmd, log_path=log) + if storage_type == "spinand": + cmd = [mkfs, userfs, 'yaffs2'] + exec_command(cmd, log_path=log) + return 0 + + +def gen_systemfs(mkfs, output_path, kernel, storage_type): + if kernel == "linux": + if storage_type == "emmc": + systemfs = os.path.join(output_path, 'systemfs') + if make_userfs_dir(systemfs): + return -1 + systemhashfs = os.path.join(output_path, 'systemhashfs') + if make_userfs_dir(systemhashfs): + return -1 + log = os.path.join(output_path, 'build.log') + cmd_mksysfs = [mkfs, systemfs, 'ext4'] + exec_command(cmd_mksysfs, log_path=log) + dmverity = os.path.join( + output_path, + '../../../build/lite/make_rootfs/dmverity_linux.sh') + cmd_veritysetup = [dmverity, output_path, 'veritysetup'] + exec_command(cmd_veritysetup, log_path=log) + cmd_mksyshashfs = [mkfs, systemhashfs, 'ext4', '6'] + exec_command(cmd_mksyshashfs, log_path=log) + cmd_adds82ohos = [dmverity, output_path, 'addS82ohos'] + exec_command(cmd_adds82ohos, log_path=log) return 0 def main(): parser = argparse.ArgumentParser(description='Generate rootfs') parser.add_argument('--path', help='Build output path') - parser.add_argument('--board', help='Board type') parser.add_argument('--kernel', help='OHOS kernel type') - parser.add_argument('--compile_so', help='So strip command') - parser.add_argument('--compile_bin', help='Bin strip command') + parser.add_argument('--storage', help='Board storage type') + parser.add_argument('--strip_command', help='So strip command') + parser.add_argument('--dmverity', help='OHOS security dmverity type') args = parser.parse_args() - if args.board == 'hi3861v100': - return + strip_cmd = args.strip_command + kernel = args.kernel + storage_type = args.storage + dmverity_enable = args.dmverity if args.path: output_path = os.path.abspath(args.path) - mkfs = os.path.join( - output_path, - '../../kernel/liteos_a/tools/scripts/make_rootfs/rootfsimg.sh') + if kernel == "liteos_a": + mkfs = os.path.join( + output_path, + '../../../build/lite/make_rootfs/rootfsimg_liteos.sh') + if kernel == "linux": + mkfs = os.path.join( + output_path, + '../../../build/lite/make_rootfs/rootfsimg_linux.sh') + if kernel == "liteos_m": + print('no need to make rootfs') + return 0 if not os.path.exists(mkfs): print('mkfs not exist in {}'.format(mkfs)) return -1 else: return -1 - if args.board: - if args.board == 'hi3516dv300': - fstype = 'vfat' - else: - fstype = 'jffs2' - else: - return -1 - - so_strip_cmd = args.compile_so - bin_strip_cmd = args.compile_bin - kernel = args.kernel - rootfs_dirs_dict = { - 'bin': ['bin', ['Test.bin', 'TestSuite.bin'], bin_strip_cmd], - 'libs': ['lib', ['.a'], so_strip_cmd], - 'libs/usr': ['usr/lib', ['.a'], so_strip_cmd], - 'bin/usr': ['usr/bin', [], bin_strip_cmd], + 'bin': ['bin', ['Test.bin', 'TestSuite.bin', 'query.bin', 'cve', + 'checksum'], strip_cmd], + 'libs': ['lib', ['.a'], strip_cmd], + 'libs/usr': ['usr/lib', ['.a'], strip_cmd], + 'bin/usr': ['usr/bin', [], strip_cmd], 'vendor/bin': ['vendor/bin', [], ""], 'vendor/lib': ['vendor/lib', [], ""], - 'vendor/firmware/hisilicon': ['vendor/firmware/hisilicon', [], ""], - 'obj/vendor/huawei/camera/init_configs/config': ['etc', [], ""], + 'vendor/firmware/hi3881': ['vendor/firmware/hi3881', [], ""], + 'config': ['etc', [], ""], 'system/internal': ['system/internal', [], ""], 'etc': ['etc', [], ""], - 'data': ['data', [], ""] + 'data': ['data', [], ""], + 'obj/foundation/distributedschedule/samgr_lite/config': ['etc', [], ""] } userfs_dirs_dict = { 'obj/base/security/services/app_verify/config': @@ -342,11 +427,19 @@ def main(): 'storage/etc': ['etc', [], ""], 'data': ['data', [], ""] } - if kernel == "liteos_a": - ret = gen_userfs(mkfs, fstype, output_path, userfs_dirs_dict) + ret = gen_userfs(mkfs, output_path, userfs_dirs_dict, kernel, storage_type) + if ret: + print('gen userfs failed') + return -1 + + if dmverity_enable == "true": + ret = gen_systemfs(mkfs, output_path, kernel, storage_type) if ret: + print('gen systemfs failed') return -1 - return gen_rootfs(mkfs, fstype, output_path, rootfs_dirs_dict, kernel) + + return gen_rootfs(mkfs, output_path, rootfs_dirs_dict, + kernel, storage_type) if __name__ == "__main__": diff --git a/hap_pack.py b/hap_pack.py index e1d9f6b..c4ef4ce 100755 --- a/hap_pack.py +++ b/hap_pack.py @@ -20,6 +20,7 @@ import sys import os import argparse import subprocess +from utils import makedirs import shutil import zipfile @@ -49,10 +50,12 @@ def parse_args(): parser.add_argument('--signtool-path', help='sign tool path') parser.add_argument('--signhap-path', help='sign hap path') parser.add_argument('--privatekey', help='privatekey') + parser.add_argument('--sign-server', help='sign_server') parser.add_argument('--sign-algo', help='sign algo') parser.add_argument('--cert-profile', help='cert profile') parser.add_argument('--jks-path', help='jks path') parser.add_argument('--cert-path', help='cert path') + parser.add_argument('--sign-by-server', help='sign mode') args = parser.parse_args() return args @@ -74,7 +77,8 @@ def hap_packing(args): '--ability-so-path': args.ability_so_path, '--index-path': args.index_path, '--out-path': args.unsignhap_path, - '--force': args.force} + '--force': args.force, + '--sign-by-server': args.sign_by_server} for key, value in cmd_dict.items(): if value: packing_cmd.extend([key, value]) @@ -87,22 +91,51 @@ def hap_signing(args): if not args.signtool_path: print('hap warning: signing tool path empty') return - signtool_path = os.path.join(os.environ['HOME'], args.signtool_path) - #The default password of the key is 123456. - # You are advised to use a key and certificate management tool ( - # such as keytool) to change the default password. - # For details, see section "Application Signature Verification - # Development Guide" in the Security Subsystem Development Guide. - signing_cmd = ['java', '-jar', signtool_path, 'sign', '-mode', - 'localjks', '-profileSigned', '1', '-keystorepasswd', - '123456', '-keyaliaspasswd', '123456'] - cmd_dict = {'-privatekey': args.privatekey, - '-inputFile': args.unsignhap_path, - '-outputFile': args.signhap_path, - '-signAlg': args.sign_algo, - '-profile': args.cert_profile, - '-keystore': args.jks_path, - '-certpath': args.cert_path} + + # sign by server + if args.sign_by_server == "True": + if 'ONLINE_USERNAME' in os.environ: + user_name = os.environ.get('ONLINE_USERNAME') + else: + print('hap warning: Environment variable ONLINE_USERNAME and ' + + 'ONLINE_PASSWD are needed for app signning. ' + + 'Please export it in bash.') + return + if 'ONLINE_PASSWD' in os.environ: + password = os.environ.get('ONLINE_PASSWD') + else: + print('hap warning: Environment variable ONLINE_USERNAME and ' + + 'ONLINE_PASSWD are needed for app signning. ' + + 'Please export it in bash.') + return + signing_cmd = ['java', '-jar', args.signtool_path, 'sign', '-mode', + 'remote', '-profileSigned', '1'] + cmd_dict = {'-privatekey': args.privatekey, + '-server': args.sign_server, + '-inputFile': args.unsignhap_path, + '-outputFile': args.signhap_path, + '-username': user_name, + '-password': password, + '-signAlg': args.sign_algo, + '-profile': args.cert_profile} + # sign by software. + else: + signtool_path = os.path.join(os.environ['HOME'], args.signtool_path) + #The default password of the key is 123456. + # You are advised to use a key and certificate management tool ( + # such as keytool) to change the default password. + # For details, see section "Application Signature Verification + # Development Guide" in the Security Subsystem Development Guide. + signing_cmd = ['java', '-jar', signtool_path, 'sign', '-mode', + 'localjks', '-profileSigned', '1', '-keystorepasswd', + '123456', '-keyaliaspasswd', '123456'] + cmd_dict = {'-privatekey': args.privatekey, + '-inputFile': args.unsignhap_path, + '-outputFile': args.signhap_path, + '-signAlg': args.sign_algo, + '-profile': args.cert_profile, + '-keystore': args.jks_path, + '-certpath': args.cert_path} for key, value in cmd_dict.items(): if value: signing_cmd.extend([key, value]) @@ -111,6 +144,10 @@ def hap_signing(args): def main(): args = parse_args() + + # Workaround: hap packing tools multi-thread contention issue. + makedirs(os.path.dirname(args.unsignhap_path), exist_ok=True) + hap_packing(args) if os.path.exists(args.unsignhap_path): hap_signing(args) diff --git a/hb/__init__.py b/hb/__init__.py new file mode 100755 index 0000000..95b586a --- /dev/null +++ b/hb/__init__.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os + + +def get_config_path(): + search_path = os.getcwd() + while search_path != '/': + config_path = os.path.join(search_path, 'ohos_config.json') + if os.path.isfile(config_path): + return config_path + search_path = os.path.dirname(search_path) + return os.path.abspath(os.path.join(os.path.dirname(__file__), + 'common', + 'config.json')) + + +CONFIG_JSON = get_config_path() +CONFIG_STRUCT = { + "root_path": None, + "board": None, + "kernel": None, + "product": None, + "product_path": None, + "device_path": None +} \ No newline at end of file diff --git a/__main__.py b/hb/__main__.py similarity index 57% rename from __main__.py rename to hb/__main__.py index 7d40138..9409706 100755 --- a/__main__.py +++ b/hb/__main__.py @@ -16,49 +16,66 @@ # limitations under the License. # +import os import sys +sys.path.insert(0, os.path.abspath(os.path.join(__file__, + os.pardir, + os.pardir))) import argparse import importlib -import logging -import os + +from hb.common.utils import hb_warning +from hb.common.utils import hb_error def main(): - if not __package__: - path = os.path.join(os.path.dirname(__file__), os.pardir) - sys.path.insert(0, path) - - parser = argparse.ArgumentParser(usage="lite [COMMAND]", - description='lite build system') + parser = argparse.ArgumentParser(usage="hb", + description='OHOS build system') subparsers = parser.add_subparsers() parser_list = [] parser_list.append({ - 'name': 'compile', + 'name': 'build', 'help': 'Build source code' }) parser_list.append({ - 'name': 'filter', - 'help': 'Filter out non-open source code' + 'name': 'set', + 'help': 'OHOS build settings' + }) + + parser_list.append({ + 'name': 'env', + 'help': 'Show OHOS build env' + }) + + parser_list.append({ + 'name': 'clean', + 'help': 'Clean output' + }) + + parser_list.append({ + 'name': 'deps', + 'help': 'OHOS components deps' }) for each in parser_list: module_parser = subparsers.add_parser(name=each.get('name'), help=each.get('help')) module = importlib.import_module('.{}'.format(each.get('name')), - 'lite') + 'hb.{}'.format(each.get('name'))) module.add_options(module_parser) - module_parser.set_defaults(command=module.exec_command) + module_parser.set_defaults(parser=module_parser, + command=module.exec_command) args = parser.parse_args() try: status = args.command(args) except KeyboardInterrupt: - logging.warning('interrupted') + hb_warning('interrupted') status = -1 - except Exception as e: - logging.error(e) + except Exception as exception: + hb_error(exception.args[0]) status = -1 return status diff --git a/__init__.py b/hb/build/__init__.py similarity index 100% rename from __init__.py rename to hb/build/__init__.py diff --git a/hb/build/build.py b/hb/build/build.py new file mode 100755 index 0000000..8087680 --- /dev/null +++ b/hb/build/build.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from collections import defaultdict + +from hb.build.build_process import Build +from hb.set.set import set_product + + +def add_options(parser): + parser.add_argument('component', help='name of the component', nargs='*', + default=[]) + parser.add_argument('-b', '--build_type', help='release or debug version', + nargs=1, default=['debug']) + parser.add_argument('-c', '--compiler', help='specify compiler', + nargs=1, default=['clang']) + parser.add_argument('-t', '--test', help='compile test suit', nargs='*') + parser.add_argument('--dmverity', help='Enable dmverity', + action="store_true") + parser.add_argument('-p', '--product', help='build a specified product ' + 'with {product_name}@{company}, eg: camera@huawei', + nargs=1, default=[]) + parser.add_argument('-f', '--full', + help='full code compilation', action='store_true') + parser.add_argument('-n', '--ndk', help='compile ndk', + action='store_true') + parser.add_argument('-T', '--target', help='Compile single target', + nargs='*', default=[]) + parser.add_argument('-v', '--verbose', + help='show all command lines while building', + action='store_true') + parser.add_argument('-shs', '--sign_haps_by_server', + help='sign haps by server', action='store_true') + + +def exec_command(args): + build = Build() + cmd_args = defaultdict(list) + + if len(args.component): + build.target = args.component[0] + + build.register_args('ohos_build_type', args.build_type[0]) + + if len(args.compiler): + build.compiler = args.compiler[0] + + if args.test is not None: + build.test = args.test + + if args.dmverity: + build.register_args('enable_ohos_security_dmverity', + 'true', + quota=False) + + if len(args.product): + product, company = args.product[0].split('@') + set_product(product_name=product, company=company) + + if args.ndk: + build.register_args('ohos_build_ndk', 'true', quota=False) + + if hasattr(args, 'target') and len(args.target): + build.register_args('ohos_build_target', args.target) + + if hasattr(args, 'verbose') and args.verbose: + cmd_args['gn'].append('-v') + cmd_args['ninja'].append('-v') + + if hasattr(args, 'ninja'): + return build.build(args.full, ninja=args.ninja) + + if args.sign_haps_by_server: + build.register_args('ohos_sign_haps_by_server', + 'true', + quota=False) + + return build.build(args.full, cmd_args=cmd_args) diff --git a/hb/build/build_process.py b/hb/build/build_process.py new file mode 100755 index 0000000..eb0894c --- /dev/null +++ b/hb/build/build_process.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +from collections import defaultdict + +from hb.common.utils import exec_command +from hb.common.utils import makedirs +from hb.common.utils import remove_path +from hb.common.utils import hb_info +from hb.common.utils import hb_warning +from hb.common.config import Config +from hb.cts.cts import CTS +from hb.common.device import Device +from hb.common.product import Product + + +class Build(): + def __init__(self): + self.config = Config() + + # Get gn args ready + self._args_list = [] + self._target = None + self._compiler = None + self._test = None + + @property + def target(self): + return self._target + + @target.setter + def target(self, component): + cts = CTS() + cts.init_from_json() + for subsystem_cls in cts: + for cname, component_cls in subsystem_cls: + if cname == component: + if component_cls.adapted_board is None or\ + self.config.board in component_cls.adapted_board: + if component_cls.adapted_kernel is None or\ + self.config.kernel in component_cls.adapted_kernel: + self._target = component_cls.targets + self.register_args('ohos_build_target', + self._target) + return + + raise Exception('Component {} not found'.format(component)) + + @property + def compiler(self): + return self._compiler + + @compiler.setter + def compiler(self, value): + self._compiler = value + self.register_args('ohos_build_compiler_specified', self._compiler) + if self._compiler == 'clang': + self.register_args('ohos_build_compiler_dir', + self.config.clang_path) + + @property + def test(self): + return self._test + + @test.setter + def test(self, test_args): + cmd_list = ['xts'] + if test_args[0] in cmd_list: + self._test = test_args[1] + if len(test_args) > 1: + self.register_args('ohos_xts_test_args', self._test) + else: + raise Exception('Error: wrong input of test') + + def register_args(self, args_name, args_value, quota=True): + if quota: + if isinstance(args_value, list): + self._args_list += ['{}="{}"'.format(args_name, + "&&".join(args_value))] + else: + self._args_list += ['{}="{}"'.format(args_name, args_value)] + else: + self._args_list += ['{}={}'.format(args_name, args_value)] + + def build(self, full_compile, ninja=True, cmd_args=None): + self.check_in_device() + cmd_list = self.get_cmd(full_compile, ninja) + + if cmd_args is None: + cmd_args = defaultdict(list) + for exec_cmd in cmd_list: + exec_cmd(cmd_args) + + return 0 + + def get_cmd(self, full_compile, ninja): + if not ninja: + self.register_args('ohos_full_compile', 'true', quota=False) + return [self.gn_build] + + build_ninja = os.path.join(self.config.out_path, 'build.ninja') + if not os.path.isfile(build_ninja): + self.register_args('ohos_full_compile', 'true', quota=False) + makedirs(self.config.out_path) + return [self.gn_build, self.ninja_build] + if full_compile: + self.register_args('ohos_full_compile', 'true', quota=False) + remove_path(self.config.out_path) + makedirs(self.config.out_path) + return [self.gn_build, self.ninja_build] + + self.register_args('ohos_full_compile', 'false', quota=False) + return [self.ninja_build] + + def gn_build(self, cmd_args): + # Clean out path + remove_path(self.config.out_path) + makedirs(self.config.out_path) + + # Gn cmd init and execute + gn_path = self.config.gn_path + gn_args = cmd_args.get('gn', []) + gn_cmd = [gn_path, + 'gen', + self.config.out_path, + '--root={}'.format(self.config.root_path), + '--dotfile={}/.gn'.format(self.config.build_path), + '--args={}'.format(" ".join(self._args_list))] + gn_args + exec_command(gn_cmd, log_path=self.config.log_path) + + def gn_clean(self, out_path=None): + # Gn cmd init and execute + gn_path = self.config.gn_path + + if out_path is not None: + self.config.out_path = os.path.abspath(out_path) + else: + self.config.out_path = os.path.join(self.config.root_path, + 'out', + self.config.board, + self.config.product) + + if not os.path.isdir(self.config.out_path): + hb_warning('{} not found'.format(self.config.out_path)) + return + + gn_cmd = [gn_path, + '--root={}'.format(self.config.root_path), + '--dotfile={}/.gn'.format(self.config.build_path), + 'clean', + self.config.out_path] + exec_command(gn_cmd, log_path=self.config.log_path) + + def ninja_build(self, cmd_args): + ninja_path = self.config.ninja_path + + ninja_args = cmd_args.get('ninja', []) + ninja_cmd = [ninja_path, + '-w', + 'dupbuild=warn', + '-C', + self.config.out_path] + ninja_args + exec_command(ninja_cmd, log_path=self.config.log_path, log_filter=True) + + hb_info('{} build success'.format( + os.path.basename(self.config.out_path))) + + def check_in_device(self): + if self._target is None and Device.is_in_device(): + # Compile device board + device_path, kernel, board = Device.device_menuconfig() + self.config.out_path = os.path.join(self.config.root_path, + 'out', + board) + gn_device_path = os.path.dirname(device_path).\ + replace(self.config.root_path, '/') + gn_kernel_path = device_path.replace(self.config.root_path, '/') + self.register_args('ohos_build_target', [gn_device_path]) + self.register_args('device_path', gn_kernel_path) + self.register_args('ohos_kernel_type', kernel) + else: + # Compile product in "hb set" + self.register_args('product_path', self.config.gn_product_path) + self.register_args('device_path', self.config.gn_device_path) + self.register_args('ohos_kernel_type', self.config.kernel) + + product_json = os.path.join(self.config.product_path, + 'config.json') + self._args_list += Product.get_features(product_json) + self.config.out_path = os.path.join(self.config.root_path, + 'out', + self.config.board, + self.config.product) diff --git a/config/boards/hi3861v100.gni b/hb/clean/__init__.py similarity index 90% rename from config/boards/hi3861v100.gni rename to hb/clean/__init__.py index 15ad3f9..deab585 100755 --- a/config/boards/hi3861v100.gni +++ b/hb/clean/__init__.py @@ -1,15 +1,17 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -board_arch = "rv32imc" -board_cpu = "riscv32" +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/hb/clean/clean.py b/hb/clean/clean.py new file mode 100755 index 0000000..a13df12 --- /dev/null +++ b/hb/clean/clean.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from hb.build.build_process import Build + + +def add_options(parser): + parser.add_argument('out_path', + nargs='?', + default=None, + help='clean a specified path.') + + +def exec_command(args): + build = Build() + return build.gn_clean(out_path=args.out_path) diff --git a/config/boards/qemu_arm_virt_ca7.gni b/hb/common/__init__.py similarity index 90% rename from config/boards/qemu_arm_virt_ca7.gni rename to hb/common/__init__.py index 2dad515..deab585 100755 --- a/config/boards/qemu_arm_virt_ca7.gni +++ b/hb/common/__init__.py @@ -1,15 +1,17 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -board_arch = "armv7-a" -board_cpu = "cortex-a7" +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/hb/common/config.json b/hb/common/config.json new file mode 100755 index 0000000..710646d --- /dev/null +++ b/hb/common/config.json @@ -0,0 +1,8 @@ +{ + "root_path": null, + "board": null, + "kernel": null, + "product": null, + "product_path": null, + "device_path": null +} diff --git a/hb/common/config.py b/hb/common/config.py new file mode 100755 index 0000000..0e17254 --- /dev/null +++ b/hb/common/config.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from distutils.spawn import find_executable + +from hb import CONFIG_JSON +from hb import CONFIG_STRUCT +from hb.common.utils import read_json_file +from hb.common.utils import dump_json_file +from hb.common.utils import Singleton + + +class Config(metaclass=Singleton): + def __init__(self): + self.config_json = CONFIG_JSON + + config_content = read_json_file(self.config_json) + self._root_path = config_content.get('root_path', None) + self._board = config_content.get('board', None) + self._kernel = config_content.get('kernel', None) + self._product = config_content.get('product', None) + self._product_path = config_content.get('product_path', None) + self._device_path = config_content.get('device_path', None) + self._out_path = None + + @property + def root_path(self): + if self._root_path is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + + return self._root_path + + @root_path.setter + def root_path(self, value): + self._root_path = os.path.abspath(value) + if not os.path.isdir(self._root_path): + raise Exception('{} is not a valid path'.format(self._root_path)) + + config_path = os.path.join(self._root_path, 'ohos_config.json') + if not os.path.isfile(config_path): + self.config_create(config_path) + self.config_update('root_path', self._root_path) + + @property + def board(self): + if self._board is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + return self._board + + @board.setter + def board(self, value): + self._board = value + self.config_update('board', self._board) + + @property + def kernel(self): + if self._kernel is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + return self._kernel + + @kernel.setter + def kernel(self, value): + self._kernel = value + self.config_update('kernel', self._kernel) + + @property + def product(self): + if self._product is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + return self._product + + @product.setter + def product(self, value): + self._product = value + self.config_update('product', self._product) + + @property + def product_path(self): + if self._product_path is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + return self._product_path + + @product_path.setter + def product_path(self, value): + self._product_path = value + self.config_update('product_path', self._product_path) + + @property + def gn_product_path(self): + return self.product_path.replace(self.root_path, '/') + + @property + def device_path(self): + if self._device_path is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + return self._device_path + + @device_path.setter + def device_path(self, value): + self._device_path = value + self.config_update('device_path', self._device_path) + + @property + def gn_device_path(self): + return self.device_path.replace(self.root_path, '/') + + @property + def build_path(self): + return os.path.join(self.root_path, 'build', 'lite') + + @property + def out_path(self): + return self._out_path + + @out_path.setter + def out_path(self, value): + self._out_path = value + + @property + def log_path(self): + return os.path.join(self.out_path, 'build.log') + + @property + def vendor_path(self): + return os.path.join(self.root_path, 'vendor') + + @property + def gn_path(self): + repo_gn_path = os.path.join(self.root_path, + 'prebuilts', + 'build-tools', + 'linux-x86', + 'bin', + 'gn') + if os.path.isfile(repo_gn_path): + return repo_gn_path + + env_gn_path = find_executable('gn') + if env_gn_path is not None: + return env_gn_path + + raise Exception('gn not found, install it please') + + @property + def ninja_path(self): + repo_ninja_path = os.path.join(self.root_path, + 'prebuilts', + 'build-tools', + 'linux-x86', + 'bin', + 'ninja') + if os.path.isfile(repo_ninja_path): + return repo_ninja_path + + env_ninja_path = find_executable('ninja') + if env_ninja_path is not None: + return env_ninja_path + + raise Exception('ninja not found, install it please') + + @property + def clang_path(self): + repo_clang_path = os.path.join('prebuilts', + 'clang', + 'ohos', + 'linux-x86_64', + 'llvm') + if os.path.isdir(repo_clang_path): + return f'//{repo_clang_path}' + + env_clang_bin_path = find_executable('clang') + if env_clang_bin_path is not None: + env_clang_path = os.path.abspath(os.path.join(env_clang_bin_path, + os.pardir, + os.pardir)) + + if os.path.basename(env_clang_path) == 'llvm': + return env_clang_path + + raise Exception('clang not found, install it please') + + def config_create(self, config_path): + dump_json_file(config_path, CONFIG_STRUCT) + self.config_json = config_path + + def config_update(self, key, value): + config_content = read_json_file(self.config_json) + config_content[key] = value + dump_json_file(self.config_json, config_content) diff --git a/hb/common/device.py b/hb/common/device.py new file mode 100755 index 0000000..db1ee03 --- /dev/null +++ b/hb/common/device.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import re + +from hb.common.config import Config +from hb.cts.menuconfig import Menuconfig + + +class Device(): + @staticmethod + def is_in_device(): + cwd_pardir = os.path.dirname(os.path.dirname(os.getcwd())) + config = Config() + return os.path.join(config.root_path, 'device') == cwd_pardir + + @staticmethod + def is_kernel(kernel_path): + return os.path.isdir(kernel_path) and\ + 'config.gni' in os.listdir(kernel_path) + + @staticmethod + def device_menuconfig(): + kernel_path_dict = {} + cwd = os.getcwd() + Device.check_path(cwd) + + for kernel_config, kernel_path in Device.get_kernel_config(cwd): + kernel_type, kernel_version = Device.get_kernel_info(kernel_config) + kernel_path_dict['{}@{}'.format(kernel_type, kernel_version)] =\ + kernel_path + + if not len(kernel_path_dict): + raise Exception('no valid kernel found') + + choices = [{'name': kernel} for kernel in kernel_path_dict.keys()] + + menu = Menuconfig() + kernel = menu.list_promt('kernel', + 'Which kernel do you need?', + choices).get('kernel') + return kernel_path_dict.get(kernel), kernel.split('@')[0],\ + os.path.basename(cwd) + + @staticmethod + def get_device_path(board_path, kernel_type, kernel_version): + for kernel_config, kernel_path in Device.get_kernel_config(board_path): + if Device.match_kernel(kernel_config, + kernel_type, + kernel_version): + return kernel_path + + raise Exception('cannot find {}_{} in {}'.format(kernel_type, + kernel_version, + board_path)) + + @staticmethod + def get_kernel_config(board_path): + Device.check_path(board_path) + for kernel in os.listdir(board_path): + kernel_path = os.path.join(board_path, kernel) + + if os.path.isdir(kernel_path): + kernel_config = os.path.join(kernel_path, 'config.gni') + if not os.path.isfile(kernel_config): + continue + yield kernel_config, kernel_path + + @staticmethod + def match_kernel(config, kernel, version): + kernel_pattern = r'kernel_type ?= ?"{}"'.format(kernel) + version_pattern = r'kernel_version ?= ?"{}"'.format(version) + + with open(config, 'rt') as config_file: + data = config_file.read() + return re.search(kernel_pattern, data) and\ + re.search(version_pattern, data) + + @staticmethod + def get_kernel_info(config): + kernel_pattern = r'kernel_type ?= ?"(\w+)"' + version_pattern = r'kernel_version ?= ?"([a-zA-Z0-9._]*)"' + + with open(config, 'rt') as config_file: + data = config_file.read() + kernel_list = re.findall(kernel_pattern, data) + version_list = re.findall(version_pattern, data) + if not len(kernel_list) or not len(version_list): + raise Exception('kernel_type or kernel_version ' + 'not found in {}'.format(config)) + + return kernel_list[0], version_list[0] + + @staticmethod + def check_path(path): + if os.path.isdir(path) or os.path.isfile(path): + return + raise Exception('invalid path: {}'.format(path)) diff --git a/hb/common/product.py b/hb/common/product.py new file mode 100755 index 0000000..c72cab0 --- /dev/null +++ b/hb/common/product.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from collections import defaultdict + +from hb.common.utils import read_json_file +from hb.common.config import Config +from hb.cts.menuconfig import Menuconfig + + +class Product(): + @staticmethod + def get_products(): + config = Config() + for company in os.listdir(config.vendor_path): + company_path = os.path.join(config.vendor_path, company) + if not os.path.isdir(company_path): + continue + + for product in os.listdir(company_path): + product_path = os.path.join(company_path, product) + config_path = os.path.join(product_path, 'config.json') + + if os.path.isfile(config_path): + product_name = read_json_file(config_path).\ + get('product_name') + if product_name is not None: + yield company, product_name, product_path + + @staticmethod + def get_device_info(product_json): + product_content = read_json_file(product_json) + return product_content.get('board', None),\ + product_content.get('kernel_type', None),\ + product_content.get('kernel_version', None),\ + product_content.get('device_company', None) + + @staticmethod + def get_features(product_json): + if not os.path.isfile(product_json): + raise Exception('{} not found'.format(product_json)) + + features_list = [] + subsystems = read_json_file(product_json).get('subsystems', []) + for subsystem in subsystems: + for component in subsystem.get('components', []): + features = component.get('features', []) + features_list += [feature for feature in features + if len(feature)] + + return features_list + + @staticmethod + def get_components(product_json, subsystems): + if not os.path.isfile(product_json): + raise Exception('{} not found'.format(product_json)) + + components_dict = defaultdict(list) + product_data = read_json_file(product_json) + for subsystem in product_data.get('subsystems', []): + sname = subsystem.get('subsystem', '') + if not len(subsystems) or sname in subsystems: + components_dict[sname] += [comp['component'] for comp in + subsystem.get('components', [])] + + return components_dict, product_data.get('board', ''),\ + product_data.get('kernel_type', '') + + @staticmethod + def get_product_path(product_name, company): + for cur_company, cur_product, product_path in Product.get_products(): + if cur_company == company and cur_product == product_name: + return product_path + + raise Exception('product {}@{} not found'. + format(product_name, company)) + + @staticmethod + def product_menuconfig(): + product_path_dict = {} + for company, product, product_path in Product.get_products(): + product_path_dict['{}@{}'.format(product, company)] = product_path + + if not len(product_path_dict): + raise Exception('no valid product found') + + choices = [{'name': product} for product in product_path_dict.keys()] + menu = Menuconfig() + product = menu.list_promt('product', + 'Which product do you need?', + choices).get('product') + + return product_path_dict.get(product), product.split('@')[0] diff --git a/hb/common/utils.py b/hb/common/utils.py new file mode 100755 index 0000000..0d9703a --- /dev/null +++ b/hb/common/utils.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import re +import subprocess +import shutil +import sys +import json +from collections import namedtuple + + +def encode(data, encoding='utf-8'): + if sys.version_info.major == 2: + return data.encode(encoding) + return data + + +def decode(data, encoding='utf-8'): + if sys.version_info.major == 2: + return data.decode(encoding) + return data + + +def remove_path(path): + if os.path.exists(path): + shutil.rmtree(path) + + +# Read json file data +def read_json_file(input_file): + if not os.path.isfile(input_file): + raise OSError('{} not found'.format(input_file)) + + with open(input_file, 'rb') as input_f: + try: + data = json.load(input_f) + return data + except json.JSONDecodeError: + raise Exception('{} parsing error!'.format(input_file)) + + +def dump_json_file(dump_file, json_data): + with open(dump_file, 'wt') as json_file: + json.dump(json_data, + json_file, + ensure_ascii=False, + indent=2) + + +def get_input(msg): + try: + user_input = input + except NameError: + raise Exception('python2.x not supported') + return user_input(msg) + + +def exec_command(cmd, log_path='out/build.log', **kwargs): + useful_info_pattern = re.compile(r'\[\d+/\d+\].+') + is_log_filter = kwargs.pop('log_filter', False) + + with open(log_path, 'at') as log_file: + process = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True, + **kwargs) + for line in iter(process.stdout.readline, ''): + if is_log_filter: + info = re.findall(useful_info_pattern, line) + if len(info): + hb_info(info[0]) + else: + hb_info(line) + log_file.write(line) + + process.wait() + ret_code = process.returncode + + if ret_code != 0: + with open(log_path, 'at') as log_file: + for line in iter(process.stderr.readline, ''): + if 'ninja: warning' in line: + log_file.write(line) + continue + hb_error(line) + log_file.write(line) + + if is_log_filter: + get_failed_log(log_path) + + hb_error('you can check build log in {}'.format(log_path)) + if isinstance(cmd, list): + cmd = ' '.join(cmd) + raise Exception("{} failed, return code is {}".format(cmd, ret_code)) + + +def get_failed_log(log_path): + with open(log_path, 'rt') as log_file: + data = log_file.read() + failed_pattern = re.compile(r'(\[\d+/\d+\].*?)(?=\[\d+/\d+\]|' + 'ninja: build stopped)', re.DOTALL) + failed_log = failed_pattern.findall(data) + for log in failed_log: + if 'FAILED:' in log: + hb_error(log) + + error_log = os.path.join(os.path.dirname(log_path), 'error.log') + if os.path.isfile(error_log): + with open(error_log, 'rt') as log_file: + hb_error(log_file.read()) + + +def check_output(cmd, **kwargs): + try: + ret = subprocess.check_output(cmd, + stderr=subprocess.STDOUT, + universal_newlines=True, + **kwargs) + except subprocess.CalledProcessError as called_exception: + ret = called_exception.output + if isinstance(cmd, list): + cmd = ' '.join(cmd) + raise Exception("{} failed, failed log is {}".format(cmd, ret)) + + return ret + + +def makedirs(path, exist_ok=True): + try: + os.makedirs(path) + except OSError: + if not os.path.isdir(path): + raise Exception("{} makedirs failed".format(path)) + if not exist_ok: + raise Exception("{} exists, makedirs failed".format(path)) + + +def get_project_path(json_path): + json_data = read_json_file(json_path) + + return json_data.get('root_path') + + +def args_factory(args_dict): + if not len(args_dict): + raise Exception('at least one k_v param is required in args_factory') + + args_cls = namedtuple('Args', [key for key in args_dict.keys()]) + args = args_cls(**args_dict) + return args + + +def hb_info(msg): + level = 'info' + for line in msg.splitlines(): + sys.stdout.write(message(level, line)) + sys.stdout.flush() + + +def hb_warning(msg): + level = 'warning' + for line in msg.splitlines(): + sys.stderr.write(message(level, line)) + sys.stderr.flush() + + +def hb_error(msg): + level = 'error' + for line in msg.splitlines(): + sys.stderr.write(message(level, line)) + sys.stderr.flush() + + +def message(level, msg): + if isinstance(msg, str) and not msg.endswith('\n'): + msg += '\n' + return '[OHOS {}] {}'.format(level.upper(), msg) + + +class Singleton(type): + _instances = {} + + def __call__(cls, *args, **kwargs): + if cls not in cls._instances: + cls._instances[cls] = super(Singleton, cls).__call__(*args, + **kwargs) + return cls._instances[cls] diff --git a/config/boards/hi3516dv300.gni b/hb/cts/__init__.py similarity index 90% rename from config/boards/hi3516dv300.gni rename to hb/cts/__init__.py index 2dad515..deab585 100755 --- a/config/boards/hi3516dv300.gni +++ b/hb/cts/__init__.py @@ -1,15 +1,17 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -board_arch = "armv7-a" -board_cpu = "cortex-a7" +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/hb/cts/checkbox.py b/hb/cts/checkbox.py new file mode 100755 index 0000000..077579c --- /dev/null +++ b/hb/cts/checkbox.py @@ -0,0 +1,260 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from __future__ import print_function +from __future__ import unicode_literals +from collections import defaultdict + +from prompt_toolkit.application import Application +from prompt_toolkit.key_binding.manager import KeyBindingManager +from prompt_toolkit.keys import Keys +from prompt_toolkit.layout.containers import Window +from prompt_toolkit.filters import IsDone +from prompt_toolkit.layout.controls import TokenListControl +from prompt_toolkit.layout.containers import ConditionalContainer +from prompt_toolkit.layout.containers import ScrollOffsets +from prompt_toolkit.layout.containers import HSplit +from prompt_toolkit.layout.dimension import LayoutDimension as D +from prompt_toolkit.token import Token + +from hb.cts.common import get_style +from hb.cts.common import if_mousedown +from hb.cts.common import select_node +from hb.cts.common import deselect_node +from hb.cts.common import Separator + + +class InquirerControl(TokenListControl): + def __init__(self, choices, **kwargs): + self.pointer_index = 0 + self.selected_options = [] # list of names + self.answered = False + self._init_choices(choices) + self.deps = kwargs.pop('deps') + self.nodes_from = defaultdict(list) + super(InquirerControl, self).__init__(self._get_choice_tokens, + **kwargs) + + def _init_choices(self, choices): + # helper to convert from question format to internal format + self.choices = [] # list (name, value) + searching_first_choice = True + for index, choice in enumerate(choices): + if isinstance(choice, Separator): + self.choices.append(choice) + else: + name = choice['name'] + value = choice.get('value', name) + disabled = choice.get('disabled', None) + if 'checked' in choice and choice['checked'] and not disabled: + self.selected_options.append(choice['name']) + self.choices.append((name, value, disabled)) + if searching_first_choice and not disabled: + self.pointer_index = index + searching_first_choice = False + + @property + def choice_count(self): + return len(self.choices) + + def _get_choice_tokens(self, cli): + tokens = [] + token = Token + + def append(index, line): + if isinstance(line, Separator): + tokens.append((token.Separator, ' %s\n' % line)) + else: + line_name = line[0] + line_value = line[1] + selected = (line_value in self.selected_options) + pointed_at = (index == self.pointer_index) + + @if_mousedown + def select_item(cli, mouse_event): + # bind option with this index to mouse event + if line_value in self.selected_options: + deselect_node(line_value, self.selected_options, + self.nodes_from, self.deps) + else: + select_node(line_value, self.selected_options, + self.nodes_from, self.deps) + + if pointed_at: + tokens.append((token.Pointer, ' \u276f', select_item)) + else: + tokens.append((token, ' ', select_item)) + # 'o ' - FISHEYE + if choice[2]: # disabled + tokens.append((token, '- %s (%s)' % + (choice[0], choice[2]))) + else: + if selected: + tokens.append((token.Selected, '\u25cf ', select_item)) + else: + tokens.append((token, '\u25cb ', select_item)) + + if pointed_at: + tokens.append((Token.SetCursorPosition, '')) + + tokens.append((token, line_name, select_item)) + tokens.append((token, '\n')) + + # prepare the select choices + for i, choice in enumerate(self.choices): + append(i, choice) + tokens.pop() # Remove last newline. + return tokens + + def get_selected_values(self): + # get values not labels + return [c[1] for c in self.choices if not isinstance(c, Separator) and + c[1] in self.selected_options] + + @property + def line_count(self): + return len(self.choices) + + +def question(message, **kwargs): + if 'default' in kwargs: + raise ValueError('Checkbox does not implement \'default\' ' + 'use \'checked\':True\' in choice!') + + deps = kwargs.pop('deps') + choices = kwargs.pop('choices', None) + style = kwargs.pop('style', get_style('terminal')) + + inquirer_control = kwargs.pop('inquirer_control', None) + if inquirer_control is None: + inquirer_control = InquirerControl(choices, deps=deps) + + qmark = kwargs.pop('qmark', '?') + + def get_prompt_tokens(cli): + tokens = [] + + tokens.append((Token.QuestionMark, qmark)) + tokens.append((Token.Question, ' %s ' % message)) + if inquirer_control.answered: + nbr_selected = len(inquirer_control.selected_options) + if nbr_selected == 0: + tokens.append((Token.Answer, ' done')) + elif nbr_selected == 1: + tokens.append((Token.Answer, ' [%s]' % + inquirer_control.selected_options[0])) + else: + tokens.append((Token.Answer, + ' done (%d selections)' % nbr_selected)) + else: + tokens.append((Token.Instruction, + ' (, to move, to select, ' + 'to toggle, to invert)')) + return tokens + + # assemble layout + layout = HSplit([ + Window(height=D.exact(1), + content=TokenListControl(get_prompt_tokens, + align_center=False)), + ConditionalContainer( + Window( + inquirer_control, + width=D.exact(43), + height=D(min=3), + scroll_offsets=ScrollOffsets(top=1, bottom=1) + ), + filter=~IsDone() + ) + ]) + + # key bindings + manager = KeyBindingManager.for_prompt() + + @manager.registry.add_binding(Keys.ControlQ, eager=True) + @manager.registry.add_binding(Keys.ControlC, eager=True) + def _(event): + raise KeyboardInterrupt() + + @manager.registry.add_binding(' ', eager=True) + def toggle(event): + pointer_index = inquirer_control.pointer_index + pointed_choice = inquirer_control.choices[pointer_index][1] # value + if pointed_choice in inquirer_control.selected_options: + deselect_node(pointed_choice, inquirer_control.selected_options, + inquirer_control.nodes_from, deps) + else: + select_node(pointed_choice, inquirer_control.selected_options, + inquirer_control.nodes_from, deps) + + @manager.registry.add_binding('i', eager=True) + def invert(event): + inverted_selection = [c[1] for c in inquirer_control.choices if + not isinstance(c, Separator) and + c[1] not in inquirer_control.selected_options and + not c[2]] + inquirer_control.selected_options = inverted_selection + + @manager.registry.add_binding('a', eager=True) + def select_all(event): + all_selected = True # all choices have been selected + for choice in inquirer_control.choices: + if not isinstance(choice, Separator) and \ + choice[1] not in inquirer_control.selected_options and \ + not choice[2]: + # add missing ones + inquirer_control.selected_options.append(choice[1]) + all_selected = False + if all_selected: + inquirer_control.selected_options = [] + + @manager.registry.add_binding(Keys.Down, eager=True) + def move_cursor_down(event): + def _next(): + inquirer_control.pointer_index = \ + ((inquirer_control.pointer_index + 1) % + inquirer_control.line_count) + _next() + while isinstance(inquirer_control.choices[ + inquirer_control.pointer_index], Separator) or \ + inquirer_control.choices[inquirer_control.pointer_index][2]: + _next() + + @manager.registry.add_binding(Keys.Up, eager=True) + def move_cursor_up(event): + def _prev(): + inquirer_control.pointer_index = \ + ((inquirer_control.pointer_index - 1) % + inquirer_control.line_count) + _prev() + while isinstance(inquirer_control.choices[ + inquirer_control.pointer_index], Separator) or \ + inquirer_control.choices[inquirer_control.pointer_index][2]: + _prev() + + @manager.registry.add_binding(Keys.Enter, eager=True) + def set_answer(event): + inquirer_control.answered = True + event.cli.set_return_value(inquirer_control) + + return Application( + layout=layout, + key_bindings_registry=manager.registry, + mouse_support=True, + style=style + ) diff --git a/hb/cts/common.py b/hb/cts/common.py new file mode 100755 index 0000000..c5be530 --- /dev/null +++ b/hb/cts/common.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import json +try: + from queue import Queue +except ImportError: + from Queue import Queue +from collections import defaultdict + +from prompt_toolkit.styles import style_from_dict +from prompt_toolkit.token import Token +from prompt_toolkit.mouse_events import MouseEventTypes + +from hb.common.utils import read_json_file + + +def get_style(style_type): + if style_type == 'terminal': + return style_from_dict({ + Token.Separator: '#6C6C6C', + Token.QuestionMark: '#5F819D', + Token.Selected: '', # default + Token.Pointer: '#FF9D00 bold', # AWS orange + Token.Instruction: '', # default + Token.Answer: '#FF9D00 bold', # AWS orange + Token.Question: 'bold', + }) + if style_type == 'answer': + return style_from_dict({ + Token.Separator: '#cc5454', + Token.QuestionMark: '#E91E63 bold', + Token.Selected: '#cc5454', # default + Token.Pointer: '#ed9164 bold', + Token.Instruction: '', # default + Token.Answer: '#f44336 bold', + Token.Question: '', + }) + + return None + + +def if_mousedown(handler): + def handle_if_mouse_down(cli, mouse_event): + if mouse_event.event_type == MouseEventTypes.MOUSE_DOWN: + return handler(cli, mouse_event) + else: + return NotImplemented + + return handle_if_mouse_down + + +def get_deps(platform_json): + platform = read_json_file(platform_json) + subsystem_dict = {} + component_deps = defaultdict(list) + component_targets = {} + component_dirs = {} + for subsystem in platform['subsystems']: + subsystem_dict[subsystem['subsystem']] = [] + for component in subsystem['components']: + cname = component['component'] + subsystem_dict[subsystem['subsystem']].append(cname) + if 'components' in component['deps']: + deps = component['deps']['components'] + if cname in deps: + deps.remove(cname) + else: + deps = [] + component_deps[cname] = deps + component_targets[cname] = component['targets'] + component_dirs[cname] = [ + os.path.join(os.path.dirname(platform_json), + os.pardir, os.pardir, os.pardir, os.pardir, path) + for path in component['dirs']] + + return subsystem_dict, component_deps, component_targets, component_dirs + + +def select_node(node, selected, nodes_from, deps): + queue = Queue() + queue.put(node) + nodes_from[node].append(node) + + while not queue.empty(): + now_node = queue.get() + if now_node not in selected: + selected.append(now_node) + for dep in deps.get(now_node, []): + if now_node != dep and dep not in selected: + queue.put(dep) + nodes_from[dep].append(node) + + +def deselect_node(node, selected, nodes_from, deps): + queue = Queue() + queue.put(node) + node_list = [] + + while not queue.empty(): + now_node = queue.get() + for each_node in nodes_from[now_node]: + queue.put(each_node) + nodes_from[now_node].clear() + if now_node in selected: + selected.remove(now_node) + node_list.append(now_node) + + [queue.put(n) for n in node_list] + while not queue.empty(): + now_node = queue.get() + for dep in deps.get(now_node, []): + if dep not in selected: + continue + nodes_from[dep] = [n for n in nodes_from[dep] if n in selected] + if not len(nodes_from[dep]): + selected.remove(dep) + queue.put(dep) + + +def get_deps_list(comp, deps): + queue = Queue() + visited = set() + deps_list = [comp] + queue.put(comp) + + while not queue.empty(): + node = queue.get() + for index, dep_comp in enumerate(deps[node]): + if dep_comp in visited: + continue + deps_list.append(dep_comp) + queue.put(dep_comp) + visited.add(dep_comp) + + return deps_list + + +def get_support_product(product_path): + product_dict = defaultdict(list) + for product in os.listdir(product_path): + product_json = os.path.join(product_path, product) + product_content = read_json_file(product_json) + board = product_content.get('board') + kernel = product_content.get('kernel') + platform = "{}_{}".format(board, kernel) + product_dict[platform].append(product.strip('.json')) + + return product_dict + + +def check_path(dep, path): + dep = dep[:-1] if dep.endswith("/") else dep + path = path[:-1] if path.endswith("/") else path + + if len(dep) > len(path): + path_max = dep + path_min = path + else: + path_max = path + path_min = dep + + if path_min in path_max: + path_sub = path_max.replace(path_min, "") + if path_sub == "": + return True + if path_sub.startswith('/') or path_sub.startswith(':'): + return True + return False + + +class Separator(object): + line = '-' * 15 + + def __init__(self, line=None): + if line: + self.line = line + + def __str__(self): + return self.line diff --git a/hb/cts/cts.py b/hb/cts/cts.py new file mode 100755 index 0000000..f2928e7 --- /dev/null +++ b/hb/cts/cts.py @@ -0,0 +1,488 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import json +import shutil +from subprocess import check_output +from subprocess import CalledProcessError +try: + from queue import Queue +except ImportError: + from Queue import Queue +from collections import defaultdict + +from hb import CONFIG_JSON +from hb.common.utils import read_json_file +from hb.cts.common import check_path +from hb.common.utils import get_project_path +from hb.common.utils import hb_info +from hb.common.utils import hb_warning + + +class CTS(): + def __init__(self): + self._board = None + self._kernel = None + self.kernel_of_board = defaultdict(list) + self._set_path() + self.fields = defaultdict(list) + self.comp_fields = defaultdict(list) + + def __iter__(self): + for subsystem_cls in self.subsystems: + yield subsystem_cls + + def _set_path(self): + self._code_path = get_project_path(CONFIG_JSON) + if self._code_path is None: + raise Exception('Please run command "hb set" to ' + 'init OHOS development environment') + + self._components_path = os.path.join(self._code_path, + 'build', + 'lite', + 'components') + + self._platform_path = os.path.join(self._code_path, + 'build', + 'lite', + 'platform') + + self._kernel_path = os.path.join(self._components_path, + 'kernel.json') + + self._product_path = os.path.join(self._code_path, + 'build', + 'lite', + 'product') + + @property + def board(self): + return self._board + + @board.setter + def board(self, board): + self._board = board + self.update_special_deps() + + @property + def kernel(self): + return self._kernel + + @kernel.setter + def kernel(self, kernel): + self._kernel = kernel + self.update_special_deps() + + @property + def code_path(self): + return self._code_path + + @property + def components_path(self): + return self._components_path + + @property + def platform_path(self): + return self._platform_path + + @property + def kernel_path(self): + return self._kernel_path + + @property + def product_path(self): + return self._product_path + + def init(self, board=None): + if board is None: + if self.board is None: + raise Exception('no board selected') + else: + self.board = board + + self.init_from_json() + + def init_from_json(self): + self.subsystems = [] + subsystem_list = os.listdir(self._components_path) + subsystem_list.sort() + + for subsystem in subsystem_list: + sname = subsystem.replace('.json', '') + spath = os.path.join(self._components_path, subsystem) + scontent = read_json_file(spath) + subsystem_cls = Subsystem(sname, scontent, spath) + self.subsystems.append(subsystem_cls) + for cname, component in subsystem_cls: + for fpath in component.dirs: + self.fields[fpath] = cname + self.comp_fields[cname].append(fpath) + + def update_special_deps(self): + if self._board is None: + return + if self._kernel is None: + return + + for subsystem_cls in self: + for cname, component_cls in subsystem_cls: + deps_board = component_cls.deps_board.get(self._board, []) + deps_kernel = component_cls.deps_kernel.get(self._kernel, []) + component_cls.deps_comp += list(set(deps_board + deps_kernel)) + + def update_subsystems_product(self, nodes=None, board=None, kernel=None): + if board is None: + board = self.board + if kernel is None: + kernel = self.kernel + + subsystems_list = [] + comp_cls_dict = {} + for subsystem_cls in self: + subsystem_dict = { + 'subsystem': subsystem_cls.name, + 'components': [] + } + for cname, component_cls in subsystem_cls: + if not component_cls.is_board_in_comp(board): + continue + if not component_cls.is_kernel_in_comp(kernel): + continue + if nodes is not None and cname not in nodes: + continue + + comp_cls_dict[cname] = component_cls + component_dict = {'component': component_cls.name, + 'features': component_cls.features} + subsystem_dict['components'] += [component_dict] + if len(subsystem_dict['components']): + subsystems_list.append(subsystem_dict) + self.update_comp_deps(comp_cls_dict) + + return subsystems_list + + def update_subsystems_platform(self, subsystem_list=None): + for subsystem_cls in self: + if len(subsystem_list) and \ + subsystem_cls.name not in subsystem_list: + continue + subsystem_cls.update_json() + + def update_comp_deps(self, comp_cls_dict): + for cname, comp_cls in comp_cls_dict.items(): + cls_deps_list = [] + for dep_comp_name in comp_cls.deps_comp: + dep_comp_cls = comp_cls_dict.get(dep_comp_name, None) + if dep_comp_cls is None: + pass + cls_deps_list.append(dep_comp_cls) + comp_cls.deps_comp = cls_deps_list + + +class Subsystem(): + def __init__(self, subsystem_name, subsystem_json, subsystem_json_path): + self.name = subsystem_name + self.comps = {} + self.json_path = subsystem_json_path + self.json_content = subsystem_json + self._init_comps(subsystem_json) + + def __iter__(self): + for cname, component_cls in self.comps.items(): + yield cname, component_cls + + def _init_comps(self, subsystem_json): + component_list = subsystem_json.get('components') + for component_json in component_list: + cname = component_json.get('component') + self.comps[cname] = (Component(cname, component_json)) + + def update_json(self): + component_list = self.json_content.get('components', []) + for index, component in enumerate(component_list): + cname = component.get('component', '') + component_cls = self.comps.get(cname, None) + component_list[index]['deps'] = component_cls.get_real_deps() + + self.json_content['components'] = component_list + with open(self.json_path, 'wt') as file: + json.dump(self.json_content, file, + ensure_ascii=False, indent=2) + + +class Component(): + def __init__(self, component_name, component_json): + self.name = component_name + self.deps_comp = [] + self.deps_thirdparty = [] + self.copy_dirs = [] + self._init_comp(component_json) + self.deps_dict = {} + self.thirdparty_set = set() + self.deps_real_dict = {} + + def _init_comp(self, component_json): + self.dirs = component_json.get('dirs', []) + self.targets = component_json.get('targets', []) + self.adapted_board = component_json.get('adapted_board', None) + self.adapted_kernel = component_json.get('adapted_kernel', None) + self.features = component_json.get('features', None) + + deps = component_json.get('deps', {}) + self.deps_comp += deps.get('components', []) + self.deps_thirdparty += deps.get('third_party', []) + self.deps_board = deps.get('board_special', {}) + self.deps_kernel = deps.get('kernel_special', {}) + + def is_dir_in_comp(self, path): + if path in self.dirs: + return True + return False + + def is_board_in_comp(self, board): + if self.adapted_board is None: + return True + if board in self.adapted_board: + return True + + return False + + def is_kernel_in_comp(self, kernel): + if self.adapted_kernel is None: + return True + if kernel in self.adapted_kernel: + return True + + return False + + def remove_copy_dirs(self, work_path): + os.chdir(work_path) + for copy_dir in self.copy_dirs: + if os.path.exists(copy_dir): + shutil.rmtree(copy_dir) + + def get_deps_ready(self, work_path, root_path): + queue = Queue() + visited = set() + deps_cls_list = [self] + tree = [{'name': self.name, 'children': []}] + now_tree = tree[0]["children"] + queue.put((self, now_tree)) + + while not queue.empty(): + cur_comp, now_tree = queue.get() + for i, dep_comp_cls in enumerate(cur_comp.deps_comp): + if dep_comp_cls in visited: + continue + if dep_comp_cls is None: + hb_warning('{} has NoneType dep'.format(cur_comp.name)) + continue + deps_cls_list.append(dep_comp_cls) + now_tree.append({'name': dep_comp_cls.name, 'children': []}) + queue.put((dep_comp_cls, now_tree[-1]['children'])) + visited.add(dep_comp_cls) + + if not hasattr(self, 'copy_dirs'): + self.copy_dirs = [] + for comp_cls in deps_cls_list: + for path in comp_cls.dirs: + src_path = os.path.join(root_path, path) + des_path = os.path.join(work_path, path.split("../")[-1]) + try: + shutil.copytree(src_path, + des_path, + symlinks=False, + ignore=shutil.ignore_patterns('.git', + '.repo')) + except OSError: + pass + else: + self.copy_dirs.append(des_path) + + return tree + + def gn_desc(self, out_file, target, *args): + cmd = ['./prebuilts/build-tools/linux-x86/bin/gn', + '--root=.', + '--dotfile=build/lite/.gn', + 'desc', + out_file, + target, *args] + + cwd = os.path.abspath(os.path.join(out_file, os.pardir, + os.pardir, os.pardir)) + ret = check_output(cmd, cwd=cwd).decode('utf-8') + return ret + + def get_component_deps(self, out_file, now_target, comp_fields): + include_list = [] + include_dirs_list = [now_target] + deps_list = [] + + ret = self.gn_desc(out_file, now_target, 'deps', '--tree') + hb_info(f'target: {now_target} cmd: deps --tree') + hb_info(ret) + + ret_content = [line for line in ret.split('\n') + if len(line) and '\n' not in line] + + index = 0 + while index < len(ret_content): # get deps of the now_target + cur_line = ret_content[index] + if '...' in cur_line: # cur_line already exists. + index += 1 + continue + space_now = cur_line.count(' ') + for path in comp_fields[self.name]: + # cur_line is part of current comp, + # needs to be further processed. + if path in cur_line: + index += 1 + include_dirs_list.append(cur_line.replace(' ', '')) + break + else: + deps_list.append(cur_line.replace(' ', '').replace('//', '')) + index += 1 + while index < len(ret_content) and \ + ret_content[index].count(' ') > space_now: + index += 1 + for target in include_dirs_list: + try: + ret = self.gn_desc(out_file, target, 'include_dirs') + hb_info(f'target: {now_target} cmd: include_dirs') + hb_info(ret) + include_list += [include.replace('//', '') + for include in ret.split('\n') + if '\n' not in include and len(include)] + except CalledProcessError: + pass + return deps_list, include_list + + def get_deps(self, board, kernel, out_file, comp_fields, fields): + deps_list = [] + include_list = [] + for now_target in self.targets: + now_deps, now_include = self.get_component_deps(out_file, + now_target, + comp_fields) + deps_list += now_deps + include_list += now_include + + deps_ori = list(set(deps_list) | set(include_list)) + + comp_deps_set = set() + for dep in deps_ori: + if 'prebuilts' in dep or 'build/lite' in dep: + continue + for path in comp_fields[self.name]: + if dep in path or path in dep: + break + else: + for path, cname in fields.items(): + if check_path(dep, path): + if 'hdf' in cname: # special processing for hdf + cname = 'hdf_{}_{}'.format(board, kernel) + if cname != self.name: + comp_deps_set.add(cname) + break + else: + # special processing for third_party + if dep.startswith('third_party'): + strlist = dep.split('/')[1].split(':')[0].lower() + self.thirdparty_set.add(strlist.replace('-', '_')) + else: + comp_deps_set.add(dep) + self.deps_dict[(board, kernel)] = comp_deps_set + + def get_real_deps(self): + components_set = set() + board_common = None + kernel_common = None + board_special = {} + kernel_special = {} + + if len(self.deps_dict) == 1: + _, components_set = self.deps_dict.popitem() + elif len(self.deps_dict) > 1: + for _, now_deps in self.deps_dict.items(): + board_common = now_deps if board_common is None\ + else board_common & now_deps + for _, now_deps in self.deps_dict.items(): + kernel_common = now_deps if kernel_common is None\ + else kernel_common & now_deps + + for (board, kernel), now_deps in self.deps_dict.items(): + board_special[board] = now_deps - board_common + kernel_special[kernel] = now_deps - kernel_common + + special_common = None + for _, now_deps in board_special.items(): + special_common = now_deps if special_common is None\ + else special_common & now_deps + for board, now_deps in board_special.items(): + board_special[board] -= special_common + + components_set = components_set.union(board_common, + kernel_common, + special_common) + + special_common = None + for _, now_deps in kernel_special.items(): + special_common = now_deps if special_common is None\ + else special_common & now_deps + for kernel, now_deps in kernel_special.items(): + kernel_special[kernel] -= special_common + + components_set = components_set.union(special_common) + + return self.get_deps_sort(components_set, + kernel_special, + board_special) + + def get_deps_sort(self, components_set, kernel_special, board_special): + thirdparty_list = list(self.thirdparty_set) + thirdparty_list.sort() + components_list = list(components_set) + components_list.sort() + + kernel_list = [kernel for kernel in kernel_special.keys()] + kernel_list.sort() + for kernel in kernel_list: + kernel_special[kernel] = list(kernel_special[kernel]) + kernel_special[kernel].sort() + + board_list = [board for board in board_special.keys()] + board_list.sort() + for board in board_list: + board_special[board] = list(board_special[board]) + board_special[board].sort() + + self.deps_real_dict = { + 'third_party': thirdparty_list, + 'kernel_special': {kernel: kernel_special[kernel] + for kernel in kernel_list + if len(kernel_special[kernel])}, + 'board_special': {board: board_special[board] + for board in board_list + if len(board_special[board])}, + 'components': components_list + } + + return self.deps_real_dict \ No newline at end of file diff --git a/hb/cts/list.py b/hb/cts/list.py new file mode 100755 index 0000000..33f830c --- /dev/null +++ b/hb/cts/list.py @@ -0,0 +1,185 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from __future__ import print_function +from __future__ import unicode_literals +import sys +from prompt_toolkit.application import Application +from prompt_toolkit.key_binding.manager import KeyBindingManager +from prompt_toolkit.keys import Keys +from prompt_toolkit.layout.containers import Window +from prompt_toolkit.filters import IsDone +from prompt_toolkit.layout.controls import TokenListControl +from prompt_toolkit.layout.containers import ConditionalContainer +from prompt_toolkit.layout.containers import HSplit +from prompt_toolkit.layout.dimension import LayoutDimension as D +from prompt_toolkit.token import Token +from hb.cts.common import Separator +from hb.cts.common import if_mousedown +from hb.cts.common import get_style + + +class InquirerControl(TokenListControl): + def __init__(self, choices, **kwargs): + self.selected_option_index = 0 + self.answered = False + self.choices = choices + self._init_choices(choices) + super(InquirerControl, self).__init__(self._get_choice_tokens, + **kwargs) + + def _init_choices(self, choices, default=None): + # helper to convert from question format to internal format + self.choices = [] # list (name, value, disabled) + searching_first_choice = True + for index, choice in enumerate(choices): + if isinstance(choice, Separator): + self.choices.append((choice, None, None)) + else: + base_string = str if sys.version_info[0] >= 3 else None + if isinstance(choice, base_string): + self.choices.append((choice, choice, None)) + else: + name = choice.get('name') + value = choice.get('value', name) + disabled = choice.get('disabled', None) + self.choices.append((name, value, disabled)) + if searching_first_choice: + self.selected_option_index = index + searching_first_choice = False + + @property + def choice_count(self): + return len(self.choices) + + def _get_choice_tokens(self, cli): + tokens = [] + token = Token + + def append(index, choice): + selected = (index == self.selected_option_index) + + @if_mousedown + def select_item(cli, mouse_event): + # bind option with this index to mouse event + self.selected_option_index = index + self.answered = True + + tokens.append((token.Pointer if selected else token, ' \u276f ' + if selected else ' ')) + if selected: + tokens.append((Token.SetCursorPosition, '')) + if choice[2]: # disabled + tokens.append((token.Selected if selected else token, + '- %s (%s)' % (choice[0], choice[2]))) + else: + try: + tokens.append((token.Selected if selected else token, + str(choice[0]), select_item)) + except Exception: + tokens.append((token.Selected if selected else + token, choice[0], select_item)) + tokens.append((token, '\n')) + + # prepare the select choices + for i, choice in enumerate(self.choices): + append(i, choice) + tokens.pop() # Remove last newline. + return tokens + + def get_selection(self): + return self.choices[self.selected_option_index] + + +def question(message, **kwargs): + if 'choices' not in kwargs: + raise Exception("You must choose one platform.") + + choices = kwargs.pop('choices', None) + qmark = kwargs.pop('qmark', '?') + style = kwargs.pop('style', get_style('terminal')) + + inquirer_control = InquirerControl(choices) + + def get_prompt_tokens(cli): + tokens = [] + + tokens.append((Token.QuestionMark, qmark)) + tokens.append((Token.Question, ' %s ' % message)) + if inquirer_control.answered: + tokens.append((Token.Answer, ' ' + + inquirer_control.get_selection()[0])) + else: + tokens.append((Token.Instruction, ' (Use arrow keys)')) + return tokens + + # assemble layout + layout = HSplit([ + Window(height=D.exact(1), + content=TokenListControl(get_prompt_tokens)), + ConditionalContainer( + Window(inquirer_control), + filter=~IsDone() + ) + ]) + + # key bindings + manager = KeyBindingManager.for_prompt() + + @manager.registry.add_binding(Keys.ControlQ, eager=True) + @manager.registry.add_binding(Keys.ControlC, eager=True) + def _(event): + raise KeyboardInterrupt() + + @manager.registry.add_binding(Keys.Down, eager=True) + def move_cursor_down(event): + def _next(): + inquirer_control.selected_option_index = ( + (inquirer_control.selected_option_index + 1) % + inquirer_control.choice_count) + _next() + while isinstance(inquirer_control.choices[ + inquirer_control.selected_option_index][0], Separator) \ + or inquirer_control.choices[ + inquirer_control.selected_option_index][2]: + _next() + + @manager.registry.add_binding(Keys.Up, eager=True) + def move_cursor_up(event): + def _prev(): + inquirer_control.selected_option_index = ( + (inquirer_control.selected_option_index - 1) % + inquirer_control.choice_count) + _prev() + while isinstance(inquirer_control.choices[ + inquirer_control.selected_option_index][0], Separator) \ + or inquirer_control.choices[ + inquirer_control.selected_option_index][2]: + _prev() + + @manager.registry.add_binding(Keys.Enter, eager=True) + def set_answer(event): + inquirer_control.answered = True + event.cli.set_return_value(inquirer_control.get_selection()[1]) + + return Application( + layout=layout, + key_bindings_registry=manager.registry, + mouse_support=True, + style=style + ) diff --git a/hb/cts/menuconfig.py b/hb/cts/menuconfig.py new file mode 100755 index 0000000..9bde090 --- /dev/null +++ b/hb/cts/menuconfig.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from hb.cts.prompt import prompt +from hb.cts.common import Separator +from hb.cts.common import get_style +from hb.cts.cts import CTS +from hb.common.utils import hb_info + + +class Menuconfig(): + def _promt(self, questions, **kwargs): + return prompt(questions, style=get_style('answer'), **kwargs) + + def list_promt(self, name, message, choices, **kwargs): + questions = self.get_questions('list', name, message, choices) + + return self._promt(questions, **kwargs) + + def checkbox_promt(self, name, message, choices, **kwargs): + questions = self.get_questions('checkbox', name, message, choices) + + return self._promt(questions, **kwargs) + + def get_questions(self, promt_type, name, message, choices): + questions = [ + { + 'type': promt_type, + 'qmark': 'OHOS', + 'name': name, + 'message': message, + 'choices': choices + } + ] + + return questions + + +if __name__ == "__main__": + pass diff --git a/hb/cts/prompt.py b/hb/cts/prompt.py new file mode 100755 index 0000000..7a6eb04 --- /dev/null +++ b/hb/cts/prompt.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import absolute_import +from __future__ import print_function + +from prompt_toolkit.shortcuts import run_application + +from hb.cts.checkbox import question as checkbox_question +from hb.cts.list import question as list_question +from hb.common.utils import hb_error +from hb.common.utils import hb_warning + + +def prompt(questions, answers=None, **kwargs): + if isinstance(questions, dict): + questions = [questions] + answers = answers or {} + + patch_stdout = kwargs.pop('patch_stdout', False) + return_asyncio_coroutine = kwargs.pop('return_asyncio_coroutine', False) + true_color = kwargs.pop('true_color', False) + refresh_interval = kwargs.pop('refresh_interval', 0) + eventloop = kwargs.pop('eventloop', None) + kbi_msg = kwargs.pop('keyboard_interrupt_msg', 'Cancelled by user') + + for question in questions: + try: + choices = question.get('choices') + if choices is not None and callable(choices): + question['choices'] = choices(answers) + + _kwargs = {} + _kwargs.update(kwargs) + _kwargs.update(question) + question_type = _kwargs.pop('type') + name = _kwargs.pop('name') + message = _kwargs.pop('message') + when = _kwargs.pop('when', None) + question_filter = _kwargs.pop('filter', None) + + if when: + # at least a little sanity check! + if callable(question['when']): + try: + if not question['when'](answers): + continue + except Exception as error: + raise ValueError( + 'Problem in \'when\' check of %s question: %s' % + (name, error)) + else: + raise ValueError('\'when\' needs to be function that ' + 'accepts a dict argument') + if question_filter: + # at least a little sanity check! + if not callable(question['filter']): + raise ValueError('\'filter\' needs to be function that ' + 'accepts an argument') + + if callable(question.get('default')): + _kwargs['default'] = question['default'](answers) + + if question_type == "checkbox": + application = checkbox_question(message, **_kwargs) + elif question_type == "list": + application = list_question(message, **_kwargs) + + answer = run_application( + application, + patch_stdout=patch_stdout, + return_asyncio_coroutine=return_asyncio_coroutine, + true_color=true_color, + refresh_interval=refresh_interval, + eventloop=eventloop) + + if answer is not None: + if question_filter: + try: + answer = question['filter'](answer) + except Exception as error: + raise ValueError('Problem processing \'filter\' of' + '{} question: {}'.format(name, error)) + answers[name] = answer + except AttributeError as attr_error: + hb_error(attr_error) + raise ValueError('No question type \'%s\'' % question_type) + except KeyboardInterrupt: + hb_warning('') + hb_warning(kbi_msg) + hb_warning('') + return {} + return answers diff --git a/config/boards/hi3518ev300.gni b/hb/deps/__init__.py similarity index 90% rename from config/boards/hi3518ev300.gni rename to hb/deps/__init__.py index 2dad515..deab585 100755 --- a/config/boards/hi3518ev300.gni +++ b/hb/deps/__init__.py @@ -1,15 +1,17 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -board_arch = "armv7-a" -board_cpu = "cortex-a7" +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/hb/deps/check_deps.py b/hb/deps/check_deps.py new file mode 100755 index 0000000..0971052 --- /dev/null +++ b/hb/deps/check_deps.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +import os +from collections import defaultdict + +from hb.common.product import Product +from hb.build.build import exec_command +from hb.common.utils import args_factory +from hb.common.utils import dump_json_file +from hb.common.config import Config +from hb.cts.cts import CTS +from hb.set.set import set_product +from hb.set.set import set_root_path + + +def check_deps(subsystems, products, work_path): + args = { + 'component': '', + 'build_type': ['debug'], + 'compiler': [], + 'dmverity': False, + 'test': None, + 'product': '', + 'full': True, + 'ndk': False + } + build_result_dict = defaultdict(list) + config = Config() + src_path = os.getcwd() + set_root_path(root_path=src_path) + + for cur_company, cur_product, product_path in Product.get_products(): + if len(products) and cur_product not in products: + continue + + set_product(cur_product, cur_company) + product_json = os.path.join(product_path, 'config.json') + + cts = CTS() + cts.init_from_json() + components_dict, cts.board, cts.kernel =\ + Product.get_components(product_json, subsystems) + cts.update_subsystems_product() + + for sname, cname_list in components_dict.items(): + for cname in cname_list: + args['component'] = [cname] + for subsystem_cls in cts: + for now_cname, now_component_cls in subsystem_cls: + if cname == now_cname: + now_component_cls.dirs += [ + config.product_path.replace(config.root_path, + '')[1:], + os.path.dirname(config.device_path). + replace(config.root_path, '')[1:] + ] + now_component_cls.get_deps_ready(work_path, + src_path) + + set_root_path(root_path=work_path) + try: + status = exec_command(args_factory(args)) + except Exception: + status = 1 + set_root_path(root_path=src_path) + now_component_cls.remove_copy_dirs(work_path) + + if status == 1: + with open(config.log_path, 'rt') as log_file: + log = log_file.read() + else: + log = '' + build_result_dict[sname].append({ + "component_name": cname, + "product": f'{cur_product}@{cur_company}', + "status": status ^ 1, + "log": log + }) + + component_build_file = os.path.join(work_path, + 'component_build.json') + dump_json_file(component_build_file, build_result_dict) + + return 0 diff --git a/hb/deps/deps.py b/hb/deps/deps.py new file mode 100755 index 0000000..7689df4 --- /dev/null +++ b/hb/deps/deps.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +from hb.deps.check_deps import check_deps +from hb.deps.gen_deps import gen_deps + + +def add_options(parser): + parser.add_argument('deps_type', + help='select the operation for deps (check or gen)', + nargs=1, + default=[]) + parser.add_argument('-s', '--subsystems', help='involved subsystems', + nargs='*', default=[]) + parser.add_argument('-p', '--products', help='involved products', + nargs='*', default=[]) + parser.add_argument('--work_path', nargs=1) + + +def exec_command(args): + if len(args.deps_type): + if args.deps_type[0] == 'check': + return check_deps(args.subsystems, + args.products, + args.work_path[0]) + elif args.deps_type[0] == 'gen': + return gen_deps(args.subsystems, args.products) + + raise Exception('please select the operation for deps (check or gen)') diff --git a/hb/deps/gen_deps.py b/hb/deps/gen_deps.py new file mode 100755 index 0000000..5377f98 --- /dev/null +++ b/hb/deps/gen_deps.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +import os +from collections import defaultdict + +from hb.common.product import Product +from hb.build.build import exec_command +from hb.common.utils import args_factory +from hb.common.utils import dump_json_file +from hb.common.utils import hb_info +from hb.common.config import Config +from hb.cts.cts import CTS +from hb.set.set import set_product +from hb.set.set import set_root_path + + +def gen_deps(subsystems, products): + args = { + 'component': '', + 'build_type': ['release'], + 'compiler': [], + 'dmverity': False, + 'test': None, + 'product': '', + 'full': True, + 'ndk': False, + 'ninja': False + } + build_result_dict = defaultdict(list) + config = Config() + src_path = os.getcwd() + set_root_path(root_path=src_path) + + cts = CTS() + cts.init_from_json() + + for cur_company, cur_product, product_path in Product.get_products(): + if len(products) and cur_product not in products: + continue + + set_product(cur_product, cur_company) + hb_info(f'now product: {cur_product}') + + config.out_path = os.path.join(config.root_path, + 'out', + config.board, + config.product) + product_json = os.path.join(product_path, 'config.json') + + components_dict, cts.board, cts.kernel =\ + Product.get_components(product_json, subsystems) + cts.update_subsystems_product() + + try: + status = exec_command(args_factory(args)) + except Exception: + status = 1 + with open(config.log_path, 'rt') as log_file: + log = log_file.read() + else: + log = '' + for sname, cname_list in components_dict.items(): + for cname in cname_list: + for subsystem_cls in cts: + for now_cname, now_component_cls in subsystem_cls: + if cname == now_cname: + now_component_cls.get_deps(cts.board, + cts.kernel, + config.out_path, + cts.comp_fields, + cts.fields) + + build_result_dict[f'{cur_product}@{cur_company}'].\ + append({"status": status ^ 1, "log": log}) + + cts.update_subsystems_platform(subsystems) + + component_build_file = os.path.join(src_path, + 'gen_deps.json') + dump_json_file(component_build_file, build_result_dict) + + return 0 diff --git a/hb/env/__init__.py b/hb/env/__init__.py new file mode 100755 index 0000000..deab585 --- /dev/null +++ b/hb/env/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/hb/env/env.py b/hb/env/env.py new file mode 100755 index 0000000..bbb0d06 --- /dev/null +++ b/hb/env/env.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from hb import CONFIG_JSON +from hb.common.utils import read_json_file +from hb.common.utils import hb_info + + +def add_options(parser): + pass + + +def exec_command(args): + json_data = read_json_file(CONFIG_JSON) + root_path = json_data.get('root_path', 'not set') + board = json_data.get('board', 'not set') + kernel = json_data.get('kernel', 'not set') + product = json_data.get('product', 'not set') + product_path = json_data.get('product_path', 'not set') + device_path = json_data.get('device_path', 'not set') + + hb_info('root path: {}'.format(root_path)) + hb_info('board: {}'.format(board)) + hb_info('kernel: {}'.format(kernel)) + hb_info('product: {}'.format(product)) + hb_info('product path: {}'.format(product_path)) + hb_info('device path: {}'.format(device_path)) diff --git a/hb/set/__init__.py b/hb/set/__init__.py new file mode 100755 index 0000000..deab585 --- /dev/null +++ b/hb/set/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/hb/set/set.py b/hb/set/set.py new file mode 100755 index 0000000..0351223 --- /dev/null +++ b/hb/set/set.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os + +from hb.common.config import Config +from hb.common.utils import get_input +from hb.common.product import Product +from hb.common.device import Device + + +def add_options(parser): + parser.add_argument('-root', '--root_path', + nargs='?', + default=None, + help='Set OHOS root path') + parser.add_argument('-p', '--product', + action='store_true', + help='Set OHOS board and kernel') + + +def exec_command(args): + if args.root_path is not None: + return set_root_path(root_path=args.root_path) + + if args.product: + return set_product() + + return set_root_path() == 0 and set_product() == 0 + + +def set_root_path(root_path=None): + config = Config() + if root_path is None: + root_path = get_input('[OHOS INFO] Input code path: ') + config.root_path = root_path + return 0 + + +def set_product(product_name=None, company=None): + if product_name is None or company is None: + product_path, product_name = Product.product_menuconfig() + else: + product_path = Product.get_product_path(product_name, company) + + config = Config() + config.product = product_name + config.product_path = product_path + + product_json = os.path.join(config.product_path, 'config.json') + config.board, config.kernel, kernel_version, dev_company =\ + Product.get_device_info(product_json) + + board_path = os.path.join(config.root_path, 'device', + dev_company, config.board) + config.device_path = Device.get_device_path(board_path, + config.kernel, + kernel_version) + + return 0 diff --git a/make_rootfs/dmverity_linux.sh b/make_rootfs/dmverity_linux.sh new file mode 100755 index 0000000..207db16 --- /dev/null +++ b/make_rootfs/dmverity_linux.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -e + +OUTPUT_DIR=$1 +TYPE=$2 + +if [ "${TYPE}" = "veritysetup" ]; then + veritysetup format ${OUTPUT_DIR}/systemfs_ext4.img ${OUTPUT_DIR}/systemhashfs/system_hashtree\ + --data-block-size=1024 --hash-block-size=1024 > ${OUTPUT_DIR}/system_verityheader + sed -n "9p" ${OUTPUT_DIR}/system_verityheader | awk '{print $3}' > ${OUTPUT_DIR}/systemhashfs/system_roothash +elif [ "${TYPE}" = "addS82ohos" ]; then + mkdir ${OUTPUT_DIR}/rootfs/systemfs + mkdir ${OUTPUT_DIR}/rootfs/systemhashfs + CMD=' +if [ ! -e /dev/mmcblk0p6 ]; then +exit 0 +fi +mount -t ext4 -o ro /dev/mmcblk0p6 /systemhashfs +/bin/veritysetup create dm-systemfs /dev/mmcblk0p5 /systemhashfs/system_hashtree $(cat /systemhashfs/system_roothash) +mount -t ext4 /dev/dm-0 /systemfs +echo 3840 > /sys/block/dm-0/queue/read_ahead_kb +echo 0 > /sys/module/dm_verity/parameters/prefetch_cluster' + echo "$CMD" >> ${OUTPUT_DIR}/rootfs/etc/init.d/S82ohos +else + echo "Unsupported type!" >&2 +fi diff --git a/make_rootfs/linux_cmd_links.config b/make_rootfs/linux_cmd_links.config new file mode 100644 index 0000000..ac5e72f --- /dev/null +++ b/make_rootfs/linux_cmd_links.config @@ -0,0 +1,208 @@ +acpi +arch +ascii +base64 +basename +blkid +blockdev +bootchartd +bunzip2 +bzcat +cal +cat +catv +chattr +chgrp +chmod +chown +chroot +chrt +chvt +cksum +clear +cmp +comm +count +cp +cpio +crc32 +cut +date +devmem +df +diff +dirname +dmesg +dnsdomainname +dos2unix +du +echo +egrep +eject +env +expand +factor +fallocate +false +fgrep +file +find +flock +fmt +free +freeramdisk +fsfreeze +fstype +fsync +ftpget +ftpput +getconf +getty +grep +groups +gunzip +halt +head +help +hexedit +hostname +hwclock +i2cdetect +i2cdump +i2cget +i2cset +iconv +id +ifconfig +inotifyd +insmod +install +ionice +iorenice +iotop +kill +killall +killall5 +link +ln +logger +login +logname +losetup +ls +lsattr +lsmod +lspci +lsusb +makedevs +mcookie +md5sum +microcom +mix +mkdir +mkfifo +mknod +mkpasswd +mkswap +mktemp +modinfo +more +mount +mountpoint +mv +nbd-client +nc +netcat +netstat +nice +nl +nohup +nproc +nsenter +od +oneit +partprobe +passwd +paste +patch +pgrep +pidof +ping +ping6 +pivot_root +pkill +pmap +poweroff +printenv +printf +prlimit +ps +pwd +pwdx +readahead +readlink +realpath +reboot +renice +reset +rev +rfkill +rm +rmdir +rmmod +sed +seq +setfattr +setsid +sha1sum +shred +sleep +sntp +sort +split +stat +strings +su +swapoff +swapon +switch_root +sync +sysctl +tac +tail +tar +taskset +tee +test +time +timeout +top +touch +true +truncate +tty +tunctl +ulimit +umount +uname +uniq +unix2dos +unlink +unshare +uptime +usleep +uudecode +uuencode +uuidgen +vconfig +vmstat +w +watch +wc +which +who +whoami +xargs +xxd +yes +zcat \ No newline at end of file diff --git a/make_rootfs/populate-extfs.sh b/make_rootfs/populate-extfs.sh new file mode 100755 index 0000000..9b03822 --- /dev/null +++ b/make_rootfs/populate-extfs.sh @@ -0,0 +1,173 @@ +#!/bin/bash +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script uses debugfs command to populate the ext2/3/4 filesystem +# from a given directory. +# changed by ohos team for change the rootfs file uid gid mode with cfgfile +export LANG=en_US.UTF-8 +export LANGUAGE=en_US:en + +do_usage () { + cat << _EOF +Usage: populate-extfs.sh +Create an ext2/ext3/ext4 filesystem from a directory or file + + source: The source directory or file + device: The target device + +_EOF + exit 1 +} + +CFGFILE_CNT_NUM=5 +FILEMODE_INDEX=2 +FILEU_INDEX=3 +FILEG_INDEX=4 +_NEW_FILEMODE_=0 +_NEW_FILEUID_=0 +_NEW_FILEGID_=0 + +declare -a CONFIGFILE_ARRAY + +do_parsecfgfile () { + i=0 + while read _BINFILE_ _FILETYPE_ _FILEMODE_ _FILEUID_ _FILEGID_ + do + CONFIGFILE_ARRAY[${i}]=${_BINFILE_} + i=$[$i+1] + CONFIGFILE_ARRAY[${i}]=${_FILETYPE_} + i=$[$i+1] + CONFIGFILE_ARRAY[${i}]=${_FILEMODE_} + i=$[$i+1] + CONFIGFILE_ARRAY[${i}]=${_FILEUID_} + i=$[$i+1] + CONFIGFILE_ARRAY[${i}]=${_FILEGID_} + i=$[$i+1] + #echo "${ARR[0]}:${ARR[1]}:${ARR[2]}" + done < ${CONFIGFILE} +} + +do_getfileconfigmode () { + i=0 + _NEW_FILEMODE_=$2 + _NEW_FILEUID_=0 + _NEW_FILEGID_=0 + while [ $i -lt ${#CONFIGFILE_ARRAY[@]} ] + do + if [ "$1" == "${CONFIGFILE_ARRAY[$i]}" ]; then + #Change FILEMODE OCT TO HEX + _NEW_FILEMODE_=$(echo "obase=16;$((0x$MODE & (~07777) | 0${CONFIGFILE_ARRAY[$i+${FILEMODE_INDEX}]}))"|bc) + _NEW_FILEUID_=${CONFIGFILE_ARRAY[$i+${FILEU_INDEX}]} + _NEW_FILEGID_=${CONFIGFILE_ARRAY[$i+${FILEG_INDEX}]} + return 0 + fi + i=$[$i+${CFGFILE_CNT_NUM}] + done +} +[ $# -ne 3 ] && do_usage + +SRCDIR=${1%%/} +DEVICE=$2 +CONFIGFILE=$3 + +# parse config file +do_parsecfgfile + +# Find where is the debugfs command if not found in the env. +if [ -z "$DEBUGFS" ]; then + CURRENT_DIR=$(dirname $(readlink -f $0)) + DEBUGFS="$CURRENT_DIR/../../../vendor/hisi/camera/dvkit_product/linux/hi3516dv300/Hi3516CV500_SDK_V2.0.3.0/Hi3516CV500_SDK_V2.0.3.0/open_source/e2fsprogs/out/pc/debugfs/debugfs" +fi + +{ + CWD="/" + find $SRCDIR | while read FILE; do + TGT="${FILE##*/}" + DIR="${FILE#$SRCDIR}" + DIR="${DIR%$TGT}" + + # Skip the root dir + [ ! -z "$DIR" ] || continue + [ ! -z "$TGT" ] || continue + + if [ "$DIR" != "$CWD" ]; then + echo "cd $DIR" + CWD="$DIR" + fi + + # Only stat once since stat is a time consuming command + STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" $FILE) + eval $STAT + + case $TYPE in + "directory") + echo "mkdir $TGT" + ;; + "regular file" | "regular empty file") + echo "write $FILE $TGT" + ;; + "symbolic link") + LINK_TGT=$(readlink $FILE) + echo "symlink $TGT $LINK_TGT" + ;; + "block special file") + echo "mknod $TGT b $DEVNO" + ;; + "character special file") + echo "mknod $TGT c $DEVNO" + ;; + "fifo") + echo "mknod $TGT p" + ;; + *) + echo "Unknown/unhandled file type '$TYPE' file: $FILE" 1>&2 + ;; + esac + + do_getfileconfigmode ${FILE#$SRCDIR} $MODE $U $G + MODE=${_NEW_FILEMODE_} + U=${_NEW_FILEUID_} + G=${_NEW_FILEGID_} + # Set the file mode + echo "sif $TGT mode 0x$MODE" + + # Set uid and gid + echo "sif $TGT uid $U" + echo "sif $TGT gid $G" + done + + # Handle the hard links. + # Save the hard links to a file, use the inode number as the filename, for example: + # If a and b's inode number is 6775928, save a and b to /tmp/tmp.VrCwHh5gdt/6775928. + INODE_DIR=`mktemp -d` || exit 1 + for i in `find $SRCDIR -type f -links +1 -printf 'INODE=%i###FN=%p\n'`; do + eval `echo $i | sed 's$###$ $'` + echo ${FN#$SRCDIR} >>$INODE_DIR/$INODE + done + # Use the debugfs' ln and "sif links_count" to handle them. + for i in `ls $INODE_DIR`; do + # The link source + SRC=`head -1 $INODE_DIR/$i` + # Remove the files and link them again except the first one + for TGT in `sed -n -e '1!p' $INODE_DIR/$i`; do + echo "rm $TGT" + echo "ln $SRC $TGT" + done + LN_CNT=`cat $INODE_DIR/$i | wc -l` + # Set the links count + echo "sif $SRC links_count $LN_CNT" + done + rm -fr $INODE_DIR +} | $DEBUGFS -w -f - $DEVICE diff --git a/make_rootfs/rootfs_linux_hi3516dv300.config b/make_rootfs/rootfs_linux_hi3516dv300.config new file mode 100644 index 0000000..e453c86 --- /dev/null +++ b/make_rootfs/rootfs_linux_hi3516dv300.config @@ -0,0 +1,4 @@ +/bin/apphilogcat f 500 4 4 +/bin/sh f 500 2 2 +/bin/toybox f 555 0 0 +/bin/foundation f 500 7 7 diff --git a/make_rootfs/rootfs_linux_hi3518ev300.config b/make_rootfs/rootfs_linux_hi3518ev300.config new file mode 100644 index 0000000..39ccd5d --- /dev/null +++ b/make_rootfs/rootfs_linux_hi3518ev300.config @@ -0,0 +1,2 @@ +/bin/foundation f 500 7 7 +/bin/apphilogcat f 500 4 4 diff --git a/make_rootfs/rootfs_liteos.config b/make_rootfs/rootfs_liteos.config new file mode 100644 index 0000000..39ccd5d --- /dev/null +++ b/make_rootfs/rootfs_liteos.config @@ -0,0 +1,2 @@ +/bin/foundation f 500 7 7 +/bin/apphilogcat f 500 4 4 diff --git a/make_rootfs/rootfsimg_linux.sh b/make_rootfs/rootfsimg_linux.sh new file mode 100755 index 0000000..6865fe0 --- /dev/null +++ b/make_rootfs/rootfsimg_linux.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -e + +system=$(uname -s) +ROOTFS_DIR=$1 +FSTYPE=$2 +ROOTFS_IMG=${ROOTFS_DIR}"_"${FSTYPE}".img" +JFFS2_TOOL=mkfs.jffs2 +WIN_JFFS2_TOOL=mkfs.jffs2.exe +VFAT_TOOL=mkfs.vfat +MCOPY_TOOL=mcopy +EXT4_TOOL=${ROOTFS_DIR}/../../../../vendor/hisi/camera/dvkit_product/linux/hi3516dv300/\ +Hi3516CV500_SDK_V2.0.3.0/Hi3516CV500_SDK_V2.0.3.0/osdrv/pub/bin/pc/mkfs.ext4 +E2FSPROGS_DIR=${ROOTFS_DIR}/../../../../vendor/hisi/camera/dvkit_product/linux/hi3516dv300/\ +Hi3516CV500_SDK_V2.0.3.0/Hi3516CV500_SDK_V2.0.3.0/open_source/e2fsprogs +EXT4_SH=${ROOTFS_DIR}/../../../../vendor/hisi/camera/dvkit_product/linux/hi3516dv300/tools/makeextfs.sh + +tool_check() { +local ret='0' +command -v "$1" >/dev/null 2>&1 || { local ret='1'; } +if [ "$ret" -ne 0 ]; then + echo "$1 tool is not exit, please install it" >&2 +fi +return 0 +} + +if [[ "${ROOTFS_DIR}" = *"rootfs" ]]; then + if [ -d "${ROOTFS_DIR}" ]; then + chmod -R 755 ${ROOTFS_DIR} + fi + if [ -f "${ROOTFS_DIR}/bin/init" ] && [ -f "${ROOTFS_DIR}/bin/shell" ]; then + chmod 700 ${ROOTFS_DIR}/bin/init 2> /dev/null + chmod 700 ${ROOTFS_DIR}/bin/shell 2> /dev/null + fi +fi + +if [[ "${ROOTFS_DIR}" =~ "dv300" ]] || [[ "${ROOTFS_DIR}" =~ "taurus" ]]; then + CONFIG_PATH=$(dirname $(readlink -f "$0"))/rootfs_linux_hi3516dv300.config +elif [[ "${ROOTFS_DIR}" =~ "ev300" ]] || [[ "${ROOTFS_DIR}" =~ "aries" ]]; then + CONFIG_PATH=$(dirname $(readlink -f "$0"))/rootfs_linux_hi3518ev300.config +fi + +if [ "${FSTYPE}" = "jffs2" ]; then + if [ "${system}" != "Linux" ] ; then + tool_check ${WIN_JFFS2_TOOL} + ${WIN_JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096 + else + tool_check ${JFFS2_TOOL} + if [[ "${ROOTFS_DIR}" = *"rootfs" ]]; then + ${JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096 --devtable ${CONFIG_PATH} + else + ${JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096 + fi + fi +elif [ "${FSTYPE}" = "vfat" ]; then + if [ "${system}" != "Linux" ] ; then + echo "Unsupported fs type!" >&2 + else + tool_check ${VFAT_TOOL} + tool_check ${MCOPY_TOOL} + BLK_SIZE=512 + CLT_SIZE=2048 + FAT_TAB_NUM=2 + CLT_CNT=$(( ${CLT_SIZE} / ${BLK_SIZE} )) + if [ $# -eq 3 ]; then + IMG_SIZE=$3 + else + FAT32_ITEM_SIZE=4 + RESV_CNT=38 + IMG_MIN_SIZE=1048576 + DIR_SIZE=$(( $(echo $(du -s ${ROOTFS_DIR} | awk '{print $1}')) * 1024 )) + IMG_SIZE=$(( ${DIR_SIZE} / (1 - ${FAT_TAB_NUM} * ${FAT32_ITEM_SIZE} / ${CLT_SIZE}) + ${RESV_CNT} * ${BLK_SIZE})) + if [ ${IMG_SIZE} -le ${IMG_MIN_SIZE} ]; then + IMG_SIZE=${IMG_MIN_SIZE} + fi + fi + IMG_CNT=$(( (${IMG_SIZE} + ${BLK_SIZE} - 1) / ${BLK_SIZE} )) + echo mtools_skip_check=1 >> ~/.mtoolsrc + dd if=/dev/zero of=${ROOTFS_IMG} count=${IMG_CNT} bs=${BLK_SIZE} + ${VFAT_TOOL} ${ROOTFS_IMG} -s ${CLT_CNT} -f ${FAT_TAB_NUM} -S ${BLK_SIZE} > /dev/null + ${MCOPY_TOOL} -i ${ROOTFS_IMG} ${ROOTFS_DIR}/* -/ ::/ + fi +elif [ "${FSTYPE}" = "ext4" ]; then + if [ "${system}" != "Linux" ] ; then + echo "Unsupported fs type!" >&2 + else + if [ $# -eq 3 ]; then + EMMC_ROOTFS_SIZE=$3 + else + if [[ "${ROOTFS_DIR}" = *"rootfs" ]]; then + EMMC_ROOTFS_SIZE=50 + else + EMMC_ROOTFS_SIZE=50 + fi + fi + COUNT_SIZE=`expr $EMMC_ROOTFS_SIZE \* 1024 \* 2` + dd if=/dev/zero of=${ROOTFS_IMG} bs=512 count=${COUNT_SIZE} + ${EXT4_TOOL} ${ROOTFS_IMG} + ${EXT4_SH} ${ROOTFS_DIR} ${ROOTFS_IMG} ${CONFIG_PATH} + fi +else + echo "Unsupported fs type!" >&2 +fi diff --git a/make_rootfs/rootfsimg_liteos.sh b/make_rootfs/rootfsimg_liteos.sh new file mode 100755 index 0000000..566f6fa --- /dev/null +++ b/make_rootfs/rootfsimg_liteos.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -e + +system=$(uname -s) +ROOTFS_DIR=$1 +FSTYPE=$2 +ROOTFS_IMG=${ROOTFS_DIR}"_"${FSTYPE}".img" +JFFS2_TOOL=mkfs.jffs2 +YAFFS2_TOOL=mkyaffs2image100 +WIN_JFFS2_TOOL=mkfs.jffs2.exe +VFAT_TOOL=mkfs.vfat +MCOPY_TOOL=mcopy +CONFIG_PATH=$(dirname $(readlink -f "$0"))/rootfs_liteos.config + +tool_check() { +local ret='0' +command -v "$1" >/dev/null 2>&1 || { local ret='1'; } +if [ "$ret" -ne 0 ]; then + echo "$1 tool is not exit, please install it" >&2 +fi +return 0 +} + +if [[ "${ROOTFS_DIR}" = *"rootfs" ]]; then + if [ -d "${ROOTFS_DIR}" ]; then + chmod -R 755 ${ROOTFS_DIR} + fi + if [ -f "${ROOTFS_DIR}/bin/init" ] && [ -f "${ROOTFS_DIR}/bin/shell" ]; then + chmod 700 ${ROOTFS_DIR}/bin/init 2> /dev/null + chmod 700 ${ROOTFS_DIR}/bin/shell 2> /dev/null + fi +fi + +if [ "${FSTYPE}" = "jffs2" ]; then + if [ "${system}" != "Linux" ]; then + tool_check ${WIN_JFFS2_TOOL} + ${WIN_JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096 + else + tool_check ${JFFS2_TOOL} + if [[ "${ROOTFS_DIR}" = *"rootfs" ]]; then + ${JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096 --devtable ${CONFIG_PATH} + else + ${JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096 + fi + fi +elif [ "${FSTYPE}" = "vfat" ]; then + if [ "${system}" != "Linux" ]; then + echo "Unsupported fs type!" >&2 + else + tool_check ${VFAT_TOOL} + tool_check ${MCOPY_TOOL} + BLK_SIZE=512 + CLT_SIZE=2048 + FAT_TAB_NUM=2 + CLT_CNT=$(( ${CLT_SIZE} / ${BLK_SIZE} )) + if [ $# -eq 3 ]; then + IMG_SIZE=$3 + else + FAT32_ITEM_SIZE=4 + RESV_CNT=38 + IMG_MIN_SIZE=1048576 + DIR_SIZE=$(( $(echo $(du -s ${ROOTFS_DIR} | awk '{print $1}')) * 1024 )) + IMG_SIZE=$(( ${DIR_SIZE} / (1 - ${FAT_TAB_NUM} * ${FAT32_ITEM_SIZE} / ${CLT_SIZE}) + ${RESV_CNT} * ${BLK_SIZE})) + if [ ${IMG_SIZE} -le ${IMG_MIN_SIZE} ]; then + IMG_SIZE=${IMG_MIN_SIZE} + fi + fi + IMG_CNT=$(( (${IMG_SIZE} + ${BLK_SIZE} - 1) / ${BLK_SIZE} )) + echo mtools_skip_check=1 >> ~/.mtoolsrc + dd if=/dev/zero of=${ROOTFS_IMG} count=${IMG_CNT} bs=${BLK_SIZE} + ${VFAT_TOOL} ${ROOTFS_IMG} -s ${CLT_CNT} -f ${FAT_TAB_NUM} -S ${BLK_SIZE} > /dev/null + ${MCOPY_TOOL} -i ${ROOTFS_IMG} ${ROOTFS_DIR}/* -/ ::/ + fi +elif [ "${FSTYPE}" = yaffs2 ]; then + tool_check ${YAFFS2_TOOL} + ${YAFFS2_TOOL} ${ROOTFS_DIR} ${ROOTFS_IMG} 2k 4bit +else + echo "Unsupported fs type!" >&2 +fi diff --git a/ndk/BUILD.gn b/ndk/BUILD.gn index 89aa2d3..054f33d 100755 --- a/ndk/BUILD.gn +++ b/ndk/BUILD.gn @@ -1,113 +1,157 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/lite/ndk/ndk.gni") - -ndk_toolchains("build_script") -{ - src_type = "file" - src_dir = [ - "//build/lite/ndk/build/BUILD.gn", - "//build/lite/ndk/build/build.py", - "//build/lite/ndk/README.md", - "//build/lite/ndk/build/.gn", - ] - dest_dir = [ - "$root_out_dir/ndk", - "$root_out_dir/ndk", - "$root_out_dir/ndk", - "$root_out_dir/ndk/build", - ] -} - -ndk_toolchains("source") { - src_dir = [ - "//build/lite/ndk/sample", - "//build/lite/ndk/build/config", - "//build/lite/ndk/build/toolchain" - ] - dest_dir = [ - "$root_out_dir/ndk/sample", - "$root_out_dir/ndk/build/config", - "$root_out_dir/ndk/build/toolchain" - ] - if (ohos_build_compiler == "clang") { - src_dir += [ - "//prebuilts/lite/sysroot/usr/lib", - "//prebuilts/lite/sysroot/usr/include" - ] - dest_dir += [ - "$root_out_dir/ndk/sysroot/usr/lib", - "$root_out_dir/ndk/sysroot/usr/include" - ] - } -} - -group("ndk_build") { - deps = [ - ":source", - ":build_script", - "//foundation/communication/services/softbus_lite:softbus_lite_ndk", - "//base/startup/services/bootstrap_lite:bootstrap_lite_ndk", - "//utils/native/lite:native_api", - "//base/startup/frameworks/syspara_lite/parameter:parameter_notes", - ] - if (ohos_kernel_type != "liteos_m") { - deps += [ - "//base/security/interfaces/kits/iam_lite:permission_notes", - "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_ndk", - "//foundation/distributedschedule/services/samgr_lite:samgr_lite_ndk", - "//foundation/graphic/lite:ndk_build", - "//foundation/aafwk/frameworks/ability_lite:ability_notes", - "//foundation/appexecfwk/frameworks/bundle_lite:bundle_notes", - "//foundation/multimedia/services/media_lite:media_ndk", - "//base/startup/frameworks/syspara_lite/token:token_notes", - "//foundation/communication/frameworks/ipc_lite:liteipc_ndk", - "//third_party/mbedtls:mbedtls_ndk", - "//third_party/cJSON:cjson_ndk", - "//drivers/hdf/lite/hdi:native_api", - "//third_party/wpa_supplicant/wpa_supplicant-2.9:wpa_supplicant", - ] - if (ohos_build_type == "debug") { - deps += [ - "//prebuilts/lite/sysroot/apidoc:lite_kernel_ndk" - ] - } - } else { - deps += [ - "$ohos_vendor_adapter_dir/hals/communication/wifi_lite/wifiservice:wifiservice_ndk", - "//base/iot_hardware/frameworks/wifiiot_lite/src:iothardware_ndk", - "//prebuilts/lite/sysroot/apidoc:lite_kernel_ndk", - "//base/hiviewdfx/frameworks/hilog_lite/mini:hilog_lite_ndk", - ] - } -} - -action("ndk") { - if (ohos_build_ndk) { - deps = ["doc"] - script = "//build/lite//ndk/archive_ndk.py" - depfile = "${target_gen_dir}/${target_name}.d" - ndk_name = - "$ohos_build_ndk_target_host-$ohos_build_compiler-$ohos_build_ndk_version" - args = [ - "--src_dir", - rebase_path("$root_build_dir/ndk"), - "--name", - ndk_name, - "--dest_dir", - rebase_path("$root_build_dir/packages/ndk") - ] - outputs = [ "$root_build_dir/packages/ndk/$ndk_name.zip" ] - } -} +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/subsystem/aafwk/path.gni") +import("//build/lite/ndk/ndk.gni") + +if (ohos_build_ndk_target_host == "linux-x86_64" && + ohos_build_compiler == "gcc") { + copy("compiler") { + sources = [ + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/arm-linux-musleabi", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/arm-linux-ohoseabi", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/bin", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/host_bin", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/lib", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/libexec", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/runtime_musl", + "//prebuilts/gcc/linux-x86/arm/arm-linux-ohoseabi-gcc/target", + ] + outputs = [ "$ndk_linux_toolchains_out_dir/{{source_file_part}}" ] + } +} + +if (ohos_build_compiler == "clang") { + copy("compiler") { + sources = [ + "//prebuilts/clang/ohos/$ohos_build_ndk_target_host/llvm/NOTICE", + "//prebuilts/clang/ohos/$ohos_build_ndk_target_host/llvm/bin", + "//prebuilts/clang/ohos/$ohos_build_ndk_target_host/llvm/include", + "//prebuilts/clang/ohos/$ohos_build_ndk_target_host/llvm/lib", + "//prebuilts/clang/ohos/$ohos_build_ndk_target_host/llvm/libexec", + "//prebuilts/clang/ohos/$ohos_build_ndk_target_host/llvm/share", + ] + if (ohos_build_ndk_target_host == "linux-x86_64") { + outputs = [ "$ndk_linux_toolchains_out_dir/{{source_file_part}}" ] + } else if (ohos_build_ndk_target_host == "windows-x86_64") { + outputs = [ "$ndk_windows_toolchains_out_dir/{{source_file_part}}" ] + } + } +} + +ndk_toolchains("build_script") { + src_type = "file" + src_dir = [ + "//build/lite/ndk/build/BUILD.gn", + "//build/lite/ndk/build/build.py", + "//build/lite/ndk/README.md", + "//build/lite/ndk/build/.gn", + ] + dest_dir = [ + "$root_out_dir/ndk", + "$root_out_dir/ndk", + "$root_out_dir/ndk", + "$root_out_dir/ndk/build", + ] +} + +ndk_toolchains("source") { + src_dir = [ + "//build/lite/ndk/sample", + "//build/lite/ndk/build/config", + "//build/lite/ndk/build/toolchain", + ] + dest_dir = [ + "$root_out_dir/ndk/sample", + "$root_out_dir/ndk/build/config", + "$root_out_dir/ndk/build/toolchain", + ] + if (ohos_build_compiler == "clang") { + src_dir += [ + "//prebuilts/lite/sysroot/usr/lib", + "//prebuilts/lite/sysroot/usr/include", + ] + dest_dir += [ + "$root_out_dir/ndk/sysroot/usr/lib", + "$root_out_dir/ndk/sysroot/usr/include", + ] + } + if (host_os == "win") { + src_dir += [ "//prebuilts/build-tools/win-x86/bin" ] + } else { + src_dir += [ "//prebuilts/build-tools/linux-x86/bin" ] + } + dest_dir += [ "$root_out_dir/ndk/prebuilts/build-tools/bin" ] +} + +group("ndk_build") { + deps = [ + ":build_script", + ":source", + "//base/startup/bootstrap_lite/services:bootstrap_lite_ndk", + "//base/startup/syspara_lite/frameworks/parameter:parameter_notes", + "//base/update/ota_lite/frameworks:update_api", + "//build/lite/config/subsystem/hiviewdfx:hilog_ndk", + "//foundation/communication/softbus_lite:softbus_lite_ndk", + "//utils/native/lite:native_api", + ] + if (ohos_kernel_type != "liteos_m") { + deps += [ + "${aafwk_lite_path}/frameworks/ability_lite:ability_notes", + "${appexecfwk_lite_path}/frameworks/bundle_lite:bundle_notes", + "//base/security/permission/interfaces/kits/permission_lite:permission_notes", + "//base/sensors/sensor_lite/interfaces/kits/native:sensors_api", + "//base/startup/syspara_lite/frameworks/token:token_notes", + "//build/lite/config/component/cJSON:cjson_ndk", + "//drivers/adapter/khdf/liteos/ndk:hdf_api", + "//foundation/communication/ipc_lite:liteipc_ndk", + "//foundation/distributedschedule/samgr_lite:samgr_lite_ndk", + "//foundation/graphic/surface:lite_surface_ndk", + "//foundation/graphic/ui:lite_ui_ndk", + "//foundation/graphic/utils:lite_graphic_hals_ndk", + "//foundation/graphic/utils:lite_graphic_utils_ndk", + "//foundation/graphic/wms:lite_wms_ndk", + "//foundation/multimedia/services/media_lite:media_ndk", + "//third_party/mbedtls:mbedtls_ndk", + "//third_party/wpa_supplicant/wpa_supplicant-2.9:wpa_supplicant", + ] + if (ohos_build_type == "debug") { + deps += [ "//prebuilts/lite/sysroot/apidoc:lite_kernel_ndk" ] + } + } else { + deps += [ + "$ohos_vendor_adapter_dir/hals/communication/wifi_lite/wifiservice:wifiservice_ndk", + "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite_ndk", + "//base/iot_hardware/peripheral:iothardware_ndk", + "//prebuilts/lite/sysroot/apidoc:lite_kernel_ndk", + ] + } +} + +action("ndk") { + if (ohos_build_ndk) { + deps = [ "doc" ] + script = "//build/lite//ndk/archive_ndk.py" + depfile = "${target_gen_dir}/${target_name}.d" + ndk_name = "$ohos_build_ndk_target_host-$ohos_build_compiler-$ohos_build_ndk_version" + args = [ + "--src_dir", + rebase_path("$root_build_dir/ndk"), + "--name", + ndk_name, + "--dest_dir", + rebase_path("$root_build_dir/packages/ndk"), + ] + outputs = [ "$root_build_dir/packages/ndk/$ndk_name.zip" ] + } +} diff --git a/ndk/build/build.py b/ndk/build/build.py index 2f555b9..3aa177a 100755 --- a/ndk/build/build.py +++ b/ndk/build/build.py @@ -51,18 +51,19 @@ def main(): ninja_cmd = '' print("\n=== start build ===\n") if platform.system().find('Windows') == 0: - gn_cmd = ['gn.exe', 'gen', product_path, '--root=.', - '--dotfile=build/.gn'] + gn_cmd = ['./prebuilts/build-tools/bin/gn.exe', 'gen', + product_path, '--root=.', '--dotfile=build/.gn'] - ninja_cmd = ['ninja.exe', + ninja_cmd = ['./prebuilts/build-tools/bin/ninja.exe', '-C', product_path] else: - gn_cmd = ['gn', 'gen', product_path, '--root=.', - '--dotfile=build/.gn'] + gn_cmd = ['./prebuilts/build-tools/bin/gn', 'gen', + product_path, '--root=.', '--dotfile=build/.gn'] if args.build_type == 'debug': gn_cmd += ['--args=ohos_build_type=\"debug\"'] - ninja_cmd = ['ninja', '-C', product_path] + ninja_cmd = ['./prebuilts/build-tools/bin/ninja', + '-C', product_path] print("=== gn working ===\n") exec_command(gn_cmd, log_path) time.sleep(2) @@ -76,9 +77,11 @@ def main(): return 0 print("\n=== start clean ===\n") if platform.system().find('Windows') == 0: - clean_cmd = ['ninja.exe', '-C', product_path, '-t', 'clean'] + clean_cmd = ['./prebuilts/build-tools/bin/ninja.exe', + '-C', product_path, '-t', 'clean'] else: - clean_cmd = ['ninja', '-C', product_path, '-t', 'clean'] + clean_cmd = ['./prebuilts/build-tools/bin/ninja', + '-C', product_path, '-t', 'clean'] print("=== clean working ===\n") exec_command(clean_cmd, log_path) print("clean success!") diff --git a/ndk/build/config/BUILD.gn b/ndk/build/config/BUILD.gn index 5e7b109..d82340a 100755 --- a/ndk/build/config/BUILD.gn +++ b/ndk/build/config/BUILD.gn @@ -1,206 +1,181 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -config("cpu_arch") { - cflags = [] - if (target_cpu == "cortex-a7") { - cflags += [ - "-mcpu=cortex-a7", - "-mfloat-abi=softfp", - "-mfpu=neon-vfpv4" - ] - } else if (target_cpu == "cortex-m4") { - cflags += [ - "-mcpu=cortex-m4", - "-march=armv7e-m", - "-mthumb" - ] - } - asmflags = cflags - cflags_cc = cflags -} - -config("base") { - defines = [ - "_FORTIFY_SOURCE=2" - ] - - if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "liteos_m") { - defines += [ - "__LITEOS__", - ] - } else if (ohos_kernel_type == "linux_4_9") { - defines += [ - "__LINUX__", - ] - } - - cflags = [ - "-fno-omit-frame-pointer", - "-nostdlib", - "-mno-unaligned-access", - "-fno-builtin", - "-Werror", - ] - - cflags_cc = cflags - cflags += [ - "-std=c99" - ] - - ldflags = [ - "-lc", - "-Wl,-z,now", - "-Wl,-z,relro", - "-Wl,-z,noexecstack" - ] -} - -config("exceptions") { - cflags_cc = [ "-fexceptions" ] - cflags_objcc = cflags_cc -} - -config("no_exceptions") { - cflags_cc = [ "-fno-exceptions" ] - cflags_objcc = cflags_cc - ldflags = cflags_cc -} - -config("stack_protector") { - cflags = [ "-fstack-protector-all" ] - cflags_cc = cflags -} - -config("static_pie_config") { - cflags = [ "-fPIE" ] - cflags_cc = cflags -} - -config("shared_library_config") { - cflags = [ "-fPIC" ] - cflags_cc = cflags -} - -config("pie_executable_config") { - ldflags = [ "-pie" ] -} - -config("clang") { - include_dirs = [ - "//llvm/include/c++/v1", - "//sysroot/usr/include/arm-liteos", - ] - - cflags = [ - "--target=arm-liteos", - "-mcpu=cortex-a7", - "-march=armv7-a", - "-mfloat-abi=softfp", - "--sysroot=${ohos_root_path}sysroot" - ] - cflags_cc = cflags - - ldflags = cflags - - ldflags += [ - "-L../llvm/lib/arm-liteos/c++", - "-L../sysroot/usr/lib/arm-liteos", - "-L../llvm/lib/clang/9.0.0/lib/arm-liteos", - "-L../llvm/lib/arm-liteos/c++", - "-lclang_rt.builtins", - "-lc", - "-lc++", - "-lc++abi", - "--sysroot=${ohos_root_path}sysroot" - ] -} - -config("clang_release") { - cflags = [ - "-Oz", - "-flto" - ] - cflags_cc = cflags -} - -config("release") { - defines = [ - "OHOS_RELEASE", - ] - cflags = [ - "-O2" - ] - cflags_cc = cflags -} - -config("debug") { - defines = [ - "OHOS_DEBUG", - ] - cflags = [ - "-g" - ] - cflags_cc = cflags -} - -config("gcc") { - include_dirs = [] - if (ohos_kernel_type == "liteos_a") { - include_dirs += [ - "//gcc/target/usr/include", - ] - ldflags = [ - "-L$ohos_root_path/gcc/target/usr/lib" - ] - } -} - -config("sysroot") { - include_dirs = [ - "//sysroot/usr/include" - ] - ldflags = [ - "-L$ohos_root_path/sysroot/usr/lib" - ] -} - -config("ohos") { - configs = [ - ":base", - ":cpu_arch", - ":stack_protector", - ":exceptions", - ":sysroot" - ] - - if (ohos_build_type == "release") { - configs += [ ":release" ] - } else if (ohos_build_type == "debug") { - configs += [ ":debug" ] - } - - if (ohos_build_compiler == "gcc") { - configs += [ ":gcc" ] - } else if (ohos_build_compiler == "clang") { - configs += [":clang"] - - if(ohos_build_type == "release") { - configs += [":clang_release"] - } - } -} - -config("tools") { - # Add tools configs if any -} \ No newline at end of file +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +config("cpu_arch") { + cflags = [] + if (target_cpu == "cortex-a7") { + cflags += [ + "-mcpu=cortex-a7", + "-mfloat-abi=softfp", + "-mfpu=neon-vfpv4", + ] + } else if (target_cpu == "cortex-m4") { + cflags += [ + "-mcpu=cortex-m4", + "-march=armv7e-m", + "-mthumb", + ] + } + asmflags = cflags + cflags_cc = cflags +} + +config("base") { + defines = [ "_FORTIFY_SOURCE=2" ] + + if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "liteos_m") { + defines += [ "__LITEOS__" ] + } else if (ohos_kernel_type == "linux_4_9") { + defines += [ "__LINUX__" ] + } + + cflags = [ + "-fno-omit-frame-pointer", + "-nostdlib", + "-mno-unaligned-access", + "-fno-builtin", + "-Werror", + ] + + cflags_cc = cflags + cflags += [ "-std=c99" ] + + ldflags = [ + "-lc", + "-Wl,-z,now", + "-Wl,-z,relro", + "-Wl,-z,noexecstack", + ] +} + +config("exceptions") { + cflags_cc = [ "-fexceptions" ] + cflags_objcc = cflags_cc +} + +config("no_exceptions") { + cflags_cc = [ "-fno-exceptions" ] + cflags_objcc = cflags_cc + ldflags = cflags_cc +} + +config("stack_protector") { + cflags = [ "-fstack-protector-all" ] + cflags_cc = cflags +} + +config("static_pie_config") { + cflags = [ "-fPIE" ] + cflags_cc = cflags +} + +config("shared_library_config") { + cflags = [ "-fPIC" ] + cflags_cc = cflags +} + +config("pie_executable_config") { + ldflags = [ "-pie" ] +} + +config("clang") { + include_dirs = [ + "//clang/include/c++/v1", + "//sysroot/usr/include/arm-liteos", + ] + + cflags = [ + "--target=arm-liteos", + "-mcpu=cortex-a7", + "-march=armv7-a", + "-mfloat-abi=softfp", + "--sysroot=${ohos_root_path}prebuilts/lite/sysroot", + ] + cflags_cc = cflags + + ldflags = cflags + + ldflags += [ + "-L../clang/arm-liteos/c++", + "-L../lite/sysroot/usr/lib/arm-liteos", + "-L../clang/9.0.0/lib/arm-liteos", + "-L../clang/arm-liteos/c++", + "-lclang_rt.builtins", + "-lc", + "-lc++", + "-lc++abi", + "--sysroot=${ohos_root_path}prebuilts/lite/sysroot", + ] +} + +config("clang_release") { + cflags = [ + "-Oz", + "-flto", + ] + cflags_cc = cflags +} + +config("release") { + defines = [ "OHOS_RELEASE" ] + cflags = [ "-O2" ] + cflags_cc = cflags +} + +config("debug") { + defines = [ "OHOS_DEBUG" ] + cflags = [ "-g" ] + cflags_cc = cflags +} + +config("gcc") { + include_dirs = [] + if (ohos_kernel_type == "liteos_a") { + include_dirs += [ "//gcc/target/usr/include" ] + ldflags = [ "-L$ohos_root_path/gcc/target/usr/lib" ] + } +} + +config("sysroot") { + include_dirs = [ "//sysroot/usr/include" ] + ldflags = [ "-L$ohos_root_path/sysroot/usr/lib" ] +} + +config("ohos") { + configs = [ + ":base", + ":cpu_arch", + ":stack_protector", + ":exceptions", + ] + + if (ohos_build_type == "release") { + configs += [ ":release" ] + } else if (ohos_build_type == "debug") { + configs += [ ":debug" ] + } + + if (ohos_build_compiler == "gcc") { + configs += [ ":gcc" ] + } else if (ohos_build_compiler == "clang") { + configs += [ ":clang" ] + configs += [ ":sysroot" ] + if (ohos_build_type == "release") { + configs += [ ":clang_release" ] + } + } +} + +config("tools") { + # Add tools configs if any +} diff --git a/ndk/build/config/BUILDCONFIG.gn b/ndk/build/config/BUILDCONFIG.gn index 9a98625..cf1c5a2 100755 --- a/ndk/build/config/BUILDCONFIG.gn +++ b/ndk/build/config/BUILDCONFIG.gn @@ -1,66 +1,67 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -import("//build/config/variable.gni") - -if (target_os == "") { - target_os = "ohos" -} -if (target_cpu == "") { - target_cpu = "cortex-a7" -} - -host_toolchains = [ - "//build/toolchain:host_linux_x86_64_gcc" -] - -if(target_os == "ohos") { - if(ohos_kernel_type == "liteos_a") { - if(ohos_build_compiler == "gcc") { - set_default_toolchain("//build/toolchain:linux_x86_64_ohos_gcc") - } else { - set_default_toolchain("//build/toolchain:linux_x86_64_clang") - } - default_target_configs = [ "//build/config:ohos" ] - } else if (ohos_kernel_type == "liteos_m") { - set_default_toolchain("//build/config:liteos") - } else if (ohos_kernel_type == "linux" && board_name == "hi3518ev300") { - set_default_toolchain("//build/toolchain:linux_x86_64_himix100_gcc") - default_target_configs = [ "//build/config:ohos" ] - } else if (ohos_kernel_type == "linux" && board_name == "hi3516dv300") { - set_default_toolchain("//build/lite/toolchain:linux_x86_64_himix200_gcc") - default_target_configs = [ "//build/config:ohos" ] - } -} else if (target_os == "linux") { - set_default_toolchain("//build/toolchain:host_linux_x86_64_gcc") -} - -default_shared_library_configs = default_target_configs + [ "//build/config:shared_library_config" ] -default_static_library_configs = default_target_configs + [ "//build/config:static_pie_config" ] -default_executable_configs = default_static_library_configs + [ "//build/config:pie_executable_config" ] - -set_defaults("executable") { - configs = default_executable_configs -} - -set_defaults("static_library") { - configs = default_static_library_configs -} - -set_defaults("shared_library") { - configs = default_shared_library_configs -} - -set_defaults("source_set") { - configs = default_target_configs -} + +import("//build/config/variable.gni") + +if (target_os == "") { + target_os = "ohos" +} +if (target_cpu == "") { + target_cpu = "cortex-a7" +} + +host_toolchains = [ "//build/toolchain:host_linux_x86_64_gcc" ] + +if (target_os == "ohos") { + if (ohos_kernel_type == "liteos_a") { + if (ohos_build_compiler == "gcc") { + set_default_toolchain("//build/toolchain:linux_x86_64_ohos_gcc") + } else { + set_default_toolchain("//build/toolchain:linux_x86_64_clang") + } + default_target_configs = [ "//build/config:ohos" ] + } else if (ohos_kernel_type == "liteos_m") { + set_default_toolchain("//build/config:liteos") + } else if (ohos_kernel_type == "linux" && board_name == "hi3518ev300") { + set_default_toolchain("//build/toolchain:linux_x86_64_himix100_gcc") + default_target_configs = [ "//build/config:ohos" ] + } else if (ohos_kernel_type == "linux" && board_name == "hi3516dv300") { + set_default_toolchain("//build/lite/toolchain:linux_x86_64_himix200_gcc") + default_target_configs = [ "//build/config:ohos" ] + } +} else if (target_os == "linux") { + set_default_toolchain("//build/toolchain:host_linux_x86_64_gcc") +} + +default_shared_library_configs = + default_target_configs + [ "//build/config:shared_library_config" ] +default_static_library_configs = + default_target_configs + [ "//build/config:static_pie_config" ] +default_executable_configs = + default_static_library_configs + [ "//build/config:pie_executable_config" ] + +set_defaults("executable") { + configs = default_executable_configs +} + +set_defaults("static_library") { + configs = default_static_library_configs +} + +set_defaults("shared_library") { + configs = default_shared_library_configs +} + +set_defaults("source_set") { + configs = default_target_configs +} diff --git a/ndk/build/config/variable.gni b/ndk/build/config/variable.gni index c623f8a..7c52687 100755 --- a/ndk/build/config/variable.gni +++ b/ndk/build/config/variable.gni @@ -1,33 +1,33 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -# Description: Define the global variables for all components -declare_args() { - # "debug" or "release" - ohos_build_type = "release" -} - -declare_args() { - # Supported board: "hi3516dv300", "hi3518ev300", "hi3861v100" - board_name = "hi3518ev300" - target_arch = "" - - # Supported compiler: gcc, clang - ohos_build_compiler = "clang" - - # Supported kernel: - # cortex-m(liteos_m), liteos for cortex-a(liteos_a), linux kernel(linux_4_9) - ohos_kernel_type = "liteos_a" - - ohos_root_path = rebase_path("//") -} \ No newline at end of file + +# Description: Define the global variables for all components +declare_args() { + # "debug" or "release" + ohos_build_type = "release" +} + +declare_args() { + # Supported board: "hi3516dv300", "hi3518ev300", "hi3861v100" + board_name = "hi3518ev300" + target_arch = "" + + # Supported compiler: gcc, clang + ohos_build_compiler = "gcc" + + # Supported kernel: + # cortex-m(liteos_m), liteos for cortex-a(liteos_a), linux kernel(linux) + ohos_kernel_type = "liteos_a" + + ohos_root_path = rebase_path("//") +} diff --git a/ndk/build/toolchain/clang.gni b/ndk/build/toolchain/clang.gni index 3f0f319..5683d35 100755 --- a/ndk/build/toolchain/clang.gni +++ b/ndk/build/toolchain/clang.gni @@ -12,7 +12,8 @@ # limitations under the License. ohos_build_compiler = "clang" -ohos_build_compiler_dir = rebase_path("//llvm/bin", root_build_dir) +ohos_build_compiler_dir_linux = rebase_path("//clang/bin", root_build_dir) +ohos_build_compiler_dir_win = rebase_path("//clang/bin", root_build_dir) ohos_build_compiler_prefix = "clang" ohos_build_compiler_so_strip = "llvm-objcopy --strip-all" ohos_build_compiler_bin_strip = "llvm-objcopy --strip-all" diff --git a/ndk/doc/config/Doxyfile_C b/ndk/doc/config/Doxyfile_C index c8f77a2..c3abd30 100755 --- a/ndk/doc/config/Doxyfile_C +++ b/ndk/doc/config/Doxyfile_C @@ -1955,6 +1955,7 @@ PREDEFINED = __attribute__(x)= \ OHOS_APPEXECFWK_BMS_BUNDLEMANAGER= \ ENABLE_MEMORY_HOOKS= \ + # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The # macro definition that is found in the sources will be used. Use the PREDEFINED diff --git a/ndk/doc/config/Doxyfile_CPP b/ndk/doc/config/Doxyfile_CPP index 5357fed..9a0518c 100755 --- a/ndk/doc/config/Doxyfile_CPP +++ b/ndk/doc/config/Doxyfile_CPP @@ -1954,6 +1954,9 @@ PREDEFINED = __attribute__(x)= \ ABILITY_WINDOW_SUPPORT= \ OHOS_APPEXECFWK_BMS_BUNDLEMANAGER= \ ENABLE_MEMORY_HOOKS= \ + ENABLE_WINDOW= \ + ENABLE_DEBUG= \ + ENABLE_AOD= \ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/ndk/ndk.gni b/ndk/ndk.gni index e06f99e..4f9c958 100755 --- a/ndk/ndk.gni +++ b/ndk/ndk.gni @@ -1,152 +1,153 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - + # Description: Native Development Kit Template - -declare_args() { - ohos_build_ndk = false - ohos_build_ndk_target_host = "linux-x86_64" - ohos_build_ndk_version = "1.0.0" -} - -ndk_out_dir = "$root_out_dir/ndk" - -ndk_headers_out_dir = "$ndk_out_dir/sysroot/usr/include" -ndk_libraries_out_dir = "$ndk_out_dir/sysroot/usr/lib" -ndk_docs_out_dir = "$ndk_out_dir/docs" - -windows_system = "windows-x86_64" -linux_system = "linux-x86_64" - -ndk_toolchain = "gcc" -if (ohos_build_compiler == "clang") { - ndk_toolchain = "llvm" -} -ndk_windows_specific_out_dir = "${ndk_out_dir}/$ndk_toolchain" -ndk_linux_specific_out_dir = "${ndk_out_dir}/$ndk_toolchain" - -ndk_windows_toolchains_out_dir = "${ndk_windows_specific_out_dir}" -ndk_windows_tools_out_dir = "${ndk_out_dir}/$windows_system/tools" - -ndk_linux_toolchains_out_dir = "${ndk_linux_specific_out_dir}" -ndk_linux_tools_out_dir = "${ndk_out_dir}/$linux_system/tools" - -template("copy_files") { - assert(defined(invoker.src) && defined(invoker.dest_dir), - "sources and dest_dir are neccessary") - if (defined(invoker.src_type)) { - src_type = invoker.src_type - } else { - src_type = "dir" - } - _deps = [] - if (defined(invoker.deps)) { - _deps += invoker.deps - } - src = invoker.src - dst = invoker.dest_dir - action("$target_name$src") { - deps = _deps - script = "//build/lite/copy_files.py" - args = [ - "--src_type", - src_type, - "--src", - rebase_path("$src"), - "--dest_dir", - rebase_path("$dst"), - ] - outputs = [ "$target_gen_dir/${target_name}_copy_files.log" ] - } -} - -# Generate NDK library. -template("ndk_lib") { - _deps = [] - if (defined(invoker.deps)) { - _deps += invoker.deps - } - - _head_files = [] - if (defined(invoker.head_files)) { - _head_files = invoker.head_files - } - if (defined(invoker.lib_extension)) { - _extension = invoker.lib_extension - } else { - _extension = ".a" - } - assert(_extension != "") - - group(target_name) { - deps = _deps - } - - if (ohos_build_ndk) { - foreach(src_deps, _deps) { - lib_name = get_label_info(src_deps, "name") - copy_files("$target_name" + "_copy") { - deps = _deps - src_type = "file" - if (_extension == ".a") { - src = "$root_out_dir/libs/lib$lib_name$_extension" - } else { - src = "$root_out_dir/lib$lib_name$_extension" - } - dest_dir = "$ndk_libraries_out_dir" - } - } - foreach(src_dir, _head_files) { - copy_files(target_name) { - src = src_dir - dest_dir = "$ndk_headers_out_dir" - } - } - } -} - -# Specify ndk toolchains -# -# Input variables: -# dest_dir: Copy destination where sources are copied to. -# src_dir: Copy Source directories. -# src_type: file or path -# -template("ndk_toolchains") { - assert(defined(invoker.src_dir) && defined(invoker.dest_dir), - "sources and dest_dir are neccessary") - - if (ohos_build_ndk) { - group(target_name) {} - indexSrc = 0 - indexDst = 0 - foreach(src_dir, invoker.src_dir) { - indexDst = 0 - foreach(dst, invoker.dest_dir) { - if (indexDst == indexSrc) { - copy_files("$src_dir") { - if (defined(invoker.src_type)) { - src_type = invoker.src_type - } else { - src_type = "dir" - } - src = src_dir - dest_dir = dst - } - } - indexDst = indexDst + 1 - } - indexSrc = indexSrc + 1 - } - } -} + +declare_args() { + ohos_build_ndk = false + ohos_build_ndk_target_host = "linux-x86_64" + ohos_build_ndk_version = "1.0.0" +} + +ndk_out_dir = "$root_out_dir/ndk" + +ndk_headers_out_dir = "$ndk_out_dir/sysroot/usr/include" +ndk_libraries_out_dir = "$ndk_out_dir/sysroot/usr/lib" +ndk_docs_out_dir = "$ndk_out_dir/docs" + +windows_system = "windows-x86_64" +linux_system = "linux-x86_64" + +ndk_toolchain = "gcc" +if (ohos_current_toolchain_type == "clang") { + ndk_toolchain = "llvm" +} +ndk_windows_specific_out_dir = "${ndk_out_dir}/$ndk_toolchain" +ndk_linux_specific_out_dir = "${ndk_out_dir}/$ndk_toolchain" + +ndk_windows_toolchains_out_dir = "${ndk_windows_specific_out_dir}" +ndk_windows_tools_out_dir = "${ndk_out_dir}/$windows_system/tools" + +ndk_linux_toolchains_out_dir = "${ndk_linux_specific_out_dir}" +ndk_linux_tools_out_dir = "${ndk_out_dir}/$linux_system/tools" + +template("copy_files") { + assert(defined(invoker.src) && defined(invoker.dest_dir), + "sources and dest_dir are neccessary") + if (defined(invoker.src_type)) { + src_type = invoker.src_type + } else { + src_type = "dir" + } + _deps = [] + if (defined(invoker.deps)) { + _deps += invoker.deps + } + src = invoker.src + dst = invoker.dest_dir + action("$target_name$src") { + deps = _deps + script = "//build/lite/copy_files.py" + args = [ + "--src_type", + src_type, + "--src", + rebase_path("$src"), + "--dest_dir", + rebase_path("$dst"), + ] + outputs = [ "$target_gen_dir/${target_name}_copy_files.log" ] + } +} + +# Generate NDK library. +template("ndk_lib") { + _deps = [] + if (defined(invoker.deps)) { + _deps += invoker.deps + } + + _head_files = [] + if (defined(invoker.head_files)) { + _head_files = invoker.head_files + } + if (defined(invoker.lib_extension)) { + _extension = invoker.lib_extension + } else { + _extension = ".a" + } + assert(_extension != "") + + group(target_name) { + deps = _deps + } + + if (ohos_build_ndk) { + foreach(src_deps, _deps) { + lib_name = get_label_info(src_deps, "name") + copy_files("$target_name" + "_copy") { + deps = _deps + src_type = "file" + if (_extension == ".a") { + src = "$root_out_dir/libs/lib$lib_name$_extension" + } else { + src = "$root_out_dir/lib$lib_name$_extension" + } + dest_dir = "$ndk_libraries_out_dir" + } + } + foreach(src_dir, _head_files) { + copy_files(target_name) { + src = src_dir + dest_dir = "$ndk_headers_out_dir" + } + } + } +} + +# Specify ndk toolchains +# +# Input variables: +# dest_dir: Copy destination where sources are copied to. +# src_dir: Copy Source directories. +# src_type: file or path +# +template("ndk_toolchains") { + assert(defined(invoker.src_dir) && defined(invoker.dest_dir), + "sources and dest_dir are neccessary") + + if (ohos_build_ndk) { + group(target_name) { + } + indexSrc = 0 + indexDst = 0 + foreach(src_dir, invoker.src_dir) { + indexDst = 0 + foreach(dst, invoker.dest_dir) { + if (indexDst == indexSrc) { + copy_files("$src_dir") { + if (defined(invoker.src_type)) { + src_type = invoker.src_type + } else { + src_type = "dir" + } + src = src_dir + dest_dir = dst + } + } + indexDst = indexDst + 1 + } + indexSrc = indexSrc + 1 + } + } +} diff --git a/ohos_var.gni b/ohos_var.gni index 1be576f..0fa292b 100755 --- a/ohos_var.gni +++ b/ohos_var.gni @@ -1,44 +1,91 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -declare_args() { - product = "" - # "debug" or "release" - ohos_build_type = "debug" - ohos_build_target = "" - ohos_build_compiler_dir = "" -} - -product_config = read_file("//build/lite/product/${product}.json", "json") - -# OHOS version -ohos_version = product_config.ohos_version - -ohos_build_user = "jenkins" -ohos_build_host = host_os -ohos_build_time = exec_script("//build/lite/gn_scripts.py", ["-t"], "value") -ohos_build_roothash = "" -ohos_root_path = rebase_path("//") -ohos_lite = true - -# Supported board: "hi3516dv300", "hi3518ev300", "hi3861v100" -board_name = product_config.board - -# Supported compiler: gcc, clang -ohos_build_compiler = product_config.compiler - -# Supported kernel: "liteos_a", "liteos_m" -ohos_kernel_type = product_config.kernel - -ohos_vendor_adapter_dir = product_config.vendor_adapter_dir -ohos_third_party_dir = product_config.third_party_dir +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: Define the global variables for all components +declare_args() { + product = "" + device_path = "" + product_path = "" + + device_company = "" + ohos_product_adapter_dir = "" + + # "debug" or "release" + ohos_build_type = "debug" + ohos_full_compile = false + ohos_build_compiler = "" + ohos_build_compiler_specified = "" + ohos_build_target = "" + ohos_build_compiler_dir = "" + ohos_kernel_type = "" + use_board_toolchain = true + + # Current toolchain name + ohos_current_toolchain = "" + + # Current toolchain type, clang or gcc. + ohos_current_toolchain_type = "" + + # Current toolchain prefix. E.g. "/data/user1/riscv32/bin/riscv32-unknown-elf-". + ohos_current_toolchain_prefix = "" + + # Current toolchain cc command. E.g. "/data/user1/riscv32/bin/riscv32-unknown-elf-gcc". + ohos_current_cc_command = "" + ohos_current_cxx_command = "" + ohos_current_ar_command = "" + ohos_current_as_command = "" + ohos_current_ld_command = "" + ohos_current_strip_command = "" + ohos_current_sysroot = [] +} + +if (product_path != "") { + product_config = read_file("${product_path}/config.json", "json") + + # OHOS version + ohos_version = product_config.ohos_version + + # Board selected by product. + board_name = product_config.board + device_company = product_config.device_company + + # Supported kernel: "liteos_a", "liteos_m", "linux" + ohos_kernel_type = product_config.kernel_type + + ohos_vendor_adapter_dir = product_config.vendor_adapter_dir + ohos_product_adapter_dir = product_config.product_adapter_dir + ohos_third_party_dir = product_config.third_party_dir +} +ohos_build_user = "jenkins" +ohos_build_host = host_os +ohos_build_time = exec_script("//build/lite/gn_scripts.py", [ "-t" ], "value") +ohos_build_roothash = "" +ohos_root_path = rebase_path("//") +ohos_lite = true + +# Testing switches +LOSCFG_TEST_JS_BUILD = false +LOSCFG_TEST_MLF_BUILD = false +LOSCFG_TEST_C_BUILD = false +LOSCFG_TEST_APPS = false + +declare_args() { + enable_ohos_hiview = true + enable_ohos_hiview_event = true + enable_ohos_hiview_platform = false +} + +declare_args() { + enable_tee_ree = false + enable_ohos_security_dmverity = false +} diff --git a/platform/hi3516dv300_liteos_a/init.ld b/platform/hi3516dv300_liteos_a/init.ld old mode 100755 new mode 100644 diff --git a/platform/hi3516dv300_liteos_a/platform.json b/platform/hi3516dv300_liteos_a/platform.json deleted file mode 100755 index 050c528..0000000 --- a/platform/hi3516dv300_liteos_a/platform.json +++ /dev/null @@ -1,751 +0,0 @@ -{ - "subsystems": [ - { - "subsystem": "kernel", - "optional": "false", - "components": [ - { - "component": "liteos_a", - "optional": "false", - "targets": [ - "//kernel/liteos_a:kernel" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "hilog_a", - "oem_smartvision" - ], - "third_party": [ - "freebsd", - "lwip", - "bounds_checking_function", - "fatfs", - "linux_kernel", - "musl", - "nuttx", - "zlib", - "mtd_utils" - ] - } - } - ] - }, - { - "subsystem": "drivers", - "optional": "false", - "components": [ - { - "component": "hdf", - "optional": "false", - "targets": [ - "//drivers/hdf/lite/posix:hdf_posix", - "//drivers/hdf/lite/manager:hdf_manager", - "//vendor/huawei/hdf/wifi:wifi_firmware", - "//vendor/huawei/hdf/display/hdi:hdi_display", - "//vendor/huawei/hdf/input/hdi:hdi_input" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "startup", - "optional": "true", - "components": [ - { - "component": "syspara", - "optional": "true", - "targets": [ - "//base/startup/frameworks/syspara_lite/parameter:parameter" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ], - "components": [ - "oem_smartvision" - ] - } - }, - { - "component": "bootstrap", - "optional": "true", - "targets": [ - "//base/startup/services/bootstrap_lite/source:bootstrap" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ], - "components": [ - "system_ability_manager", - "utils" - ] - } - }, - { - "component": "token", - "optional": "true", - "targets": [ - "//base/startup/frameworks/syspara_lite/token:token" - ], - "features": [], - "deps": { - "components": [ - "oem_iotlink", - "hilog_a" - ], - "third_party": [] - } - }, - { - "component": "init", - "optional": "false", - "targets": [ - "//base/startup/services/init_lite:init_lite", - "//vendor/huawei/camera/init_configs:init_config" - ], - "features": [], - "deps": { - "components": [ - "syspara" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - }, - { - "component": "appspawn", - "optional": "true", - "targets": [ - "//base/startup/services/appspawn_lite:appspawn_lite" - ], - "features": [], - "deps": { - "components": [ - "ipc", - "system_ability_manager" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - } - ] - }, - { - "subsystem": "utils", - "optional": "true", - "components": [ - { - "component": "utils", - "optional": "true", - "targets": [ - "//utils/native/lite/kv_store:kv_store" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "global", - "optional": "true", - "components": [ - { - "component": "global_resource_manager", - "optional": "true", - "targets": [ - "//base/global/frameworks/resmgr_lite:global_manager_lite" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "ace", - "optional": "true", - "components": [ - { - "component": "js_frameworks", - "optional": "true", - "targets": [ - "//foundation/ace/frameworks/lite:jsfwk" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "crypto", - "graphic", - "camera", - "player", - "utils", - "audio_manager" - ], - "third_party": [ - "bounds_checking_function", - "jerryscript", - "cjson" - ] - } - } - ] - }, - { - "subsystem": "aafwk", - "optional": "true", - "components": [ - { - "component": "ability", - "optional": "true", - "targets": [ - "//foundation/aafwk/frameworks/ability_lite:aafwk_abilitykit_lite", - "//foundation/aafwk/frameworks/abilitymgr_lite:aafwk_abilityManager_lite", - "//foundation/aafwk/services/abilitymgr_lite:aafwk_services_lite" - ], - "features": [ - {"enable_ohos_appexecfwk_feature_ability": "true"} - ], - "deps": { - "components": [ - "hilog_a", - "bundle_mgr", - "system_ability_manager", - "distributed_scheduler", - "graphic", - "utils", - "ipc" - ], - "third_party": [ - "cjson", - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "applications", - "optional": "true", - "components": [ - { - "component": "camera_sample_app", - "optional": "true", - "targets": [ - "//applications/sample/camera/app:camera_app", - "//applications/sample/camera/communication:sample", - "//applications/sample/camera/launcher:launcher", - "//applications/sample/camera/cameraApp:cameraApp", - "//applications/sample/camera/setting:setting", - "//applications/sample/camera/gallery:gallery" - ], - "features": [], - "deps": { - "components": [ - "system_ability_manager", - "utils", - "graphic", - "syspara", - "ipc" - ], - "third_party": [ - "wpa_supplicant" - ] - } - } - ] - }, - { - "subsystem": "hiviewdfx", - "optional": "true", - "components": [ - { - "component": "hilog_a", - "optional": "false", - "targets": [ - "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_static", - "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_shared", - "//base/hiviewdfx/services/hilogcat_lite/hilogcat:hilogcat_static", - "//base/hiviewdfx/services/hilogcat_lite/apphilogcat:apphilogcat_static" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "distributedschedule", - "optional": "true", - "components": [ - { - "component": "system_ability_manager", - "optional": "false", - "targets": [ - "//foundation/distributedschedule/services/samgr_lite:samgr" - ], - "features": [], - "deps": { - "componets": [ - "hilog_a", - "ipc", - "iam" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "foundation", - "optional": "true", - "targets": [ - "//foundation/distributedschedule/services/safwk_lite:safwk_lite" - ], - "features": [], - "deps": { - "componets": [ - "system_ability_manager", - "ipc", - "hilog_a", - "bundle_mgr", - "iam", - "ability", - "utils", - "distributed_scheduler" - ] - } - }, - { - "component": "distributed_scheduler", - "optional": "true", - "targets": [ - "//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr" - ], - "features": [], - "deps": { - "componets": [ - "system_ability_manager", - "hilog_a", - "soft_bus", - "bundle_mgr", - "ipc", - "utils" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - } - ] - }, - { - "subsystem": "security", - "optional": "true", - "components": [ - { - "component": "hichainsdk", - "optional": "true", - "targets": [ - "//base/security/frameworks/hichainsdk_lite:hichainsdk" - ], - "features": [], - "deps": { - "third_party": [ - "cjson", - "bounds_checking_function" - ], - "components": [ - "huks" - ] - } - }, - { - "component": "huks", - "optional": "true", - "targets": [ - "//base/security/frameworks/huks_lite:huks_sdk" - ], - "features": [], - "deps": { - "third_party": [ - "mbedtls", - "openssl", - "bounds_checking_function" - ] - } - }, - { - "component": "secure_os", - "optional": "true", - "targets": [ - "//base/security/services/secure_os/teecd" - ], - "features": [ - { "enable_tee_ree": "false" } - ], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "iam", - "optional": "true", - "targets": [ - "//base/security/services/iam_lite:pms_lite" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "ipc", - "system_ability_manager" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - }, - { - "component": "app_verify", - "optional": "true", - "targets": [ - "//base/security/frameworks/app_verify:verify" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "syspara" - ], - "third_party": [ - "bounds_checking_function", - "mbedtls" - ] - } - }, - { - "component": "crypto", - "optional": "true", - "targets": [ - "//base/security/frameworks/crypto_lite/cipher:cipher_shared" - ], - "features": [], - "deps": { - "components": [ - "hilog" - ], - "third_party": [ - "bounds_checking_function", - "cjson", - "mbedtls" - ] - } - } - ] - }, - { - "subsystem": "multimedia", - "optional": "true", - "components": [ - { - "component": "media_service", - "optional": "true", - "targets": [ - "//foundation/multimedia/services/media_lite:media_lite" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "hi3516dv300_adapter" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "media_sample", - "optional": "true", - "targets": [ - "//applications/sample/camera/media:media_sample" - ], - "features": [], - "deps": {} - }, - { - "component": "camera", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/camera_lite:camera" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "iam", - "hdf", - "graphic", - "hi3516dv300_adapter" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "player", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/player_lite:player" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "iam", - "hdf", - "graphic", - "hi3516dv300_adapter" - ], - "third_party": [ - "bounds_checking_function", - "iniparser" - ] - } - }, - { - "component": "audio_manager", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/audio_lite:audio_capturer" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "graphic" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "recoder", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/recorder_lite:recorder" - ], - "features": [], - "deps": { - "components": [ - "graphic", - "iam" - ], - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "graphic", - "optional": "true", - "components": [ - { - "component": "graphic", - "optional": "true", - "targets": [ - "//foundation/graphic/lite/frameworks/surface:litesurface", - "//foundation/graphic/lite/utils:litegraphicutils", - "//foundation/graphic/lite/frameworks/ui:liteui", - "//foundation/graphic/lite/services/ims:liteims", - "//foundation/graphic/lite/services/wms:litewms" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "graphic", - "hilog_a" - ], - "third_party": [ - "bounds_checking_function", - "cjson", - "libjpeg", - "libpng", - "freetype" - ] - } - } - ] - }, - { - "subsystem": "communication", - "optional": "true", - "components": [ - { - "component": "ipc", - "optional": "true", - "targets": [ - "//foundation/communication/frameworks/ipc_lite:liteipc" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function", - "utils" - ] - } - }, - { - "component": "soft_bus", - "optional": "true", - "targets": [ - "//foundation/communication/services/softbus_lite:softbus" - ], - "features": [], - "deps": { - "components": [ - "hichainsdk", - "iam", - "system_ability_manager" - ], - "third_party": [ - "cjson", - "bounds_checking_function", - "mbedtls" - ] - } - } - ] - }, - { - "subsystem": "appexecfwk", - "optional": "true", - "components": [ - { - "component": "bundle_mgr", - "optional": "true", - "targets": [ - "//foundation/appexecfwk/services/bundlemgr_lite:appexecfwk_services_lite", - "//foundation/appexecfwk/frameworks/bundle_lite:appexecfwk_kits_lite" - ], - "features": [], - "deps": { - "components": [ - "iam", - "app_verify", - "hilog_a", - "system_ability_manager", - "global_resource_manager", - "graphic", - "utils" - ], - "third_party": [ - "cjson", - "zlib" - ] - } - } - ] - }, - { - "subsystem": "vendor", - "optional": "false", - "components": [ - { - "component": "hi3516dv300", - "optional": "false", - "targets": [ - "//vendor/hisi/hi35xx/hi35xx_init/hi3516dv300:hi3516dv300_image", - "//vendor/hisi/hi35xx/hardware:hardware_media_sdk", - "//vendor/hisi/hi35xx/middleware:middleware_source_sdk" - ], - "features": [], - "deps": {} - }, - { - "component": "hi3516dv300_adapter", - "optional": "false", - "targets": [ - "//vendor/hisi/hi35xx/hi3516dv300/hi3516dv300_adapter/hals/multimedia:hdi_media" - ], - "features": [], - "deps": {} - }, - { - "component": "hi3516dv300_uboot", - "optional": "false", - "targets": [], - "features": [], - "deps": {} - }, - { - "component": "oem_smartvision", - "optional": "false", - "targets": [], - "features": [], - "deps": {} - } - ] - }, - { - "subsystem": "test", - "optional": "true", - "components": [ - { - "component": "xts", - "optional": "true", - "targets": [ - "//test/xts/acts", - "//test/xts/tools" - ], - "features": [], - "deps": {} - }, - { - "component": "developer_test", - "optional": "true", - "targets": [ - "//test/developertest:test" - ], - "features": [], - "deps": {} - } - ] - } - ] -} diff --git a/platform/hi3516dv300_openharmony_liteos_a/init.ld b/platform/hi3516dv300_openharmony_liteos_a/init.ld new file mode 100755 index 0000000..97d7199 --- /dev/null +++ b/platform/hi3516dv300_openharmony_liteos_a/init.ld @@ -0,0 +1,90 @@ +SECTIONS +{ + . = ALIGN(0x8000); + /* zInit code and data - will be freed after init */ + .zInit : + { + __commu_dispatch_table_start = .; + KEEP (*(.commu.handlers)) + __commu_dispatch_table_end = .; + . = ALIGN(4); + __sio_creators_start = .; + KEEP (*(.sio.creators)) + __sio_creators_end = .; + __hdf_devices_start = .; + KEEP (*(.hdf.devices)) + __hdf_devices_end = .; + __zinitcall_bsp_start = .; + KEEP (*(.zinitcall.bsp0.init)) + KEEP (*(.zinitcall.bsp1.init)) + KEEP (*(.zinitcall.bsp2.init)) + KEEP (*(.zinitcall.bsp3.init)) + KEEP (*(.zinitcall.bsp4.init)) + __zinitcall_bsp_end = .; + __zinitcall_device_start = .; + KEEP (*(.zinitcall.device0.init)) + KEEP (*(.zinitcall.device1.init)) + KEEP (*(.zinitcall.device2.init)) + KEEP (*(.zinitcall.device3.init)) + KEEP (*(.zinitcall.device4.init)) + __zinitcall_device_end = .; + __zinitcall_core_start = .; + KEEP (*(.zinitcall.core0.init)) + KEEP (*(.zinitcall.core1.init)) + KEEP (*(.zinitcall.core2.init)) + KEEP (*(.zinitcall.core3.init)) + KEEP (*(.zinitcall.core4.init)) + __zinitcall_core_end = .; + __zinitcall_sys_service_start = .; + KEEP (*(.zinitcall.sys.service0.init)) + KEEP (*(.zinitcall.sys.service1.init)) + KEEP (*(.zinitcall.sys.service2.init)) + KEEP (*(.zinitcall.sys.service3.init)) + KEEP (*(.zinitcall.sys.service4.init)) + __zinitcall_sys_service_end = .; + __zinitcall_sys_feature_start = .; + KEEP (*(.zinitcall.sys.feature0.init)) + KEEP (*(.zinitcall.sys.feature1.init)) + KEEP (*(.zinitcall.sys.feature2.init)) + KEEP (*(.zinitcall.sys.feature3.init)) + KEEP (*(.zinitcall.sys.feature4.init)) + __zinitcall_sys_feature_end = .; + __zinitcall_run_start = .; + KEEP (*(.zinitcall.run0.init)) + KEEP (*(.zinitcall.run1.init)) + KEEP (*(.zinitcall.run2.init)) + KEEP (*(.zinitcall.run3.init)) + KEEP (*(.zinitcall.run4.init)) + __zinitcall_run_end = .; + __zinitcall_app_service_start = .; + KEEP (*(.zinitcall.app.service0.init)) + KEEP (*(.zinitcall.app.service1.init)) + KEEP (*(.zinitcall.app.service2.init)) + KEEP (*(.zinitcall.app.service3.init)) + KEEP (*(.zinitcall.app.service4.init)) + __zinitcall_app_service_end = .; + __zinitcall_app_feature_start = .; + KEEP (*(.zinitcall.app.feature0.init)) + KEEP (*(.zinitcall.app.feature1.init)) + KEEP (*(.zinitcall.app.feature2.init)) + KEEP (*(.zinitcall.app.feature3.init)) + KEEP (*(.zinitcall.app.feature4.init)) + __zinitcall_app_feature_end = .; + __zinitcall_test_start = .; + KEEP (*(.zinitcall.test0.init)) + KEEP (*(.zinitcall.test1.init)) + KEEP (*(.zinitcall.test2.init)) + KEEP (*(.zinitcall.test3.init)) + KEEP (*(.zinitcall.test4.init)) + __zinitcall_test_end = .; + __zinitcall_exit_start = .; + KEEP (*(.zinitcall.exit0.init)) + KEEP (*(.zinitcall.exit1.init)) + KEEP (*(.zinitcall.exit2.init)) + KEEP (*(.zinitcall.exit3.init)) + KEEP (*(.zinitcall.exit4.init)) + __zinitcall_exit_end = .; + } +} +INSERT AFTER .text; + diff --git a/platform/hi3518ev300_liteos_a/init.ld b/platform/hi3518ev300_liteos_a/init.ld old mode 100755 new mode 100644 diff --git a/platform/hi3518ev300_liteos_a/platform.json b/platform/hi3518ev300_liteos_a/platform.json deleted file mode 100755 index 0c1f48d..0000000 --- a/platform/hi3518ev300_liteos_a/platform.json +++ /dev/null @@ -1,683 +0,0 @@ -{ - "subsystems": [ - { - "subsystem": "kernel", - "optional": "false", - "components": [ - { - "component": "liteos_a", - "optional": "false", - "targets": [ - "//kernel/liteos_a:kernel" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "hilog_a", - "oem_smartvision" - ], - "third_party": [ - "freebsd", - "lwip", - "bounds_checking_function", - "fatfs", - "linux_kernel", - "musl", - "nuttx", - "zlib", - "mtd_utils" - ] - } - } - ] - }, - { - "subsystem": "drivers", - "optional": "false", - "components": [ - { - "component": "hdf", - "optional": "false", - "targets": [ - "//drivers/hdf/lite/posix:hdf_posix", - "//drivers/hdf/lite/manager:hdf_manager", - "//vendor/huawei/hdf/wifi:wifi_firmware", - "//vendor/huawei/hdf/display/hdi:hdi_display", - "//vendor/huawei/hdf/input/hdi:hdi_input" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "startup", - "optional": "true", - "components": [ - { - "component": "syspara", - "optional": "true", - "targets": [ - "//base/startup/frameworks/syspara_lite/parameter:parameter" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ], - "components": [] - } - }, - { - "component": "bootstrap", - "optional": "true", - "targets": [ - "//base/startup/services/bootstrap_lite/source:bootstrap" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ], - "components": [ - "system_ability_manager", - "utils" - ] - } - }, - { - "component": "token", - "optional": "true", - "targets": [ - "//base/startup/frameworks/syspara_lite/token:token" - ], - "features": [], - "deps": { - "components": [ - "oem_smartvision", - "hilog_a" - ], - "third_party": [] - } - }, - { - "component": "init", - "optional": "true", - "targets": [ - "//base/startup/services/init_lite:init_lite", - "//vendor/huawei/camera/init_configs:init_config" - ], - "features": [], - "deps": { - "components": [ - "syspara" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - }, - { - "component": "appspawn", - "optional": "true", - "targets": [ - "//base/startup/services/appspawn_lite:appspawn_lite" - ], - "features": [], - "deps": { - "components": [ - "ipc", - "system_ability_manager" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - } - ] - }, - { - "subsystem": "utils", - "optional": "true", - "components": [ - { - "component": "utils", - "optional": "true", - "targets": [ - "//utils/native/lite/kv_store:kv_store" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "aafwk", - "optional": "true", - "components": [ - { - "component": "ability", - "optional": "true", - "targets": [ - "//foundation/aafwk/frameworks/ability_lite:aafwk_abilitykit_lite", - "//foundation/aafwk/frameworks/abilitymgr_lite:aafwk_abilityManager_lite", - "//foundation/aafwk/services/abilitymgr_lite:aafwk_services_lite" - ], - "features": [ - {"enable_ohos_appexecfwk_feature_ability": "false"} - ], - "deps": { - "components": [ - "hilog_a", - "bundle_mgr", - "system_ability_manager", - "distributed_scheduler", - "graphic", - "utils", - "ipc" - ], - "third_party": [ - "cjson", - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "applications", - "optional": "true", - "components": [ - { - "component": "camera_sample_app", - "optional": "true", - "targets": [ - "//applications/sample/camera/app:camera_app", - "//applications/sample/camera/communication:sample" - ], - "features": [], - "deps": { - "components": [ - "system_ability_manager", - "utils", - "graphic", - "syspara", - "ipc" - ], - "third_party": [ - "wpa_supplicant" - ] - } - } - ] - }, - { - "subsystem": "hiviewdfx", - "optional": "true", - "components": [ - { - "component": "hilog_a", - "optional": "false", - "targets": [ - "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_static", - "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_shared", - "//base/hiviewdfx/services/hilogcat_lite/hilogcat:hilogcat_static", - "//base/hiviewdfx/services/hilogcat_lite/apphilogcat:apphilogcat_static" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "distributedschedule", - "optional": "true", - "components": [ - { - "component": "system_ability_manager", - "optional": "false", - "targets": [ - "//foundation/distributedschedule/services/samgr_lite:samgr" - ], - "features": [], - "deps": { - "componets": [ - "hilog_a", - "ipc", - "iam" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "foundation", - "optional": "true", - "targets": [ - "//foundation/distributedschedule/services/safwk_lite:safwk_lite" - ], - "features": [], - "deps": { - "componets": [ - "system_ability_manager", - "ipc", - "hilog_a", - "bundle_mgr", - "iam", - "ability", - "utils", - "distributed_scheduler" - ] - } - }, - { - "component": "distributed_scheduler", - "optional": "true", - "targets": [ - "//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr" - ], - "features": [], - "deps": { - "componets": [ - "system_ability_manager", - "hilog_a", - "soft_bus", - "bundle_mgr", - "ipc", - "utils" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - } - ] - }, - { - "subsystem": "security", - "optional": "true", - "components": [ - { - "component": "hichainsdk", - "optional": "true", - "targets": [ - "//base/security/frameworks/hichainsdk_lite:hichainsdk" - ], - "features": [], - "deps": { - "third_party": [ - "cjson", - "bounds_checking_function" - ], - "components": [ - "huks" - ] - } - }, - { - "component": "huks", - "optional": "true", - "targets": [ - "//base/security/frameworks/huks_lite:huks_sdk" - ], - "features": [], - "deps": { - "third_party": [ - "mbedtls", - "openssl", - "bounds_checking_function" - ] - } - }, - { - "component": "iam", - "optional": "true", - "targets": [ - "//base/security/services/iam_lite:pms_lite" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "ipc", - "system_ability_manager" - ], - "third_party": [ - "bounds_checking_function", - "cjson" - ] - } - }, - { - "component": "app_verify", - "optional": "true", - "targets": [ - "//base/security/frameworks/app_verify:verify" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "syspara" - ], - "third_party": [ - "bounds_checking_function", - "cjson", - "mbedtls" - ] - } - }, - { - "component": "crypto", - "optional": "true", - "targets": [ - "//base/security/frameworks/crypto_lite/cipher:cipher_shared" - ], - "features": [], - "deps": { - "components": [ - "hilog_a" - ], - "third_party": [ - "bounds_checking_function", - "mbedtls" - ] - } - } - ] - }, - { - "subsystem": "multimedia", - "optional": "true", - "components": [ - { - "component": "media_service", - "optional": "true", - "targets": [ - "//foundation/multimedia/services/media_lite:media_lite" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "hi3518ev300_adapter" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "media_sample", - "optional": "true", - "targets": [ - "//applications/sample/camera/media:media_sample" - ], - "features": [], - "deps": {} - }, - { - "component": "camera", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/camera_lite:camera" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "iam", - "hdf", - "graphic", - "hi3518ev300_adapter" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "player", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/player_lite:player" - ], - "features": [], - "deps": { - "components": [ - "hilog_a", - "iam", - "hdf", - "graphic", - "hi3518ev300_adapter" - ], - "third_party": [ - "bounds_checking_function", - "iniparser" - ] - } - }, - { - "component": "audio_manager", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/audio_lite:audio_capturer" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "graphic" - ], - "third_party": [ - "bounds_checking_function" - ] - } - }, - { - "component": "recoder", - "optional": "true", - "targets": [ - "//foundation/multimedia/frameworks/recorder_lite:recorder" - ], - "features": [], - "deps": { - "components": [ - "graphic", - "iam" - ], - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "graphic", - "optional": "true", - "components": [ - { - "component": "graphic", - "optional": "true", - "targets": [ - "//foundation/graphic/lite/frameworks/surface:litesurface", - "//foundation/graphic/lite/utils:litegraphicutils", - "//foundation/graphic/lite/frameworks/ui:liteui", - "//foundation/graphic/lite/services/ims:liteims", - "//foundation/graphic/lite/services/wms:litewms" - ], - "features": [], - "deps": { - "components": [ - "hdf", - "graphic", - "hilog_a" - ], - "third_party": [ - "bounds_checking_function", - "cjson", - "libjpeg", - "libpng", - "freetype" - ] - } - } - ] - }, - { - "subsystem": "communication", - "optional": "true", - "components": [ - { - "component": "ipc", - "optional": "true", - "targets": [ - "//foundation/communication/frameworks/ipc_lite:liteipc" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function", - "utils" - ] - } - }, - { - "component": "soft_bus", - "optional": "true", - "targets": [ - "//foundation/communication/services/softbus_lite:softbus" - ], - "features": [], - "deps": { - "components": [ - "hichainsdk", - "iam", - "system_ability_manager" - ], - "third_party": [ - "cjson", - "bounds_checking_function", - "mbedtls" - ] - } - } - ] - }, - { - "subsystem": "appexecfwk", - "optional": "true", - "components": [ - { - "component": "bundle_mgr", - "optional": "true", - "targets": [ - "//foundation/appexecfwk/services/bundlemgr_lite:appexecfwk_services_lite", - "//foundation/appexecfwk/frameworks/bundle_lite:appexecfwk_kits_lite" - ], - "features": [ - {"enable_ohos_appexecfwk_feature_ability": "false"} - ], - "deps": { - "components": [ - "iam", - "app_verify", - "hilog_a", - "system_ability_manager", - "global_resource_manager", - "graphic", - "utils" - ], - "third_party": [ - "cjson", - "zlib" - ] - } - } - ] - }, - { - "subsystem": "vendor", - "optional": "false", - "components": [ - { - "component": "hi3518ev300", - "optional": "false", - "targets": [ - "//vendor/hisi/hi35xx/hi35xx_init/hi3518ev300:hi3518ev300_make_kernel", - "//vendor/hisi/hi35xx/hardware:hardware_media_sdk", - "//vendor/hisi/hi35xx/middleware:middleware_source_sdk" - ], - "features": [], - "deps": {} - }, - { - "component": "hi3518ev300_adapter", - "optional": "false", - "targets": [ - "//vendor/hisi/hi35xx/hi3518ev300/hi3518ev300_adapter/hals/multimedia:hdi_media" - ], - "features": [], - "deps": {} - }, - { - "component": "hi3518ev300_uboot", - "optional": "false", - "targets": [], - "features": [], - "deps": {} - }, - { - "component": "oem_smartvision", - "optional": "false", - "targets": [], - "features": [], - "deps": {} - } - ] - }, - { - "subsystem": "test", - "optional": "true", - "components": [ - { - "component": "xts", - "optional": "true", - "targets": [ - "//test/xts/acts", - "//test/xts/tools" - ], - "features": [], - "deps": {} - }, - { - "component": "developer_test", - "optional": "true", - "targets": [ - "//test/developertest:test" - ], - "features": [], - "deps": {} - } - ] - } - ] - } diff --git a/platform/hi3518ev300_openharmony_liteos_a/init.ld b/platform/hi3518ev300_openharmony_liteos_a/init.ld new file mode 100755 index 0000000..97d7199 --- /dev/null +++ b/platform/hi3518ev300_openharmony_liteos_a/init.ld @@ -0,0 +1,90 @@ +SECTIONS +{ + . = ALIGN(0x8000); + /* zInit code and data - will be freed after init */ + .zInit : + { + __commu_dispatch_table_start = .; + KEEP (*(.commu.handlers)) + __commu_dispatch_table_end = .; + . = ALIGN(4); + __sio_creators_start = .; + KEEP (*(.sio.creators)) + __sio_creators_end = .; + __hdf_devices_start = .; + KEEP (*(.hdf.devices)) + __hdf_devices_end = .; + __zinitcall_bsp_start = .; + KEEP (*(.zinitcall.bsp0.init)) + KEEP (*(.zinitcall.bsp1.init)) + KEEP (*(.zinitcall.bsp2.init)) + KEEP (*(.zinitcall.bsp3.init)) + KEEP (*(.zinitcall.bsp4.init)) + __zinitcall_bsp_end = .; + __zinitcall_device_start = .; + KEEP (*(.zinitcall.device0.init)) + KEEP (*(.zinitcall.device1.init)) + KEEP (*(.zinitcall.device2.init)) + KEEP (*(.zinitcall.device3.init)) + KEEP (*(.zinitcall.device4.init)) + __zinitcall_device_end = .; + __zinitcall_core_start = .; + KEEP (*(.zinitcall.core0.init)) + KEEP (*(.zinitcall.core1.init)) + KEEP (*(.zinitcall.core2.init)) + KEEP (*(.zinitcall.core3.init)) + KEEP (*(.zinitcall.core4.init)) + __zinitcall_core_end = .; + __zinitcall_sys_service_start = .; + KEEP (*(.zinitcall.sys.service0.init)) + KEEP (*(.zinitcall.sys.service1.init)) + KEEP (*(.zinitcall.sys.service2.init)) + KEEP (*(.zinitcall.sys.service3.init)) + KEEP (*(.zinitcall.sys.service4.init)) + __zinitcall_sys_service_end = .; + __zinitcall_sys_feature_start = .; + KEEP (*(.zinitcall.sys.feature0.init)) + KEEP (*(.zinitcall.sys.feature1.init)) + KEEP (*(.zinitcall.sys.feature2.init)) + KEEP (*(.zinitcall.sys.feature3.init)) + KEEP (*(.zinitcall.sys.feature4.init)) + __zinitcall_sys_feature_end = .; + __zinitcall_run_start = .; + KEEP (*(.zinitcall.run0.init)) + KEEP (*(.zinitcall.run1.init)) + KEEP (*(.zinitcall.run2.init)) + KEEP (*(.zinitcall.run3.init)) + KEEP (*(.zinitcall.run4.init)) + __zinitcall_run_end = .; + __zinitcall_app_service_start = .; + KEEP (*(.zinitcall.app.service0.init)) + KEEP (*(.zinitcall.app.service1.init)) + KEEP (*(.zinitcall.app.service2.init)) + KEEP (*(.zinitcall.app.service3.init)) + KEEP (*(.zinitcall.app.service4.init)) + __zinitcall_app_service_end = .; + __zinitcall_app_feature_start = .; + KEEP (*(.zinitcall.app.feature0.init)) + KEEP (*(.zinitcall.app.feature1.init)) + KEEP (*(.zinitcall.app.feature2.init)) + KEEP (*(.zinitcall.app.feature3.init)) + KEEP (*(.zinitcall.app.feature4.init)) + __zinitcall_app_feature_end = .; + __zinitcall_test_start = .; + KEEP (*(.zinitcall.test0.init)) + KEEP (*(.zinitcall.test1.init)) + KEEP (*(.zinitcall.test2.init)) + KEEP (*(.zinitcall.test3.init)) + KEEP (*(.zinitcall.test4.init)) + __zinitcall_test_end = .; + __zinitcall_exit_start = .; + KEEP (*(.zinitcall.exit0.init)) + KEEP (*(.zinitcall.exit1.init)) + KEEP (*(.zinitcall.exit2.init)) + KEEP (*(.zinitcall.exit3.init)) + KEEP (*(.zinitcall.exit4.init)) + __zinitcall_exit_end = .; + } +} +INSERT AFTER .text; + diff --git a/platform/hi3861v100_liteos_m/platform.json b/platform/hi3861v100_liteos_m/platform.json deleted file mode 100755 index ad4df59..0000000 --- a/platform/hi3861v100_liteos_m/platform.json +++ /dev/null @@ -1,324 +0,0 @@ -{ - "subsystems": [ - { - "subsystem": "applications", - "optional": "true", - "components": [ - { - "component": "wifi_iot_sample_app", - "optional": "true", - "targets": [ - "//applications/sample/wifi-iot/app" - ], - "features": [], - "deps": {} - } - ] - }, - { - "subsystem": "startup", - "optional": "true", - "components": [ - { - "component": "syspara", - "optional": "false", - "targets": [ - "//base/startup/frameworks/syspara_lite/parameter:parameter" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function" - ], - "components": [ "oem_iotlink" ] - } - }, - { - "component": "bootstrap", - "optional": "false", - "targets": [ - "//base/startup/services/bootstrap_lite/source:bootstrap" - ], - "features": [], - "deps": { - "third_party": [], - "components": [ - "system_ability_manager", - "utils" - ] - } - }, - { - "component": "token", - "optional": "false", - "targets": [ - "//base/startup/frameworks/syspara_lite/token:token" - ], - "features": [], - "deps": { - "components": [ - "oem_iotlink" - ], - "third_party": [] - } - } - ] - }, - { - "subsystem": "iot_hardware", - "optional": "true", - "components": [ - { - "component": "iot_controller", - "optional": "false", - "targets": [ - "//base/iot_hardware/frameworks/wifiiot_lite:iothardware" - ], - "features": [], - "deps": { - "components": [ - "oem_iotlink", - "utils" - ], - "third_party": [] - } - } - ] - }, - { - "subsystem": "hiviewdfx", - "optional": "true", - "components": [ - { - "component": "dfx_common", - "optional": "false", - "targets": [ - "//base/hiviewdfx/utils/lite:common_lite" - ], - "features": [], - "deps": { - "components": [ - "utils" - ], - "third_party": [ - "musl" - ] - } - }, - { - "component": "hiview", - "optional": "false", - "targets": [ - "//base/hiviewdfx/services/hiview_lite:hiview_lite" - ], - "features": [], - "deps": { - "components": [ - "system_ability_manager" - ], - "third_party": [] - } - }, - { - "component": "hilog_m", - "optional": "false", - "targets": [ - "//base/hiviewdfx/frameworks/hilog_lite/mini:hilog_lite", - "//base/hiviewdfx/utils/lite:common_lite" - ], - "features": [], - "deps": { - "components": [ - "system_ability_manager" - ], - "third_party": [] - } - }, - { - "component": "hievent", - "optional": "true", - "targets": [ - "//base/hiviewdfx/frameworks/hievent_lite:hievent_lite" - ], - "features": [ - { "enable_hos_hiview_event": "fasle" } - ], - "deps": { - "components": [ - "system_ability_manager" - ], - "third_party": [] - } - } - ] - }, - { - "subsystem": "distributedschedule", - "optional": "true", - "components": [ - { - "component": "system_ability_manager", - "optional": "false", - "targets": [ - "//foundation/distributedschedule/services/samgr_lite:samgr" - ], - "features": [], - "deps": { - "componets": [ - "hilog_m", - "iam" - ], - "third_party": [ - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "security", - "optional": "true", - "components": [ - { - "component": "hichainsdk", - "optional": "true", - "targets": [ - "//base/security/frameworks/hichainsdk_lite:hichainsdk" - ], - "features": [], - "deps": { - "third_party": [ - "cjson", - "bounds_checking_function" - ] - } - } - ] - }, - { - "subsystem": "communication", - "optional": "true", - "components": [ - { - "component": "soft_bus", - "optional": "true", - "targets": [ - "//foundation/communication/services/softbus_lite:softbus" - ], - "features": [], - "deps": { - "components": [ - "hichainsdk", - "iam", - "system_ability_manager", - "hi3861" - ], - "third_party": [ - "cjson", - "bounds_checking_function", - "mbedtls" - ] - } - }, - { - "component": "wlan", - "optional": "false", - "targets": [ - "//foundation/communication/frameworks/wifi_lite:wifi" - ], - "features": [], - "deps": { - "components": [ - "oem_iotlink", - "system_ability_manager" - ], - "third_party": [] - } - } - ] - }, - { - "subsystem": "utils", - "optional": "true", - "components": [ - { - "component": "utils", - "optional": "false", - "targets": [ - "//utils/native/lite/kv_store:kv_store", - "//utils/native/lite/file:file" - ], - "features": [], - "deps": { - "third_party": [ - "bounds_checking_function", - "hi3861_adapter" - ] - } - } - ] - }, - { - "subsystem": "iot", - "optional": "true", - "components": [ - { - "component": "iot_link", - "optional": "false", - "targets": [ - "//domains/iot/link" - ], - "features": [], - "deps": { - "third_party": [] - } - } - ] - }, - { - "subsystem": "vendor", - "optional": "true", - "components": [ - { - "component": "hi3861", - "optional": "false", - "targets": [ - "//vendor/hisi/hi3861/hi3861:wifiiot_sdk" - ], - "features": [], - "deps": {} - }, - { - "component": "hi3861_adapter", - "optional": "false", - "targets": [], - "features": [], - "deps": {} - }, - { - "component": "oem_iotlink", - "optional": "false", - "targets": [], - "features": [], - "deps": {} - } - ] - }, - { - "subsystem": "test", - "optional": "true", - "components": [ - { - "component": "xts", - "optional": "true", - "targets": [ - "//test/xts/acts", - "//test/xts/tools" - ], - "features": [], - "deps": {} - } - ] - } - ] - } diff --git a/product/ipcamera_hi3516dv300.json b/product/ipcamera_hi3516dv300.json deleted file mode 100755 index 2100baf..0000000 --- a/product/ipcamera_hi3516dv300.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "ohos_version": "OpenHarmony 1.0", - "board": "hi3516dv300", - "kernel": "liteos_a", - "compiler": "clang", - "subsystem": [ - { - "name": "aafwk", - "component": [ - { "name": "abilitykit_lite", "dir": "//foundation/aafwk/frameworks/ability_lite:aafwk_abilitykit_lite", "features":[ "enable_ohos_appexecfwk_feature_ability = true" ] }, - { "name": "abilityManager_lite", "dir": "//foundation/aafwk/frameworks/abilitymgr_lite:aafwk_abilityManager_lite", "features":[] }, - { "name": "aafwk_services_lite", "dir": "//foundation/aafwk/services/abilitymgr_lite:aafwk_services_lite", "features":[] } - ] - }, - { - "name": "applications", - "component": [ - { "name": "camera", "dir": "//applications/sample/camera/app:camera_app", "features":[] }, - { "name": "communication", "dir": "//applications/sample/camera/communication:sample", "features":[] }, - { "name": "launcher", "dir": "//applications/sample/camera/launcher:launcher", "features":[] }, - { "name": "cameraApp", "dir": "//applications/sample/camera/cameraApp:cameraApp", "features":[] }, - { "name": "setting", "dir": "//applications/sample/camera/setting:setting", "features":[] }, - { "name": "gallery", "dir": "//applications/sample/camera/gallery:gallery", "features":[] } - ] - }, - { - "name": "hiviewdfx", - "component": [ - { "name": "hilog_lite", "dir": "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_static", "features":[] }, - { "name": "hilog_lite", "dir": "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_shared", "features":[] }, - { "name": "hilogcat_lite", "dir": "//base/hiviewdfx/services/hilogcat_lite/hilogcat:hilogcat_static", "features":[] }, - { "name": "hilogcat_lite", "dir": "//base/hiviewdfx/services/hilogcat_lite/apphilogcat:apphilogcat_static", "features":[] } - ] - }, - { - "name": "distributedschedule", - "component": [ - { "name": "samgr_lite", "dir": "//foundation/distributedschedule/services/samgr_lite:samgr", "features":[] }, - { "name": "safwk_lite", "dir": "//foundation/distributedschedule/services/safwk_lite:safwk_lite", "features":[] }, - { "name": "dtbschedmgr_lite", "dir": "//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr", "features":[] } - ] - }, - { - "name": "security", - "component": [ - { "name": "hichainsdk_lite", "dir": "//base/security/frameworks/hichainsdk_lite:hichainsdk", "features":[] }, - { "name": "iam_lite", "dir": "//base/security/services/iam_lite:pms_lite", "features":[] }, - { "name": "app_verify", "dir": "//base/security/frameworks/app_verify:verify", "features":[] } - ] - }, - { - "name": "multimedia", - "component": [ - { "name": "media_sample", "dir": "//applications/sample/camera/media:media_sample", "features":[] }, - { "name": "media_lite", "dir": "//foundation/multimedia/services/media_lite:media_lite", "features":[] } - ] - }, - { - "name": "graphic", - "component": [ - { "name": "surface", "dir": "//foundation/graphic/lite/frameworks/surface:litesurface", "features":[] }, - { "name": "utils", "dir": "//foundation/graphic/lite/utils:litegraphicutils", "features":[] }, - { "name": "ui", "dir": "//foundation/graphic/lite/frameworks/ui:liteui", "features":[] }, - { "name": "ims", "dir": "//foundation/graphic/lite/services/ims:liteims", "features":[] }, - { "name": "wms", "dir": "//foundation/graphic/lite/services/wms:litewms", "features":[] } - ] - }, - { - "name": "startup", - "component": [ - { "name": "bootstrap_lite", "dir": "//base/startup/services/bootstrap_lite/source:bootstrap", "features":[] }, - { "name": "parameter", "dir": "//base/startup/frameworks/syspara_lite/parameter:parameter", "features":[] }, - { "name": "token", "dir": "//base/startup/frameworks/syspara_lite/token:token", "features":[] }, - { "name": "init_lite", "dir": "//base/startup/services/init_lite:init_lite", "features":[] }, - { "name": "appspawn_lite", "dir": "//base/startup/services/appspawn_lite:appspawn_lite", "features":[] }, - { "name": "init_config", "dir": "//vendor/huawei/camera/init_configs:init_config", "features":[] } - ] - }, - { - "name": "kernel", - "component": [ - { "name": "liteos_a", "dir": "//kernel/liteos_a:kernel", "features":[] } - ] - }, - { - "name": "communication", - "component": [ - { "name": "ipc_lite", "dir": "//foundation/communication/frameworks/ipc_lite:liteipc", "features":[] }, - { "name": "softbus_lite", "dir": "//foundation/communication/services/softbus_lite:softbus", "features":[] }, - { "name": "wpa_supplicant", "dir": "//third_party/wpa_supplicant/wpa_supplicant-2.9:wpa_supplicant", "features":[] } - ] - }, - { - "name": "ace", - "component": [ - { "name": "jsfwk", "dir": "//foundation/ace/frameworks/lite:jsfwk", "features":[] } - ] - }, - { - "name": "hdf", - "component": [ - { "name": "posix", "dir": "//drivers/hdf/lite/posix:hdf_posix", "features":[] }, - { "name": "manager", "dir": "//drivers/hdf/lite/manager:hdf_manager", "features":[] }, - { "name": "wifi", "dir": "//vendor/huawei/hdf/wifi:wifi_firmware", "features":[] }, - { "name": "display", "dir": "//vendor/huawei/hdf/display/hdi:hdi_display", "features":[] }, - { "name": "input", "dir": "//vendor/huawei/hdf/input/hdi:hdi_input", "features":[] } - ] - }, - { - "name": "appexecfwk", - "component": [ - { "name": "bundle_lite", "dir": "//foundation/appexecfwk/frameworks/bundle_lite:appexecfwk_kits_lite", "features":[] }, - { "name": "bundlemgr_lite", "dir": "//foundation/appexecfwk/services/bundlemgr_lite:appexecfwk_services_lite", "features":[] } - ] - }, - { - "name": "vendor", - "component": [ - { "name": "hi35xx_init", "dir": "//vendor/hisi/hi35xx/hi35xx_init/hi3516dv300:hi3516dv300_image", "features":[] }, - { "name": "hardware", "dir": "//vendor/hisi/hi35xx/hardware:hardware_media_sdk", "features":[] }, - { "name": "middleware", "dir": "//vendor/hisi/hi35xx/middleware:middleware_source_sdk", "features":[] } - ] - }, - { - "name": "test", - "component": [ - { "name": "xts_act", "dir": "//test/xts/acts", "features":[] }, - { "name": "xts_tools", "dir": "//test/xts/tools", "features":[] }, - { "name": "test", "dir": "//test/developertest:test", "features":[] } - ] - }, - { - "name": "utils", - "component": [ - { "name": "kv_store", "dir": "//utils/native/lite/kv_store:kv_store", "features":[] } - ] - } - ], - "vendor_adapter_dir": "//vendor/hisi/hi35xx/hi3516dv300/hi3516dv300_adapter", - "third_party_dir": "//third_party", - "ohos_product_type":"", - "ohos_manufacture":"", - "ohos_brand":"", - "ohos_market_name":"", - "ohos_product_series":"", - "ohos_product_model":"", - "ohos_software_model":"", - "ohos_hardware_model":"", - "ohos_hardware_profile":"", - "ohos_serial":"", - "ohos_bootloader_version":"", - "ohos_secure_patch_level":"", - "ohos_abi_list":"" -} diff --git a/product/ipcamera_hi3518ev300.json b/product/ipcamera_hi3518ev300.json deleted file mode 100755 index 9e4d752..0000000 --- a/product/ipcamera_hi3518ev300.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "ohos_version": "OpenHarmony 1.0", - "board": "hi3518ev300", - "kernel": "liteos_a", - "compiler": "clang", - "subsystem": [ - { - "name": "aafwk", - "component": [ - { "name": "abilitykit_lite", "dir": "//foundation/aafwk/frameworks/ability_lite:aafwk_abilitykit_lite", "features":[ "enable_ohos_appexecfwk_feature_ability = false" ] }, - { "name": "abilityManager_lite", "dir": "//foundation/aafwk/frameworks/abilitymgr_lite:aafwk_abilityManager_lite", "features":[] }, - { "name": "aafwk_services_lite", "dir": "//foundation/aafwk/services/abilitymgr_lite:aafwk_services_lite", "features":[] } - ] - }, - { - "name": "applications", - "component": [ - { "name": "camera", "dir": "//applications/sample/camera/app:camera_app", "features":[] }, - { "name": "communication", "dir": "//applications/sample/camera/communication:sample", "features":[] } - ] - }, - { - "name": "hiviewdfx", - "component": [ - { "name": "hilog_lite", "dir": "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_static", "features":[] }, - { "name": "hilog_lite", "dir": "//base/hiviewdfx/frameworks/hilog_lite/featured:hilog_shared", "features":[] }, - { "name": "hilogcat_lite", "dir": "//base/hiviewdfx/services/hilogcat_lite/hilogcat:hilogcat_static", "features":[] }, - { "name": "hilogcat_lite", "dir": "//base/hiviewdfx/services/hilogcat_lite/apphilogcat:apphilogcat_static", "features":[] } - ] - }, - { - "name": "distributedschedule", - "component": [ - { "name": "samgr_lite", "dir": "//foundation/distributedschedule/services/samgr_lite:samgr", "features":[] }, - { "name": "safwk_lite", "dir": "//foundation/distributedschedule/services/safwk_lite:safwk_lite", "features":[] }, - { "name": "dtbschedmgr_lite", "dir": "//foundation/distributedschedule/services/dtbschedmgr_lite:dtbschedmgr", "features":[] } - ] - }, - { - "name": "security", - "component": [ - { "name": "hichainsdk_lite", "dir": "//base/security/frameworks/hichainsdk_lite:hichainsdk", "features":[] }, - { "name": "iam_lite", "dir": "//base/security/services/iam_lite:pms_lite", "features":[] }, - { "name": "app_verify", "dir": "//base/security/frameworks/app_verify:verify", "features":[] } - ] - }, - { - "name": "multimedia", - "component": [ - { "name": "media_sample", "dir": "//applications/sample/camera/media:media_sample", "features":[] }, - { "name": "media_lite", "dir": "//foundation/multimedia/services/media_lite:media_lite", "features":[] } - ] - }, - { - "name": "graphic", - "component": [ - { "name": "surface", "dir": "//foundation/graphic/lite/frameworks/surface:litesurface", "features":[] }, - { "name": "utils", "dir": "//foundation/graphic/lite/utils:litegraphicutils", "features":[] }, - { "name": "ui", "dir": "//foundation/graphic/lite/frameworks/ui:liteui", "features":[] }, - { "name": "ims", "dir": "//foundation/graphic/lite/services/ims:liteims", "features":[] }, - { "name": "wms", "dir": "//foundation/graphic/lite/services/wms:litewms", "features":[] } - ] - }, - { - "name": "startup", - "component": [ - { "name": "bootstrap_lite", "dir": "//base/startup/services/bootstrap_lite/source:bootstrap", "features":[] }, - { "name": "parameter", "dir": "//base/startup/frameworks/syspara_lite/parameter:parameter", "features":[] }, - { "name": "token", "dir": "//base/startup/frameworks/syspara_lite/token:token", "features":[] }, - { "name": "init_lite", "dir": "//base/startup/services/init_lite:init_lite", "features":[] }, - { "name": "appspawn_lite", "dir": "//base/startup/services/appspawn_lite:appspawn_lite", "features":[] }, - { "name": "init_config", "dir": "//vendor/huawei/camera/init_configs:init_config", "features":[] } - ] - }, - { - "name": "kernel", - "component": [ - { "name": "liteos_a", "dir": "//kernel/liteos_a:kernel", "features":[] } - ] - }, - { - "name": "communication", - "component": [ - { "name": "ipc_lite", "dir": "//foundation/communication/frameworks/ipc_lite:liteipc", "features":[] }, - { "name": "softbus_lite", "dir": "//foundation/communication/services/softbus_lite:softbus", "features":[] }, - { "name": "wpa_supplicant", "dir": "//third_party/wpa_supplicant/wpa_supplicant-2.9:wpa_supplicant", "features":[] } - ] - }, - { - "name": "hdf", - "component": [ - { "name": "posix", "dir": "//drivers/hdf/lite/posix:hdf_posix", "features":[] }, - { "name": "manager", "dir": "//drivers/hdf/lite/manager:hdf_manager", "features":[] }, - { "name": "wifi", "dir": "//vendor/huawei/hdf/wifi:wifi_firmware", "features":[] }, - { "name": "display", "dir": "//vendor/huawei/hdf/display/hdi:hdi_display", "features":[] }, - { "name": "input", "dir": "//vendor/huawei/hdf/input/hdi:hdi_input", "features":[] } - ] - }, - { - "name": "appexecfwk", - "component": [ - { "name": "bundle_lite", "dir": "//foundation/appexecfwk/frameworks/bundle_lite:appexecfwk_kits_lite", "features":[] }, - { "name": "bundlemgr_lite", "dir": "//foundation/appexecfwk/services/bundlemgr_lite:appexecfwk_services_lite", "features":[] } - ] - }, - { - "name": "utils", - "component": [ - { "name": "kv_store", "dir": "//utils/native/lite/kv_store:kv_store", "features":[] } - ] - }, - { - "name": "vendor", - "component": [ - { "name": "middleware", "dir": "//vendor/hisi/hi35xx/middleware:middleware_source_sdk", "features":[] }, - { "name": "camera_init", "dir": "//vendor/hisi/hi35xx/hi35xx_init/hi3518ev300:hi3518ev300_make_kernel", "features":[] }, - { "name": "hardware", "dir": "//vendor/hisi/hi35xx/hardware:hardware_media_sdk", "features":[] } - ] - }, - { - "name": "test", - "component": [ - { "name": "xts_act", "dir": "//test/xts/acts", "features":[] }, - { "name": "xts_tools", "dir": "//test/xts/tools", "features":[] }, - { "name": "test", "dir": "//test/developertest:test", "features":[] } - ] - } - ], - "vendor_adapter_dir": "//vendor/hisi/hi35xx/hi3518ev300/hi3518ev300_adapter", - "third_party_dir": "//third_party", - "ohos_product_type":"", - "ohos_manufacture":"", - "ohos_brand":"", - "ohos_market_name":"", - "ohos_product_series":"", - "ohos_product_model":"", - "ohos_software_model":"", - "ohos_hardware_model":"", - "ohos_hardware_profile":"", - "ohos_serial":"", - "ohos_bootloader_version":"", - "ohos_secure_patch_level":"", - "ohos_abi_list":"" -} diff --git a/product/qemu_arm_virt_ca7.json b/product/qemu_arm_virt_ca7.json deleted file mode 100755 index 82310d1..0000000 --- a/product/qemu_arm_virt_ca7.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "ohos_version": "OpenHarmony 1.0", - "board": "qemu_arm_virt_ca7", - "kernel": "liteos_a", - "compiler": "clang", - "subsystem": [ - { - "name": "applications", - "component": [ - ] - }, - { - "name": "startup", - "component": [ - ] - }, - { - "name": "kernel", - "component": [ - { "name": "liteos_a", "dir": "//kernel/liteos_a:kernel", "features":[] } - ] - }, - { - "name": "hdf", - "component": [ - { "name": "posix", "dir": "//drivers/hdf/lite/posix:hdf_posix", "features":[] }, - { "name": "manager", "dir": "//drivers/hdf/lite/manager:hdf_manager", "features":[] } - ] - }, - { - "name": "device", - "component": [ - { "name": "qemu_virt_init", "dir": "//device/qemu/arm/arm_init/virt:virt_make_kernel", "features":[] } - ] - } - ], - "vendor_adapter_dir": "", - "third_party_dir": "//third_party", - "ohos_product_type":"", - "ohos_manufacture":"", - "ohos_brand":"", - "ohos_market_name":"", - "ohos_product_series":"", - "ohos_product_model":"", - "ohos_software_model":"", - "ohos_hardware_model":"", - "ohos_hardware_profile":"", - "ohos_serial":"", - "ohos_bootloader_version":"", - "ohos_secure_patch_level":"", - "ohos_abi_list":"" -} diff --git a/product/wifiiot.json b/product/wifiiot.json deleted file mode 100755 index 9a10328..0000000 --- a/product/wifiiot.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "ohos_version": "OpenHarmony 1.0", - "board": "hi3861v100", - "kernel": "liteos_m", - "compiler": "gcc", - "subsystem": [ - { - "name": "applications", - "component": [ - { "name": "wifi-iot", "dir": "//applications/sample/wifi-iot/app", "features":[] } - ] - }, - { - "name": "iot_hardware", - "component": [ - { "name": "wifi-iot", "dir": "//base/iot_hardware/frameworks/wifiiot_lite:iothardware", "features":[] } - ] - }, - { - "name": "hiviewdfx", - "component": [ - { "name": "common_lite", "dir": "//base/hiviewdfx/utils/lite:common_lite", "features":[] }, - { "name": "hiview_lite", "dir": "//base/hiviewdfx/services/hiview_lite:hiview_lite", "features":[] }, - { "name": "hilog_lite", "dir": "//base/hiviewdfx/frameworks/hilog_lite/mini:hilog_lite", "features":[] } - ] - }, - { - "name": "distributedschedule", - "component": [ - { "name": "samgr_lite", "dir": "//foundation/distributedschedule/services/samgr_lite:samgr", "features":[] } - ] - }, - { - "name": "security", - "component": [ - { "name": "hichainsdk_lite", "dir": "//base/security/frameworks/hichainsdk_lite:hichainsdk", "features":[] } - ] - }, - { - "name": "startup", - "component": [ - { "name": "bootstrap_lite", "dir": "//base/startup/services/bootstrap_lite/source:bootstrap", "features":[] }, - { "name": "parameter", "dir": "//base/startup/frameworks/syspara_lite/parameter:parameter", "features":[] }, - { "name": "token", "dir": "//base/startup/frameworks/syspara_lite/token:token", "features":[] } - ] - }, - { - "name": "communication", - "component": [ - { "name": "wifi_lite", "dir": "//foundation/communication/frameworks/wifi_lite:wifi", "features":[] }, - { "name": "softbus_lite", "dir": "//foundation/communication/services/softbus_lite:softbus", "features":[] } - ] - }, - { - "name": "utils", - "component": [ - { "name": "kv_store", "dir": "//utils/native/lite/kv_store:kv_store", "features":[] }, - { "name": "file", "dir": "//utils/native/lite/file:file", "features":[] } - ] - }, - { - "name": "iot", - "component": [ - { "name": "iot_link", "dir": "//domains/iot/link", "features":[] } - ] - }, - { - "name": "vendor", - "component": [ - { "name": "hi3861_sdk", "dir": "//vendor/hisi/hi3861/hi3861:wifiiot_sdk", "features":[] } - ] - }, - { - "name": "test", - "component": [ - { "name": "xts_act", "dir": "//test/xts/acts", "features":[] }, - { "name": "xts_tools", "dir": "//test/xts/tools", "features":[] } - ] - } - ], - "vendor_adapter_dir": "//vendor/hisi/hi3861/hi3861_adapter", - "third_party_dir": "//vendor/hisi/hi3861/hi3861/third_party", - "ohos_product_type":"", - "ohos_manufacture":"", - "ohos_brand":"", - "ohos_market_name":"", - "ohos_product_series":"", - "ohos_product_model":"", - "ohos_software_model":"", - "ohos_hardware_model":"", - "ohos_hardware_profile":"", - "ohos_serial":"", - "ohos_bootloader_version":"", - "ohos_secure_patch_level":"", - "ohos_abi_list":"" -} diff --git a/readme.md b/readme.md index 6a78f59..9bc8ead 100755 --- a/readme.md +++ b/readme.md @@ -1,4 +1 @@ 详见:https://gitee.com/openharmony/docs/blob/master/readme/编译构建子系统README.md - -see: https://gitee.com/openharmony/docs/blob/master/docs-en/readme/compilation-and-building-subsystem.md - diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..1a35600 --- /dev/null +++ b/setup.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +from setuptools import setup + +WORK_PATH = os.path.dirname('__file__') +README_PATH = os.path.join(WORK_PATH, 'readme.md') +LICENSE_PATH = os.path.join(WORK_PATH, 'LICENSE') +LONG_DESCRIPTION = open(README_PATH).read() +LICENSE = open(LICENSE_PATH).read() + +setup( + name='ohos-build', + version='0.1.1', + description='OHOS build command line tool', + long_description=LONG_DESCRIPTION, + url='', + author='', + author_email='', + license=LICENSE, + python_requires='>=3.7', + packages=['hb', 'hb.build', 'hb.set', 'hb.cts', + 'hb.common', 'hb.env', 'hb.clean', 'hb.deps'], + package_dir={'hb': 'hb'}, + package_data={'hb': ['common/config.json']}, + install_requires=['prompt_toolkit==1.0.14'], + entry_points={ + 'console_scripts': [ + 'hb=hb.__main__:main', + ] + }, +) diff --git a/testfwk/gen_module_list_files.py b/testfwk/gen_module_list_files.py new file mode 100755 index 0000000..4dc01b5 --- /dev/null +++ b/testfwk/gen_module_list_files.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import optparse +import os +import sys +import json +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from utils import makedirs + + +def get_args(args): + parser = optparse.OptionParser() + if hasattr(parser, 'add_option'): + func = parser.add_option + else: + func = parser.add_argument + func('--depfile', help='Path to depfile (refer to `gn help depfile`)') + parser.add_option('--output_dir', help='output directory') + parser.add_option('--source_dir', help='source directory') + parser.add_option('--target', help='name of target') + parser.add_option('--target_label') + parser.add_option('--test_type') + parser.add_option('--module_list_file', help='file name of module list') + parser.add_option('--sources_file_search_root_dir', \ + help='root dir to search xx.sources files') + parser.add_option('--sources', \ + help='case sources path defined in test template') + options, _ = parser.parse_args(args) + return options, parser + + +def main(args): + options, _ = get_args(args) + print("test module_list_file = {}".\ + format(os.path.dirname(options.module_list_file))) + if not os.path.exists(os.path.dirname(options.module_list_file)): + makedirs(os.path.dirname(options.module_list_file)) + with open(options.module_list_file, 'w') as module_list_file: + contents = json.dumps([{ + 'target': options.target, + 'label': options.target_label, + 'source_directory': options.source_dir, + 'output_directory': options.output_dir, + 'test_type': options.test_type + }]) + module_list_file.write(contents) + + # create xx.sources file + fold = os.path.join(options.sources_file_search_root_dir, \ + options.source_dir[(options.source_dir.rfind("../") + len("../")):]) + if not os.path.exists(fold): + makedirs(fold) + sources_file_name = fold[fold.rfind("/") + len("/"):] + ".sources" + + arg_sources = options.sources[0: (len(options.sources) - len(","))] + with open(os.path.join(fold, sources_file_name), 'a') \ + as source_defined_file: + list_sources = arg_sources.split(",") + for source in list_sources: + content = "{}/{}\n".format( + os.path.dirname(options.source_dir), source) + source_defined_file.write(content) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/testfwk/gen_testfwk_info.py b/testfwk/gen_testfwk_info.py new file mode 100755 index 0000000..a47cfaf --- /dev/null +++ b/testfwk/gen_testfwk_info.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import argparse +import json +import os + +part_infos = "part_infos" +subsystem_infos = "subsystem_infos" + + +def create_testfwk_info_file(component_info_file, abs_fold, file_name): + if not os.path.exists(abs_fold): + os.makedirs(abs_fold) + file_path = os.path.join(abs_fold, file_name) + data = get_testfwk_info(component_info_file) + dict_product = json.dumps(data) + with open(file_path, 'w') as testfwk_info_file: + json.dump(json.loads(dict_product), testfwk_info_file) + testfwk_info_file.close() + return file_path + + +def get_testfwk_info(platform_json_file): + platform_name = platform_json_file[(platform_json_file.rfind("/") + 1):] + platform_name = platform_name[0: platform_name.rfind(".")] + data = { + platform_name: { + subsystem_infos: { + + }, + part_infos: { + + } + } + } + with open(platform_json_file, 'r') as platform_file: + dict_component_infos = json.load(platform_file) + list_subsystems = dict_component_infos["subsystems"] + set_components_name = [] + for subsystem in list_subsystems: + subsystem_name = subsystem["subsystem"] + list_components_name = [] + list_components = subsystem["components"] + for component in list_components: + component_name = component["component"] + list_components_name.append(component_name) + if component_name not in set_components_name: + set_components_name.append(component_name) + data[platform_name][subsystem_infos][subsystem_name] = \ + list_components_name + for component_name in set_components_name: + data[platform_name][part_infos][component_name] = \ + {"part_name": component_name, "build_out_dir": "."} + return data + + +if __name__ == "__main__": + arg_parser = argparse.ArgumentParser() + arg_parser.add_argument('--component-info-file', required=True) + arg_parser.add_argument('--output-json-fold', required=True) + arg_parser.add_argument('--output-json-file-name', required=True) + arg_parser.add_argument('--output-module-list-files-fold', required=True) + + args = arg_parser.parse_args() + + create_testfwk_info_file(args.component_info_file, \ + args.output_json_fold, args.output_json_file_name) \ No newline at end of file diff --git a/toolchain/BUILD.gn b/toolchain/BUILD.gn index c56078f..622771c 100755 --- a/toolchain/BUILD.gn +++ b/toolchain/BUILD.gn @@ -1,51 +1,49 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/lite/toolchain/${ohos_build_compiler}.gni") - -if (ohos_build_compiler == "gcc") { - gcc_toolchain("linux_x86_64_riscv32_gcc") { - ohos_build_compiler_prefix = "riscv32-unknown-elf" - cc = "${ohos_build_compiler_prefix}-gcc" - cxx = "${ohos_build_compiler_prefix}-g++" - ar = "${ohos_build_compiler_prefix}-ar" - ld = cc - if (ohos_build_type == "release") { - strip = "$ohos_build_compiler_prefix-strip --strip-unneeded" - } - } -} - -if (ohos_build_compiler == "clang") { - clang_toolchain("linux_x86_64_clang") { - cc = "$ohos_build_compiler_dir/bin/clang" - cxx = "$ohos_build_compiler_dir/bin/clang++" - ar = "$ohos_build_compiler_dir/bin/llvm-ar" - as = "$ohos_build_compiler_dir/bin/llvm-as" - ld = cc - if (ohos_build_type == "release") { - strip = "$ohos_build_compiler_dir/bin/llvm-objcopy --strip-all" - } - } - clang_toolchain("win_x86_64_clang") { - cc = "clang" - cxx = "clang++" - ar = "llvm-ar" - as = "llvm-as" - ld = cc - if (ohos_build_type == "release") { - strip = "llvm-objcopy --strip-all" - } - } -} - +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/lite/toolchain/clang.gni") +import("//build/lite/toolchain/gcc.gni") + +# Set toolchain configed by board. +if (board_toolchain != "" && use_board_toolchain) { + if (board_toolchain_type == "gcc") { + gcc_toolchain(board_toolchain) { + cc = ohos_current_cc_command + cxx = ohos_current_cxx_command + ar = ohos_current_ar_command + ld = ohos_current_ld_command + if (ohos_build_type == "release") { + strip = ohos_current_strip_command + } + } + } else if (board_toolchain_type == "clang") { + clang_toolchain(board_toolchain) { + cc = ohos_current_cc_command + cxx = ohos_current_cxx_command + ar = ohos_current_ar_command + ld = ohos_current_ld_command + if (ohos_build_type == "release") { + strip = ohos_current_strip_command + } + } + } +} else { + clang_toolchain("linux_x86_64_ohos_clang") { + cc = ohos_current_cc_command + cxx = ohos_current_cxx_command + ar = ohos_current_ar_command + ld = ohos_current_ld_command + if (ohos_build_type == "release") { + strip = ohos_build_strip_command + } + } +} diff --git a/toolchain/clang.gni b/toolchain/clang.gni index 9e51484..532f26b 100755 --- a/toolchain/clang.gni +++ b/toolchain/clang.gni @@ -1,120 +1,107 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ohos_build_compiler_so_strip = "llvm-objcopy --strip-all" -ohos_build_compiler_bin_strip = "llvm-objcopy --strip-all" - -template("clang_toolchain") { - toolchain(target_name) { - assert(defined(invoker.cc), "clang toolchain must specify a \"cc\" value") - assert(defined(invoker.cxx), "clang toolchain must specify a \"cxx\" value") - assert(defined(invoker.ar), "clang toolchain must specify a \"ar\" value") - assert(defined(invoker.as), "clang toolchain must specify a \"as\" value") - assert(defined(invoker.ld), "clang toolchain must specify a \"ld\" value") - - cc = invoker.cc - cxx = invoker.cxx - ar = invoker.ar - as = invoker.as - ld = invoker.ld - - need_strip = false - if(defined(invoker.strip)) { - strip = invoker.strip - need_strip = true - } - - tool("cc") { - command = "$cc {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" - description = "clang {{output}}" - outputs = [ - "{{source_out_dir}}/{{source_name_part}}.o", - ] - } - tool("cxx") { - depfile = "{{output}}.d" - command = "$cxx {{defines}} {{include_dirs}} {{cflags_cc}} -c {{source}} -o {{output}}" - description = "clang++ {{output}}" - outputs = [ - "{{source_out_dir}}/{{source_name_part}}.o", - ] - } - tool("asm") { - depfile = "{{output}}.d" - command = "$as {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" - description = "ASM {{output}}" - outputs = [ - "{{source_out_dir}}/{{source_name_part}}.o", - ] - } - tool("alink") { - outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = "{{output}}.rsp" - rspfile_content = "{{inputs}}" - command = "$ar -cr {{output}} @\"$rspfile\"" - description = "AR {{output}}" - outputs = [ - outfile, - ] - default_output_dir = "{{root_out_dir}}/libs" - default_output_extension = ".a" - output_prefix = "lib" - } - tool("solink") { - outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = "$outfile.rsp" - rspfile_content = "{{inputs}}" - command = "$ld -shared {{ldflags}} {{inputs}} -o $outfile" - if (need_strip) { - unstripped_outfile = outfile - command += " && $strip" + " \"$unstripped_outfile\" \"$outfile\"" - } - default_output_extension = ".so" - description = "SOLINK $outfile" - default_output_dir = "{{root_out_dir}}" - output_prefix = "lib" - outputs = [ - outfile - ] - } - tool("link") { - outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}" - rspfile = "$outfile.rsp" - custom_ld_flags = " " - command = "$cc {{ldflags}} {{inputs}} $custom_ld_flags -o $outfile" - if (need_strip) { - command += " && $strip $outfile" - } - - description = "LLVM LINK $outfile" - default_output_dir = "{{root_out_dir}}" - rspfile_content = "{{inputs}}" - outputs = [ - outfile - ] - } - tool("stamp") { - if (host_os == "win") { - command = "cmd /c type nul > \"{{output}}\"" - } else { - command = "/usr/bin/touch {{output}}" - } - description = "STAMP {{output}}" - } - - tool("copy") { - command = "cp -afd {{source}} {{output}}" - description = "COPY {{source}} {{output}}" - } - } -} \ No newline at end of file +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +template("clang_toolchain") { + toolchain(target_name) { + assert(defined(invoker.cc), "clang toolchain must specify a \"cc\" value") + assert(defined(invoker.cxx), "clang toolchain must specify a \"cxx\" value") + assert(defined(invoker.ar), "clang toolchain must specify a \"ar\" value") + assert(defined(invoker.ld), "clang toolchain must specify a \"ld\" value") + + cc = invoker.cc + cxx = invoker.cxx + ar = invoker.ar + ld = invoker.ld + + need_strip = false + if (defined(invoker.strip)) { + strip = invoker.strip + need_strip = true + } + + tool("cc") { + command = "$cc {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + description = "clang {{output}}" + outputs = + [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] + } + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx {{defines}} {{include_dirs}} {{cflags_cc}} -c {{source}} -o {{output}}" + description = "clang++ {{output}}" + outputs = + [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] + } + tool("asm") { + depfile = "{{output}}.d" + command = "$cc {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}" + description = "ASM {{output}}" + outputs = + [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] + } + tool("alink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = "$ar -cr {{output}} @\"$rspfile\"" + description = "AR {{output}}" + outputs = [ outfile ] + default_output_dir = "{{root_out_dir}}/libs" + default_output_extension = ".a" + output_prefix = "lib" + } + tool("solink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + rspfile_content = "{{inputs}}" + command = "$ld -shared {{ldflags}} {{inputs}} {{libs}} -o $outfile" + if (need_strip) { + unstripped_outfile = outfile + command += " && $strip" + " \"$unstripped_outfile\" \"$outfile\"" + } + default_output_extension = ".so" + description = "SOLINK $outfile" + default_output_dir = "{{root_out_dir}}" + output_prefix = "lib" + outputs = [ outfile ] + } + tool("link") { + outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + custom_ld_flags = " " + command = + "$cc {{ldflags}} {{inputs}} {{libs}} $custom_ld_flags -o $outfile" + if (need_strip) { + command += " && $strip $outfile" + } + + description = "LLVM LINK $outfile" + default_output_dir = "{{root_out_dir}}" + rspfile_content = "{{inputs}}" + outputs = [ outfile ] + } + tool("stamp") { + if (host_os == "win") { + command = "cmd /c type nul > \"{{output}}\"" + } else { + command = "/usr/bin/touch {{output}}" + } + description = "STAMP {{output}}" + } + + tool("copy") { + command = "cp -afd {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } + } +} diff --git a/toolchain/gcc.gni b/toolchain/gcc.gni index 2176271..5764933 100755 --- a/toolchain/gcc.gni +++ b/toolchain/gcc.gni @@ -1,132 +1,119 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if (ohos_kernel_type == "liteos_m") { - ohos_build_compiler_prefix = "riscv32-unknown-elf" - ohos_build_compiler_so_strip = "" - ohos_build_compiler_bin_strip = "" -} - -template("gcc_toolchain") { - toolchain(target_name) { - assert(defined(invoker.ar), "gcc toolchain must specify a \"ar\" value") - assert(defined(invoker.cc), "gcc toolchain must specify a \"cc\" value") - assert(defined(invoker.cxx), "gcc toolchain must specify a \"cxx\" value") - assert(defined(invoker.ld), "gcc toolchain must specify a \"ld\" value") - - cc = invoker.cc - cxx = invoker.cxx - ar = invoker.ar - ld = invoker.ld - - need_strip = false - if(defined(invoker.strip)) { - strip = invoker.strip - need_strip = true - } - - if (defined(invoker.extra_ldflags) && invoker.extra_ldflags != "") { - extra_ldflags = " " + invoker.extra_ldflags - } else { - extra_ldflags = "" - } - - tool("cc") { - command = "$cc {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "cross compiler {{output}}" - outputs = [ - "{{source_out_dir}}/{{source_name_part}}.o", - ] - } - tool("cxx") { - depfile = "{{output}}.d" - command = "$cxx {{defines}} {{include_dirs}} {{cflags_cc}} -c {{source}} -o {{output}}" - depsformat = "gcc" - description = "CXX {{output}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", - ] - } - tool("asm") { - depfile = "{{output}}.d" - command = "$cc {{defines}} {{include_dirs}} {{asmflags}} {{source}} -c -o {{output}}" - depsformat = "gcc" - description = "cross compiler {{output}}" - outputs = [ - "{{source_out_dir}}/{{source_name_part}}.o" - ] - } - tool("alink") { - outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = "{{output}}.rsp" - rspfile_content = "{{inputs}}" - command = "$ar cr {{output}} @\"$rspfile\"" - - description = "AR {{output}}" - outputs = [ - outfile - ] - - default_output_dir = "{{root_out_dir}}/libs" - default_output_extension = ".a" - output_prefix = "lib" - } - tool("solink") { - outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" - rspfile = "{{output}}.rsp" - rspfile_content = "{{inputs}}" - command = "$ld -shared {{ldflags}} $extra_ldflags " + - "-Wl,--start-group {{inputs}} {{libs}} -Wl,--end-group -o $outfile" - if(need_strip) { - command += "&& $strip $outfile" - } - description = "SOLINK $outfile" - outputs = [ - outfile - ] - - default_output_dir = "{{root_out_dir}}" - default_output_extension = ".so" - output_prefix = "lib" - } - tool("link") { - outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}" - rspfile = "$outfile.rsp" - command = "$ld {{ldflags}} $extra_ldflags " + - "-Wl,--start-group {{inputs}} {{libs}} -Wl,--end-group -o $outfile " - if(need_strip) { - command += "&& $strip $outfile" - } - - description = "LINK $outfile" - default_output_dir = "{{root_out_dir}}" - rspfile_content = "{{inputs}}" - outputs = [ - outfile - ] - } - tool("stamp") { - if (host_os == "win") { - command = "cmd /c type nul > \"{{output}}\"" - } else { - command = "/usr/bin/touch {{output}}" - } - description = "STAMP {{output}}" - } - tool("copy") { - command = "cp -afd {{source}} {{output}}" - description = "COPY {{source}} {{output}}" - } - } -} \ No newline at end of file +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +template("gcc_toolchain") { + toolchain(target_name) { + assert(defined(invoker.ar), "gcc toolchain must specify a \"ar\" value") + assert(defined(invoker.cc), "gcc toolchain must specify a \"cc\" value") + assert(defined(invoker.cxx), "gcc toolchain must specify a \"cxx\" value") + assert(defined(invoker.ld), "gcc toolchain must specify a \"ld\" value") + + cc = invoker.cc + cxx = invoker.cxx + ar = invoker.ar + ld = invoker.ld + + need_strip = false + if (defined(invoker.strip)) { + strip = invoker.strip + need_strip = true + } + + if (defined(invoker.extra_ldflags) && invoker.extra_ldflags != "") { + extra_ldflags = " " + invoker.extra_ldflags + } else { + extra_ldflags = "" + } + + tool("cc") { + command = "$cc {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "gcc cross compiler {{output}}" + outputs = + [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] + } + tool("cxx") { + depfile = "{{output}}.d" + command = "$cxx {{defines}} {{include_dirs}} {{cflags_cc}} -c {{source}} -o {{output}}" + depsformat = "gcc" + description = "gcc CXX {{output}}" + outputs = + [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] + } + tool("asm") { + depfile = "{{output}}.d" + command = "$cc {{defines}} {{include_dirs}} {{asmflags}} {{source}} -c -o {{output}}" + depsformat = "gcc" + description = "gcc cross compiler {{output}}" + outputs = + [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ] + } + tool("alink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = "$ar cr {{output}} @\"$rspfile\"" + + description = "AR {{output}}" + outputs = [ outfile ] + + default_output_dir = "{{root_out_dir}}/libs" + default_output_extension = ".a" + output_prefix = "lib" + } + tool("solink") { + outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" + rspfile = "{{output}}.rsp" + rspfile_content = "{{inputs}}" + command = + "$ld -shared {{ldflags}} $extra_ldflags " + + "-Wl,--start-group {{inputs}} {{libs}} -Wl,--end-group -o $outfile" + if (need_strip) { + command += "&& $strip $outfile" + } + description = "SOLINK $outfile" + outputs = [ outfile ] + + default_output_dir = "{{root_out_dir}}" + default_output_extension = ".so" + output_prefix = "lib" + } + tool("link") { + outfile = "{{output_dir}}/bin/{{target_output_name}}{{output_extension}}" + rspfile = "$outfile.rsp" + command = + "$ld {{ldflags}} $extra_ldflags " + + "-Wl,--start-group {{inputs}} {{libs}} -Wl,--end-group -o $outfile " + if (need_strip) { + command += "&& $strip $outfile" + } + + description = "LINK $outfile" + default_output_dir = "{{root_out_dir}}" + rspfile_content = "{{inputs}}" + outputs = [ outfile ] + } + tool("stamp") { + if (host_os == "win") { + command = "cmd /c type nul > \"{{output}}\"" + } else { + command = "/usr/bin/touch {{output}}" + } + description = "STAMP {{output}}" + } + tool("copy") { + command = "cp -afd {{source}} {{output}}" + description = "COPY {{source}} {{output}}" + } + } +}