> 文档中心 > openharmony L1 添加子系统

openharmony L1 添加子系统

openharmony L1 添加子系统

  • Hi3516
    • 创建BUILD
    • 创建myhello.json
    • 修改config.json

Hi3516

针对ipcamera_hispark_linux这一类型,写其子系统的创建

创建BUILD

在openharmony项目代码里,随意找个位置放你的子系统代码,
写完新增子系统的代码后,需要在新增的代码目录下添加BUILD.gn文件,完成lite_component组件。
myhello
|-src
| |-myhello.c
|-include
| |-myhello.h
|-BUILD.gn

BUILD.gn内容如下:

import(“//build/lite/config/component/lite_component.gni”)
shared_library(“hello_lib”) {
 #output_name = “myhello”
 sources = [ “myhello.c” ]
 include_dirs = [ “/include” ]
 defines = []
 cflags_c = []
 ldflags = []
 deps = []
 public_deps = []
}
lite_component(“my_hello”) {
 features = [
  “:hello_lib”,
 ]
}

创建myhello.json

在路径:build/lite/components,新建json文件
myhello.json内容如下:

{
 “components”: [
 {
  “component”: “my_hello_app”,
  “description”: “”,
  “optional”: “true”,
  “dirs”: [
   “//base/myhello”
  ],
  “targets”: [
   “//base/myhello:my_hello”
  ],
  “rom”: “2.6M”,
  “ram”: “~1.8M”,
   “output”: [“libmyhello.so”],
  “adapted_board”: [
   “liteos_a”,
    “linux”
  ],
  “adapted_kernel”: [ “liteos_a” ,“linux” ],
   “features”: [],
  “deps”: {
   “components”: [
    “utils_base”,
    “samgr_lite”,
    “peripheral_input”,
    “ui”,
    “ipc_lite”,
    “aafwk_lite”,
    “appexecfwk_lite”,
    “hilog_lite”,
    “wms”,
    “kal_timer”,
    “ipc_lite”
   ],
   “third_party”: [
    “bounds_checking_function”,
    “cjson”
   ]
  }
 }
 ]
}

修改config.json

修改:vendor/hisilicon/hispark_taurus_linux/config.json
在"subsystems":[]里面添加以下代码:

{
 “subsystem”: “myhello”,
 “components”: [
  { “component”: “my_hello_app”, “features”:[] }
 ]
},