Compilation and construction of Openharmony--Basics

1. Introduction to compilation and construction

Openharmony's compilation and build process uses V3.1 as the dividing line in Hongmeng's open source version, and the process has changed slightly. But among them, ninja and python call different cross tool chains to compile the source code through the configuration file json, and then generate the image file. This article first takes Openharmony V3.1 as an example to explain its compilation and construction process, and uses examples to explain how to add subsystems, modules, etc.

Openharmony V3.2 and its derived versions will be expanded upon in the future.

2. Overall compilation process of Openharmony v3.1 L2 device

2.1 Compilation and scanning instructions

During compilation, the corresponding subsystem configuration files need to be scanned. The subsystem configuration file contains the following three files

  • subsystem_config.json

  • {product name}.json

  • {Product device name}.json

Through these three files, load all subcomponents and configuration information that the product needs to participate in compilation.

2.2 {product name}.json

The product configuration file is in the //productdefine/common/products directory. The following is an example of compiling rk3568:

When typing in the Openharmony root directory

./build.sh --product-name rk3568

At this time, we first enter the preloader stage and find the //productdefine/common/products/rk3568.json file according to the parameter rk3568.

The configuration file mainly contains information such as product name, product manufacturer, product device name , product type, product corresponding subsystem path, and components included in the product. When configuring the subsystem corresponding to the product, add product_build_path to the file to indicate the product subsystem directory. The preloader stage loads the corresponding subsystem component configuration information from this directory.

{
  "product_name": "rk3568",     				# 产品名称	
  "product_company": "hihope",					# 产品厂商
  "product_device": "rk3568",					# 产品设备名 ({产品设备名称}.json) 
  "version": "2.0",
  "type": "standard",							# 产品类型
  "product_build_path": "device/hihope/build",	# 产品子系统目录
  "parts":{										# 产品所包含的部件
    "ace:ace_engine_standard":{},
    "ace:napi":{},
    "account:os_account_standard":{},
    "barrierfree:accessibility":{},
......
  }
}

2.3 {product device name}.json

The device configuration file, according to the 2.2 description file name, is also rk3568.json. The full path of this file is //productdefine/common/device/rk3568.json. The configuration file mainly contains the device name, device manufacturer, target os and target of the device. cpu, device corresponding subsystem path and other information. When configuring the corresponding subsystem of the device, add device_build_path to the file to indicate the device subsystem directory. The preloader stage loads the corresponding subsystem component configuration information from this directory.

{
    "device_name": "rk3568",					# 设备名称
    

Guess you like

Origin blog.csdn.net/procedurecode/article/details/128819760