update openharmony 1.0.1

This commit is contained in:
mamingshuai
2021-03-11 18:42:43 +08:00
parent 69b8fc6cd8
commit c6737365fc
119 changed files with 9398 additions and 4786 deletions
-13
View File
@@ -1,13 +0,0 @@
### 该问题是怎么引起的?
### 重现步骤
### 报错信息
-15
View File
@@ -1,15 +0,0 @@
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)
+2 -1
View File
@@ -1,2 +1,3 @@
__pycache__/
*.py[cod]
*.py[cod]
.vscode
+125 -60
View File
@@ -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"
]
}
# 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/"),
]
}
}
Executable
+193
View File
@@ -0,0 +1,193 @@
# 轻量级编译构建组件<a name="ZH-CN_TOPIC_0000001130006475"></a>
- [简介](#section11660541593)
- [目录](#section161941989596)
- [说明](#section1312121216216)
- [使用说明](#section129654513264)
- [相关仓](#section1371113476307)
## 简介<a name="section11660541593"></a>
一个基于gn和ninja的支持OpenHarmony组件化开发的编译框架,主要提供以下功能:
- 构建产品。
- 独立构建芯片厂商组件。
- 独立构建单个组件。
在开发编译构建前,应了解如下基本概念:
- 组件
可复用的软件单元,它可包含源码、配置文件、资源文件和编译脚本等。
- gn
Generate ninja的缩写,一种元构建系统,用于产生ninja文件。
- ninja
ninja是一个专注于速度的小型构建系统。
构建流程如下:
编译构建流程如图1所示,主要包括设置和编译两步:
**图 1** 编译构建流程<a name="fig1531311552204"></a>
![](figures/编译构建流程.jpg "编译构建流程")
1. hb set: 设置OpenHarmony源码目录和要编译的产品。
2. hb build: 编译产品、开发板或者组件。解决方案编译实现如下:
- 读取开发板配置:主要包括开发板使用的编译工具链、编译链接命令和选项等。
- 调用gn: 调用gn gen命令,读取产品配置\(主要包括开发板、内核、选择的组件等\)生成解决方案out目录和ninja文件。
- 调用ninja:调用ninja -C out/company/product启动编译。
- 系统镜像打包:将组件编译产物打包,制作文件系统镜像。
## 目录<a name="section161941989596"></a>
```
build/lite # 编译构建主目录
├── components # 组件描述文件。
├── hb # hb pip安装包源码。
├── make_rootfs # 文件系统制作脚本。
├── config # 编译相关的配置项
│ ├── component # 组件相关的模板定义。包括:静态库、动态库、扩展组件、模拟器库等
│ ├── kernel # 内核的编译配置参数
│ └── subsystem # 子系统模板
├── ndk # Native API相关编译脚本与配置参数
├── product # 产品全量配置表,包括:配置单元、子系统列表、编译器等。
└── toolchain # 编译工具链相关,包括:编译器路径、编译选项、链接选项等。
```
## 说明<a name="section1312121216216"></a>
### 使用说明<a name="section129654513264"></a>
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.
```
## 相关仓<a name="section1371113476307"></a>
编译构建子系统
**[build\_lite](https://gitee.com/openharmony/build_lite)**
+36 -42
View File
@@ -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__":
+34 -14
View File
@@ -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__':
-49
View File
@@ -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.")
-63
View File
@@ -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
+53
View File
@@ -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"
]
}
}
]
}
+52
View File
@@ -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"
]
}
}
]
}
+37
View File
@@ -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"
]
}
}
]
}
+48
View File
@@ -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"
]
}
}
]
}
+202
View File
@@ -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"
]
}
}
]
}
+174
View File
@@ -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": []
}
}
]
}
+144
View File
@@ -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"
]
}
}
]
}
+178
View File
@@ -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"
]
}
}
]
}
+73
View File
@@ -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"
]
}
}
]
}
+157
View File
@@ -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"
]
}
}
]
}
+156
View File
@@ -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": []
}
}
]
}
+26
View File
@@ -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": []
}
}
]
}
+28
View File
@@ -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": []
}
}
]
}
+149
View File
@@ -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": []
}
}
]
}
+162
View File
@@ -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"
]
}
}
]
}
+37
View File
@@ -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"
]
}
}
]
}
+226
View File
@@ -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"
]
}
}
]
}
+35
View File
@@ -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"
]
}
}
]
}
+191
View File
@@ -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"
]
}
}
]
}
+166
View File
@@ -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": {}
}
]
}
+57
View File
@@ -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"
]
}
}
]
}
+166
View File
@@ -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"
]
}
}
]
}
+377
View File
@@ -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"
]
}
}
]
}
-29
View File
@@ -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=
-197
View File
@@ -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
+184 -209
View File
@@ -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"
]
}
# 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
}
+131 -60
View File
@@ -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
}
+52
View File
@@ -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",
]
}
+139 -135
View File
@@ -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)
}
}
}
}
+52
View File
@@ -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"
]
}
+72
View File
@@ -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",
]
}
+142 -118
View File
@@ -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" ]
}
}
-107
View File
@@ -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",
]
}
+24
View File
@@ -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",
]
}
+4 -2
View File
@@ -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
}
+19
View File
@@ -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"
}
+19
View File
@@ -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
}
+34
View File
@@ -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",
]
}
+221 -102
View File
@@ -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)
}
}
-72
View File
@@ -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
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

-49
View File
@@ -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)
-156
View File
@@ -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)
+2 -1
View File
@@ -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())
+163 -70
View File
@@ -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__":
+54 -17
View File
@@ -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)
Executable
+42
View File
@@ -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
}
+33 -16
View File
@@ -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
+93
View File
@@ -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)
+209
View File
@@ -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)
@@ -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.
#
+31
View File
@@ -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)
@@ -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.
#
+8
View File
@@ -0,0 +1,8 @@
{
"root_path": null,
"board": null,
"kernel": null,
"product": null,
"product_path": null,
"device_path": null
}
+210
View File
@@ -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)
+113
View File
@@ -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))
+108
View File
@@ -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]
+204
View File
@@ -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]
@@ -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.
#
+260
View File
@@ -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,
' (<up>, <down> to move, <space> to select, <a> '
'to toggle, <i> 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
)
+195
View File
@@ -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
Executable
+488
View File
@@ -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
Executable
+185
View File
@@ -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
)
+55
View File
@@ -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
+107
View File
@@ -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
@@ -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.
#
+101
View File
@@ -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
+45
View File
@@ -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)')
+99
View File
@@ -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
Vendored Executable
+17
View File
@@ -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.
#
Vendored Executable
+42
View File
@@ -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))
+17
View File
@@ -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.
#
Executable
+75
View File
@@ -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
+39
View File
@@ -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
+208
View File
@@ -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
+173
View File
@@ -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 <source> <device> <cfgfile>
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
@@ -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
@@ -0,0 +1,2 @@
/bin/foundation f 500 7 7
/bin/apphilogcat f 500 4 4
+2
View File
@@ -0,0 +1,2 @@
/bin/foundation f 500 7 7
/bin/apphilogcat f 500 4 4
+116
View File
@@ -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
+92
View File
@@ -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
+157 -113
View File
@@ -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" ]
}
}
+11 -8
View File
@@ -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!")
+181 -206
View File
@@ -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
}
# 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
}
+66 -65
View File
@@ -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
}
+32 -32
View File
@@ -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("//")
}
# 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("//")
}
+2 -1
View File
@@ -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"
+1
View File
@@ -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
+3
View File
@@ -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
+151 -150
View File
@@ -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
}
}
}

Some files were not shown because too many files have changed in this diff Show More