OpenHarmony 是如何通过--product-name编译选项找到编译明细的

0. 编译命令

我们知道鸿蒙系统的编译命令如下

./build.sh --product-name rk3568

1. 通过 product-name 找到编译明细目录

vendor/hihope/rk3568

编译系统默认vendor目录是这样组织的 vendor/厂商名称/产品名称,那么通过编译vendor下面的2级目录,就可以得到所有厂商的名字和产品名称的列表。那么,通过编译指定的 product-name rk3568,就找到了配置目录 vendor/hihope/rk3568 。

 

类似的,还可以找到device的目录 

device/board/hihope/rk3568
device/soc/rockchip/rk3568

解析出来的中间文件会保存在out目录下面 

out/ohos_config.json

{
  "root_path": "/home/openharmony",
  "board": "rk3568",
  "kernel": null,
  "product": "rk3568",
  "product_path": "/home/openharmony/vendor/hihope/rk3568",
  "device_path": "/home/openharmony/device/board/rockchip/rk3568",
  "device_company": "rockchip",
  "os_level": "standard",
  "version": "3.0",
  "patch_cache": null,
  "product_json": "/home/openharmony/vendor/hihope/rk3568/config.json",
  "component_type": "",
  "product_config_path": "/home/openharmony/vendor/hihope/rk3568",
  "target_cpu": "arm64",
  "target_os": null,
  "out_path": "/home/openharmony/out/rk3568",
  "subsystem_config_json": "build/subsystem_config.json",
  "device_config_path": "/home/openharmony/device/board/rockchip/rk3568",
  "support_cpu": null,
  "compile_config": null,
  "log_mode": "normal"
}

2. 在配置目录下解析 config.json

vendor/hihope/rk3568/config.json

{
  "product_name": "rk3568",
  "device_company": "rockchip",
  "device_build_path": "device/board/hihope/rk3568",
  "target_cpu": "arm64",
  "type": "standard",
  "version": "3.0",
  "board": "rk3568",
  "api_version": 8,
  "enable_ramdisk": true,
  "enable_absystem": false,
  "build_selinux": false,
  "build_seccomp": true,
  "inherit": [ "productdefine/common/inherit/rich.json", "productdefine/common/inherit/chipset_common.json" ],
  "subsystems": [
    {
      "subsystem": "security",
      "components": [
        {
          "component": "selinux_adapter",
          "features": []
        }
      ]
    },
    {
      "subsystem": "communication",
      "components": [
        {
          "component": "netmanager_ext",
          "features": []
        },
        {
          "component": "bluetooth_service",
          "features": []
        }
      ]
    },
    
    ... ...
}

 里面罗列了该产品所需要编译的子系统,那鸿蒙到底有多少子系统,这些子系统代码存在哪里呢?

3. 通过subsystem名称,找到子系统代码

鸿蒙所有的子系统都保存在 build/subsystem_config.json 中,里面也保存了子系统的代码目录

{
  "arkui": {
    "path": "foundation/arkui",
    "name": "arkui"
  },
  "ai": {
    "path": "foundation/ai",
    "name": "ai"
  },
  "account": {
    "path": "base/account",
    "name": "account"
  },
    ... ...
}

 

posted @ 2024-09-24 16:41  秦舒云  阅读(101)  评论(0编辑  收藏  举报