From 7fca1ed7c06dd6a2e0a371b0d95131653517836e Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 5 Aug 2022 15:22:02 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- .../subsystems/subsys-boot-init-cfg.md | 18 +++++------ .../subsystems/subsys-boot-init-jobs.md | 2 +- .../subsystems/subsys-boot-init-plugin.md | 12 +++++--- .../subsystems/subsys-boot-init-service.md | 30 +++++++++---------- .../subsystems/subsys-boot-init-sysparam.md | 22 +++++++------- 5 files changed, 44 insertions(+), 40 deletions(-) diff --git a/en/device-dev/subsystems/subsys-boot-init-cfg.md b/en/device-dev/subsystems/subsys-boot-init-cfg.md index 584595c324..2f3133495f 100644 --- a/en/device-dev/subsystems/subsys-boot-init-cfg.md +++ b/en/device-dev/subsystems/subsys-boot-init-cfg.md @@ -18,9 +18,9 @@ Only the small system and standard system are supported. ## How to Develop ### Use Cases Upon startup, the init process first initializes the system and then parses the configuration file. The system classifies the configuration files into three types: -1. init.cfg: default configuration file, which is defined by the init process and parsed first. -2. /system/etc/init/*.cfg: configuration file defined by each subsystem. -3. /vendor/etc/init/*.cfg: configuration file defined by vendors. +1. init.cfg: default configuration file, which is defined by the init process and parsed first. +2. /system/etc/init/*.cfg: configuration file defined by each subsystem. +3. /vendor/etc/init/*.cfg: configuration file defined by vendors. If you need to add a configuration file, define its content as you want and copy it to the corresponding directory. @@ -81,14 +81,14 @@ The following is a template for defining a **.cfg** file. ] } ``` -1. .cfg file: configuration file written in the JSON format. If the services or commands in it do not take effect, check whether the content format is correct. +1. .cfg file: configuration file written in the JSON format. If the services or commands in it do not take effect, check whether the content format is correct. -2. import: command used to import **.cfg** files. The files are parsed immediately after their path is parsed. +2. import: command used to import **.cfg** files. The files are parsed immediately after their path is parsed. -3. example1.cfg: **.cfg** file to be imported. +3. example1.cfg: **.cfg** file to be imported. -4. serviceName: service name, which is user-defined. +4. serviceName: service name, which is user-defined. -5. /system/bin/serviceName: full path and parameters of the executable file of the current service, in array format. +5. /system/bin/serviceName: full path and parameters of the executable file of the current service, in array format. -6. jobName1: job name, which is user-defined. +6. jobName1: job name, which is user-defined. diff --git a/en/device-dev/subsystems/subsys-boot-init-jobs.md b/en/device-dev/subsystems/subsys-boot-init-jobs.md index c71e7c670f..aec295f723 100644 --- a/en/device-dev/subsystems/subsys-boot-init-jobs.md +++ b/en/device-dev/subsystems/subsys-boot-init-jobs.md @@ -84,7 +84,7 @@ A job is a command set, where you can manage the commands to be executed. A maxi chown uid gid target
Example:
chown 900 800 /storage/myDir
chown 100 100 /storage/myFile.txt - Modifies the owner group. chown, uid, gid, and target must be separated by only one space. + Modifies the owner group. chown, uid, gid, and target must be separated by only one space. Small and standard systems diff --git a/en/device-dev/subsystems/subsys-boot-init-plugin.md b/en/device-dev/subsystems/subsys-boot-init-plugin.md index bdf66fb8b4..aeb47c97c0 100644 --- a/en/device-dev/subsystems/subsys-boot-init-plugin.md +++ b/en/device-dev/subsystems/subsys-boot-init-plugin.md @@ -2,9 +2,13 @@ ## Overview ### Basic Concepts - - Introduction to begetctl - For details, see [begetctl Commands](#table14737791480). + + - begetctl + + For details about begetctl, see [begetctl Commands](#table14737791480). + - bootchart plug-in + The bootchart plug-in is an open source tool used to evaluate system performance during Linux startup. It automatically collects information such as the CPU usage, disk throughput, and process status, and displays the evaluation result in graphics to facilitate system startup optimization. ### Constraints @@ -149,8 +153,8 @@ bootchart is available only for the standard system, and begetctl is available f proc_diskstats.log
proc_ps.log
proc_stat.log
- 7. Run the **tar -zcvf bootchart.tgz *** command to compress the **bootchart.tgz** file (available only for Linux) and copy the compressed file to the **linux:bootchart-master** directory. - 8. Run the following command in the **bootchart-master** directory: + 7. Run the tar -zcvf bootchart.tgz * command to compress the bootchart.tgz file (available only for Linux) and copy the compressed file to the linux:bootchart-master directory. + 8. Run the following command in the bootchart-master directory: ``` python3 pybootchartgui.py -f pdf bootchart.tgz ``` diff --git a/en/device-dev/subsystems/subsys-boot-init-service.md b/en/device-dev/subsystems/subsys-boot-init-service.md index 8c07aedf5c..c527a18303 100644 --- a/en/device-dev/subsystems/subsys-boot-init-service.md +++ b/en/device-dev/subsystems/subsys-boot-init-service.md @@ -70,11 +70,11 @@ Service configuration allows you to configure services on demand to create diffe The CPU core binding, priority, MAC address, and AccessToken information of the service process can be configured in the configuration file during process startup. - - Support of CPU core binding for service processes (through modification of the **\*.cfg** file) - - Support of priority setting for service processes (through modification of the **\*.cfg** file) - - Support of MAC address setting (that is, SELinux tag setting) for service processes (through modification of the **\*.cfg** file) - - Support of AccessToken setting for service processes and distributed capability setting for system service processes (through modification of the **\*.cfg** file) - - Support of the suppression mechanism for service processes (through modification of the **\*.cfg** file) + - Support of CPU core binding for service processes (through modification of the *.cfg file) + - Support of priority setting for service processes (through modification of the *.cfg file) + - Support of MAC address setting (that is, SELinux tag setting) for service processes (through modification of the *.cfg file) + - Support of AccessToken setting for service processes and distributed capability setting for system service processes (through modification of the *.cfg file) + - Support of the suppression mechanism for service processes (through modification of the *.cfg file) The following is the example configuration for enhanced init process startup and recycling: ``` @@ -111,7 +111,7 @@ The service management module is available only for the mini system and standard ## How to Develop ### Use Cases -By parsing the ***.cfg** file, you can obtain **service** fields, and then set and start the service. +By parsing the *.cfg file, you can obtain **service** fields, and then set and start the service. ### Parameters **Table 1** Description of service fields @@ -240,8 +240,8 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a Suppression mechanism for services. If the number of times a service is restarted exceeds the value N within the specified period T, the system will be restarted. - Standard system:
Type: int array, for example, **"critical": [M, N, T]**.
- **M**: enable flag (**0**: disable; **1**: enable).
- **N**: number of times the service is started.
- **T**: period of time, in seconds.
Both **M** and **N** are greater than **0**.
- Small and standard systems:
Type: int, for example, **"critical": M**.
M: enable flag (**0**: disable; **1**: enable).
By default, **N** is **4** and **T** is **20**. + Standard system:
Type: int array, for example, "critical": [M, N, T].
- **M**: enable flag (**0**: disable; **1**: enable).
- **N**: number of times the service is started.
- **T**: period of time, in seconds.
Both **M** and **N** are greater than **0**.
+ Small and standard systems:
Type: int, for example, "critical": M.
**M**: enable flag (**0**: disable; **1**: enable).
By default, **N** is **4** and **T** is **20**. Standard system @@ -255,7 +255,7 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a Number of CPU cores bound to the service. - Type: int array, for example, **"cpucore": [N1, N2, ...]**. **N1** and **N2** indicate the indices of the CPU cores to be bound. For a single-core device, **cpucore** is **0**. + Type: int array, for example, "cpucore": [N1, N2, ...]. **N1** and **N2** indicate the indices of the CPU cores to be bound. For a single-core device, **cpucore** is **0**. Standard system @@ -269,7 +269,7 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a Distributed service capability (for standard system or higher) - Type: string array, for example, **"d-caps": ["OHOS_DMS"]**. + Type: string array, for example, "d-caps": ["OHOS_DMS"]. Standard system @@ -283,7 +283,7 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a Ability privilege level (for standard system or higher). - Type: string, for example, **"apl": "system_core"**. The value can be **system_core** (default), **normal**, or **system_basic**. + Type: string, for example, "apl": "system_core". The value can be **system_core** (default), **normal**, or **system_basic**. Standard system @@ -297,7 +297,7 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a Service startup mode (for standard system or higher). - Type: string, for example, **"start-mode": "condition"**. The value can be **boot**, **normal**, or **condition**. For details, see init Service Startup Control. + Type: string, for example, "start-mode": "condition". The value can be **boot**, **normal**, or **condition**. For details, see init Service Startup Control. Standard system @@ -311,7 +311,7 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a Whether on-demand startup is enabled. - Type: bool, for example, **"ondemand": true**. This feature is available only for the small system running the Linux kernel. For details, see init Service On-Demand Startup. + Type: bool, for example, "ondemand": true. This feature is available only for the small system running the Linux kernel. For details, see init Service On-Demand Startup. Small and standard systems @@ -359,10 +359,10 @@ By parsing the ***.cfg** file, you can obtain **service** fields, and then set a | permissions | Permissions of the socket node file. This field is valid only for sockets that have entity node files, such as the AF_UNIX address family.| | uid | User ID of the socket node file. This field is valid only for sockets that have entity node files, such as the AF_UNIX address family.| | gid | Group ID of the socket node file. This field is valid only for sockets that have entity node files, such as the AF_UNIX address family.| - | option | Socket option. This field is passed when **setsockopt** is called. Currently, the available options include **SOCKET_OPTION_PASSCRED**, **SOCKET_OPTION_RCVBUFFORCE**, **SOCK_CLOEXEC**, and **SOCK_NONBLOCK**.| + | option | Socket option. This field is passed when **setsockopt** is called. Currently, the available options include SOCKET_OPTION_PASSCRED, SOCKET_OPTION_RCVBUFFORCE, SOCK_CLOEXEC, and SOCK_NONBLOCK.| ### Available APIs - **Table 3** FD proxy APIs + **Table 3** FD proxy APIs | API | Function| Description | | ---------- | ---------- |--------| | int *ServiceGetFd(const char *serviceName, size_t *outfdCount) | Obtains the proxy FD from the init process.| Return value: Returns the pointer to the fd array if the operation is successful; returns **NULL** otherwise. (Note: Manual release is required.)
Arguments:
**serviceName**: service name.
**outfdCount**: length of the returned fd array.| diff --git a/en/device-dev/subsystems/subsys-boot-init-sysparam.md b/en/device-dev/subsystems/subsys-boot-init-sysparam.md index c6f51596b4..501563aac3 100644 --- a/en/device-dev/subsystems/subsys-boot-init-sysparam.md +++ b/en/device-dev/subsystems/subsys-boot-init-sysparam.md @@ -26,10 +26,10 @@ Figure 1 System parameter operation primitives **Table 2** System parameter names - | Type| Example| Description| - | -------- | -------- | -------- | - | Parameter name | const.product.**name** | Complete system parameter name. It does not end with a period (.). | - | Parameter directory | const.product **.** | Name of the directory storing system parameters with the same prefix. It ends with a period (.).| + | Type| Name| Example| Description| + | -------- | -------- | -------- | -------- | + | Name| Parameter Name | const.product.**name** | Complete system parameter name. It does not end with a period (.). | + | Directory| Parameter Directory | const.product **.** | Name of the directory storing system parameters with the same prefix. It ends with a period (.).| - Type @@ -90,11 +90,11 @@ Each subsystem defines the system parameters of its own modules, including the s const.product.="root:root:660" ``` - As shown above, we can use **parameter directory** to define the same access permission for system parameters with the same prefix. The DAC information is divided into three segments, user, group, and UGO rule information, which are separated using a semicolon (:). + As shown above, we can use **parameter directory** to define the same access permission for system parameters with the same prefix. The DAC information is divided into three segments, user, group, and UGO rule, which are separated using a semicolon (:). - The following figure shows the structure of the UGO rule information. + The following figure shows the structure of the UGO rule. - **Figure 2** UGO rule information + **Figure 2** UGO rule structure ![UGO rule](figure/dac-definition.png) @@ -132,7 +132,7 @@ You can set specific system parameters as needed to meet your service demand. | -------- | -------- | | param get [**key**] | Obtains the system parameter value of the specified key. If no key name is specified, all system parameter values will be returned.| | param set **key value** | Sets the specified value for the specified key.| - | param wait **key** **value** | Waits for the system parameter value of the specified key to match the specified value. Fuzzy match is supported. For example, ***** indicates any value, and **val*** indicates matching of only the first three val characters.| + | param wait **key** **value** | Waits for the system parameter value of the specified key to match the specified value. Fuzzy match is supported. For example, * indicates any value, and val* indicates matching of only the first three val characters.| | param watch | Observes value change of a system parameter asynchronously.| - syspara APIs @@ -177,9 +177,9 @@ You can set specific system parameters as needed to meet your service demand. 1. System parameter definition - You can define default system parameters and implement permission control on them by configuring the subsystem or product **.para** and **.para.dac** files. + You can define default system parameters and implement permission control on them by configuring the subsystem or product .para and .para.dac files. - ​ On a standard system, use the **ohos_prebuilt_para** template to install the configuration file to the **/etc/param/** directory. The following is an example of the GN script: + ​ On a standard system, use the ohos_prebuilt_para template to install the configuration file to the /etc/param/ directory. The following is an example of the GN script: ```go import("//base/startup/init_lite/services/etc/param/param_fixer.gni") @@ -197,7 +197,7 @@ You can set specific system parameters as needed to meet your service demand. } ``` - On a small system, run the **copy** command to copy the corresponding system parameter definition file to the **system/etc/param** directory. + On a small system, run the copy command to copy the corresponding system parameter definition file to the system/etc/param directory. ```go copy("ohos.para") { sources = [ "//base/startup/init_lite/services/etc/param/ohos.para" ] -- GitLab