18 Star 13 Fork 426

OpenHarmony / productdefine_common

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

公共产品形态配置

简介

一个完整的产品包括芯片组件部分和系统组件部分。芯片组件部分在vendor/{company}/{product}/目录下定义。本仓主要定义与芯片无关的通用系统组件形态配置。

一个完整的系统组件形态主要包括两个部分:

  • 部件列表:系统组件支持的部件集合都在productdefine/common/products目录下通过系统组件形态配置文件xxx.json列举,该文件还可以配置部件的feature值。
  • 部件部署的指令集:指令集定义都在productdefine/common/device目录下通过arm64.json类文件来定义,products下的形态配置文件可以通过target_cpu来指定。

配置仓目录结构

productdefine/common
├── base                          # 最小系统部件集合
│   ├── mini_system.json          # 轻量系统最小部件集合
│   ├── small_system.json         # 小型系统最小部件集合
│   └── standard_system.json      # 标准系统最小部件集合
├── inherit                       # 可继承的部件模版
│   ├── chipset_common.json       # 芯片组件依赖最小部件集合
│   ├── headless.json             # 无UI系统最小部件集合
│   ├── ipcamera.json             # IPCamera部件集合, 与base/standard_system.json配合使用
│   ├── pc.json                   # PC必选部件集合,相比平板增加了打印框架和数据泄露保护部件
│   ├── default.json              # 通话类设备必选部件集合,相比rich.json全量配置裁剪了NFC、打印框架、数据泄露保护、msdp、人脸和指纹认证部件
│   ├── rich.json                 # 标准系统全量部件集合
│   ├── tablet.json               # 平板必选部件集合,相比手机裁剪了电话和位置子系统的所有部件
│   └── watch.json                # 运动表必选部件集合
└── products                      # 系统组件形态配置文件,配置文件名称与product name保持一致
    ├── ohos-sdk.json             # SDK部件集合
    ├── system-arm-default.json   # 32位系统组件部件集合
    └── system-arm64-default.json # 64位系统组件部件集合

inherit中的模版含义说明:

名称 含义 使用产品
chipset_common.json 标准系统芯片组件部件集合。 各标准系统开发板芯片组件都使用此模版。
headless.json 标准系统无头系统部件集合,支持无界面的FA安装及流转。 当前qemu-arm-linux-headless虚拟机平台使用此模版。
ipcamera.json IPCamera部件集合,IP摄像头解决方案。 当前hispark_taurus等开发板使用此模版。
pc.json PC部件集合,个人PC解决方案。 适用于使用标准系统的产品。
default.json 通话类设备部件集合,手机解决方案。 适用于使用标准系统的产品。
rich.json 标准系统全量部件集合,具备全量功能。 当前rk3568, hispark_phoenix等开发板使用此模版。
tablet.json 平板部件集合,平板解决方案。 适用于使用标准系统的产品。
watch.json 运动表部件集合,运动表解决方案。 适用于使用轻量系统的产品。

配置示例

产品配置示例: system-arm64-default.json

{
  "version": "3.0",                       # 配置文件格式版本
  "product_name": "system-arm64-default", # 系统组件形态名称
  "device_company": "ohos",               # 系统组件形态厂商
  "target_cpu": "arm64",                  # 系统组件形态支持的指令集,读取device/下对应的指令集配置
  "board": "arm64",                       # 与target_cpu相同,读取device/下对应的指令集配置
  "type": "standard",                     # 系统类型,读取base下对应的系统配置
  "inherit": [ "" ],                      # 继承的部件列表配置, 可以继承通用的部件列表
  "subsystems":[                          # 产品的部件列表
    {
      "subsystem": "arkui",
      "components": [{
          "component": "napi",
          "features": [
            "napi_xxxx=xxx",
            ...
          ]
        }
      ]
    },
    ...
  ]
}

配置文件中各字段的含义如下:

字段 含义
version 配置文件版本号,当前都填"3.0"。
product_name 系统组件形态名称,可以通过此字段值作为build.sh --product-name的参数来完成系统组件的编译。
系统组件的product_name命名采用system-{target_cpu}-{devicetype}格式,devicetype对应系统组件的形态名称,如tablet,pc等,默认为default。
device_company 系统组件形态厂商,默认均填"ohos"。
target_cpu 系统组件形态支持的指令集,会关联读取device/下对应的指令集配置。
board 与target_cpu相同,读取device/下对应的指令集配置。
type 轻量系统("mini"),小型系统("small")还是标准系统("standard")。
inherit 继承的部件列表配置,可继承的部件配置列表都存在productdefine/common/inherit目录下。
subsystems 支持的子系统部件列表。每个子系统由多个components组成;每个component包括component部件名称以及部件的features特性配置列表。
部件的feature配置都是如下的名字对字符串:
"{component_name}_xxx=xxx"

device配置示例: arm64.json

需要提供一个形态配置中target_cpu同名的配置文件,配置device信息和board信息。

{           
  "device_name": "arm64",          # device名
  "device_company": "openharmony", # device厂商名
  "target_os": "ohos",             # 在设备上部署的操作系统名
  "target_cpu": "arm64",           # 设备的cpu类型
  "kernel_version": "",
  "device_build_path": ""          # device对应的子系统路径,系统组件形态不用填写此字段。
}

device_build_path是device对应子系统路径,编译时会扫描对应目录下的部件配置。

系统组件部件类表的生成:

  1. 先加载inherit中的部件列表;
  2. 加载subsystems中的部件列表;
  3. 部件配置安装上述顺序加载,后面加载的配置可覆盖前面已加载的同名配置。

部件组合的继承关系

在inherit目录下定义部件模版,系统组件形态可以通过inherit继承该模版中包含的所有部件,减少形态过多时,新增部件的配置工作。

由于每个部件包括部件名称以及feature信息,系统组件形态配置文件继承模版时会把这两个信息都继承下去。编译框架支持了对部件模版的全量继承以及部分继承能力。下面以sample.json模版为例介绍继承关系:

[
  {
    "component": "A",
    "features": [ "feature_A=true" ]
  }, {
    "component": "B",
    "features": [ "feature_B=true" ]
  }
]
  • 全量继承:

    系统组件形态配置文件直接inherit上述模版,则可完全继承模版中的部件以及部件的feature信息。

    {
      ...
      "inherit": [ "inherit/sample.json" ],
      "subsystems": []
    }
  • 部分继承:feature重载

    {
      ...
      "inherit": [ "inherit/sample.json" ],
      "subsystems": [{
        ...
        "components": [{
            "component": "A",
            "features": [ "feature_A=false", "feature_A_pluse=false" ]
          }]
      }]
    }

    如上示例,系统组件形态配置文件中的重新定义了部件A的feature,此时会覆盖sample.json模版中部件A的配置。

常见问题说明

如何给系统组件新加一个部件?

根据部件的归属的形态,修改productdefine/common/products/目录下的系统组件形态部件列表。如果是通用的部件,可以把部件添加到productdefine/common/inherits/目录下的模版中,这样所有继承该模版的系统组件形态都会生效。

新的部件配置格式示例如下:

 "subsystems": [{
    ...
    "components": [{
        "component": "name",
        "features": [ "feature_A=false", "feature_A_pluse=false" ]
      }]
  }

如何查看一个指定产品的最终的部件列表?

在编译启动后,编译系统会解析配置文件,生成产品的全部的部件列表,输出为:out/preloader/{产品名}/parts.json。

相关仓

productdefine/common

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS

简介

暂无描述 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/openharmony/productdefine_common.git
git@gitee.com:openharmony/productdefine_common.git
openharmony
productdefine_common
productdefine_common
master

搜索帮助