The init configuration file is in JSON format and is used to configure commands and services required for system startup. Upon system startup, the Init process parses the init configuration file and runs the commands in it to start the corresponding services.
Group configuration file: A group configuration file is named in the format of device.xxxx.group.cfg. It consists of three parts, jobs, services, and groups. It is available only for the standard system. Such a file is used to configure the jobs and services that can be executed. The partition that holds the file is determined based on the bootgroup attribute in cmdline. Currently, the following groups are supported:
Startup configuration file: init.cfg file, which consists of three parts, jobs, services, and import.
Only the small system and standard system are supported.
Upon startup, the init process first initializes the system and then parses the configuration file. The system classifies the configuration files into three types:
If you need to add a configuration file, define its content as you want and copy it to the corresponding directory.
Define the configuration file.
{
"import" : [ ],
"jobs" : [ ],
"services" : [ ]
}
Copy the configuration file to the corresponding directory based on the system type.
For the standard system:
ohos_prebuilt_etc("misc.cfg") {
source = "//base/startup/init/services/etc/misc.cfg"
relative_install_dir = "init"
part_name = "init"
}
For the small system:
copy("init_configs") {
sources = [ "init_liteos_a_3516dv300.cfg" ]
outputs = [ "$root_out_dir/config/init.cfg" ]
}
The following is a template for defining a .cfg file.
{
"import" : [
"/etc/example1.cfg",
"/etc/example2.cfg"
],
"jobs" : [{
"name" : "jobName1",
"cmds" : [
"start serviceName",
"mkdir dir1"
]
}, {
"name" : "jobName2",
"cmds" : [
"chmod 0755 dir1",
"chown root root dir1"
]
}
],
"services" : [{
"name" : "serviceName",
"path" : ["/system/bin/serviceName"]
}
]
}
.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.
import: command used to import .cfg files. The files are parsed immediately after their path is parsed.
example1.cfg: .cfg file to be imported.
serviceName: service name, which is user-defined.
/system/bin/serviceName: full path and parameters of the executable file of the current service, in array format.
jobName1: job name, which is user-defined.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。