diff --git a/en/device-dev/quick-start/figure/3518_bootloader.png b/en/device-dev/quick-start/figure/3518_bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..2d67376af75fa7693ed16299de75255c08178c14 Binary files /dev/null and b/en/device-dev/quick-start/figure/3518_bootloader.png differ diff --git a/en/device-dev/quick-start/figure/3518_monitor.png b/en/device-dev/quick-start/figure/3518_monitor.png new file mode 100644 index 0000000000000000000000000000000000000000..d287df0c64ca5e2ffc27aa1acd820cdf0e6b40c6 Binary files /dev/null and b/en/device-dev/quick-start/figure/3518_monitor.png differ diff --git a/en/device-dev/quick-start/figure/3518_reboot_success.png b/en/device-dev/quick-start/figure/3518_reboot_success.png new file mode 100644 index 0000000000000000000000000000000000000000..7a063003ded7d94e8b2a030a3df855f6915c933c Binary files /dev/null and b/en/device-dev/quick-start/figure/3518_reboot_success.png differ diff --git a/en/device-dev/quick-start/figure/3518_reset_success.png b/en/device-dev/quick-start/figure/3518_reset_success.png new file mode 100644 index 0000000000000000000000000000000000000000..8e3d4e7d2a36e2b880f592ec88b01b6c4bef07cc Binary files /dev/null and b/en/device-dev/quick-start/figure/3518_reset_success.png differ diff --git a/en/device-dev/quick-start/figure/bootloader.png b/en/device-dev/quick-start/figure/bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..e674bafb0adaa4c0ff8efaf297ee52bab3165212 Binary files /dev/null and b/en/device-dev/quick-start/figure/bootloader.png differ diff --git a/en/device-dev/quick-start/figure/monitor.png b/en/device-dev/quick-start/figure/monitor.png new file mode 100644 index 0000000000000000000000000000000000000000..bc935a8970e39629d2c93f6b92f96c5fa7d1a49b Binary files /dev/null and b/en/device-dev/quick-start/figure/monitor.png differ diff --git a/en/device-dev/quick-start/figure/reboot_success.png b/en/device-dev/quick-start/figure/reboot_success.png new file mode 100644 index 0000000000000000000000000000000000000000..7a063003ded7d94e8b2a030a3df855f6915c933c Binary files /dev/null and b/en/device-dev/quick-start/figure/reboot_success.png differ diff --git a/en/device-dev/quick-start/figure/reset_success.png b/en/device-dev/quick-start/figure/reset_success.png new file mode 100644 index 0000000000000000000000000000000000000000..67e50038e79cf0f7c2a6bd79b48c63b7557179a4 Binary files /dev/null and b/en/device-dev/quick-start/figure/reset_success.png differ diff --git a/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md b/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md index e3d75a0b10a0877b12be269e21116d454f8986e0..0d76e33bf6f62ad9bd0497b42fad64c24234f3df 100644 --- a/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md @@ -203,63 +203,26 @@ To program flash memory through the network port in the Windows or Linux environ ## Running an Image -1. Connect to a serial port. - - >![](../public_sys-resources/icon-notice.gif) **NOTICE:** - >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3516-faqs.md). - - **Figure 2** Serial port connection - ![](figure/serial-port-connection.png "serial-port-connection") - - 1. Click **Monitor** to enable the serial port. - 2. Press **Enter** repeatedly until **hisilicon** displays. - 3. Go to step [2](#l5b42e79a33ea4d35982b78a22913b0b1) if the board is started for the first time or the startup parameters need to be modified; go to step [3](#ld26f18828aa44c36bfa36be150e60e49) otherwise. - -2. \(Mandatory when the board is started for the first time\) Modify the bootcmd and bootargs parameters of U-Boot. You need to perform this step only once if the parameters need not to be modified during the operation. The board automatically starts after it is reset. - - >![](../public_sys-resources/icon-notice.gif) **NOTICE:** - >The default waiting time in the U-Boot is 2s. You can press **Enter** to interrupt the waiting and run the **reset** command to restart the system after "hisilicon" is displayed. - - **Table 1** Parameters of the U-Boot - - - - - - - - - - - - - - - - - - - -

Command

-

Description

-

setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";

-

Run this command to read content that has a size of 0x4800 (9 MB) and a start address of 0x800 (1 MB) to the memory address 0x80000000. The file size must be the same as that of the OHOS_Image.bin file in the IDE.

-

setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=20M rw";

-

Run this command to set the output mode to serial port output, baud rate to 115200, data bit to 8, rootfs to be mounted to the emmc component, and file system type to vfat.

-

rootaddr=10M rootsize=20M rw indicates the start address and size of the rootfs.img file to be burnt, respectively. The file size must be the same as that of the rootfs.img file in the IDE.

-

saveenv

-

saveenv means to save the current configuration.

-

reset

-

reset means to reset the board.

-
- - >![](../public_sys-resources/icon-notice.gif) **NOTICE:** - >**go 0x80000000** \(optional\) indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press **Enter** in the countdown phase of the U-Boot startup to interrupt the automatic startup. - -3. Run the **reset** command and press **Enter** to restart the board. After the board is restarted, **OHOS** is displayed when you press **Enter**. - - **Figure 3** System startup - ![](figure/system-startup.png "system-startup") +After programming is completed, you need to configure the bootloader to run the OpenHarmony system. + +1. In the Hi3516D V300 task, click **Configure bootloader \(Boot OS\)** to configure the bootloader. + + > ![](../public_sys-resources/icon-note.gif) **NOTE:** + > The bootloader configuration in DevEco Device Tool has been adapted to Hi3516D V300. Therefore, no manual modification is needed. + + ![](figure/bootloader.png) + +2. When the message shown below is displayed, restart the development board. If **SUCCESS** is displayed, it indicates that the configuration is successful. + + ![](figure/reset_success.png) + +3. Click **Monitor** on the taskbar to start the serial port tool. + + ![](figure/monitor.png) + +4. Follow the onscreen instructions until **OHOS \#** is displayed, indicating that the system is started successfully. + + 1. ![](figure/reboot_success.png) ## Running a Program diff --git a/en/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md b/en/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md index 4824273ec7cace6fd339716a1de27ee3bd8f1f0d..e93979ee8fe20f0c904939749678ff5a6e344d8b 100644 --- a/en/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md +++ b/en/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md @@ -203,64 +203,26 @@ The following uses the USB port burning as an example. ## Running an Image -1. Connect to a serial port. - - >![](../public_sys-resources/icon-notice.gif) **NOTICE:** - >If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3518-faqs.md#en-us_topic_0000001053466255_section14871149155911). - - **Figure 2** Serial port connection - ![](figure/serial-port-connection-15.png "serial-port-connection-15") - - 1. Click **Monitor** to enable the serial port. The **TERMINAL** window is displayed. - 2. Press **Enter** repeatedly until **hisilicon** displays. - 3. Go to [step 2](#li9441185382314) if the board is started for the first time or the startup parameters need to be modified; go to [step 3](#li6442853122312) otherwise. - -2. \(Mandatory for first-time burning\) Modify the **bootcmd** and **bootargs** parameters of U-Boot. This step is a fixed operation and the result can be saved. However, you need to perform the following steps again if U-Boot needs to be reburnt. - - **Table 1** Parameters of the U-Boot - - - - - - - - - - - - - - - - - - - - - - -

Command

-

Description

-

setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";

-

Run this command to set the content of bootcmd. Select the flash whose number is 0, and read content that has a size of 0x600000 (6 MB) and a start address of 0x100000 to memory address 0x40000000. The size must be the same as that of the OHOS_Image.bin file in the IDE.

-

setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7M rootsize=8M";

-

In this command, bootargs is set to the serial port output, the baud rate is 115200, the data bit is 8, and the rootfs is mounted to the flash memory. The file system type is set to jffs2 rw, which provides the read-write attribute for the JFFS2 file system. rootaddr=7M rootsize=8M indicates the actual start address and length of the rootfs.img file to be burnt, respectively. The file size must be the same as that of the rootfs.img file in the IDE.

-

saveenv

-

saveenv means to save the current configuration.

-

reset

-

reset means to reset the board.

-

pri

-

pri means to view the displayed parameters.

-
- - >![](../public_sys-resources/icon-notice.gif) **NOTICE:** - >**go 0x40000000** \(optional\) indicates that the command is fixed in the startup parameters by default and the board automatically starts after it is reset. If you want to manually start the board, press **Enter** in the countdown phase of the U-Boot startup to interrupt the automatic startup. - -3. If **hisilicon \#** is displayed during the startup, run the **reset** command. After the system automatically starts and **OHOS** is displayed, run the **./bin/helloworld** command and then press **Enter**. The system is started successfully if information shown in the following figure is displayed. - - **Figure 3** Successful system startup and program execution - ![](figure/successful-system-startup-and-program-execution-16.png "successful-system-startup-and-program-execution-16") +After programming is completed, you need to configure the bootloader to run the OpenHarmony system. + +1. In the Hi3518E V300 task, click **Configure bootloader \(Boot OS\)** to configure the bootloader. + + > ![](../public_sys-resources/icon-note.gif) **NOTE:** + > The bootloader configuration in DevEco Device Tool has been adapted to Hi3518E V300. Therefore, no manual modification is needed. + + ![](D:/IDP%E5%8F%91%E5%B8%83%E4%BB%B6/220/For%20OpenHarmony2.0/en/quick-start/figures/3518_bootloader.png) + +2. When the message shown below is displayed, restart the development board. If **SUCCESS** is displayed, it indicates that the configuration is successful. + + ![](figure/3518_reset_success.png) + +3. Click **Monitor** on the taskbar to start the serial port tool. + + ![](figure/3518_monitor.png) + +4. Follow the onscreen instructions until **OHOS \#** is displayed, indicating that the system is started successfully. + + ![](figure/3518_reboot_success.png) ## Follow-up Learning diff --git a/en/device-dev/quick-start/quickstart-standard-running.md b/en/device-dev/quick-start/quickstart-standard-running.md index 56033ecc0e418003d11a3f566a0602849674c6f4..5ee6df5ffaa8846b0f3ae4670d8ef8c590fe8f72 100644 --- a/en/device-dev/quick-start/quickstart-standard-running.md +++ b/en/device-dev/quick-start/quickstart-standard-running.md @@ -45,4 +45,4 @@ After the image burning is complete, perform the following steps to run the syst ## Next -Congratulations! You have completed the quick start for the standard system. Get yourself familiar with OpenHarmony by a [Development Example for Clock App](../device/device-clock-guide.md). +Congratulations! You have completed the quick start for the standard system. Get yourself familiar with OpenHarmony by a [Development Example for Clock App](../guide/device-clock-guide.md). diff --git a/en/device-dev/subsystems/figure/error-information.png b/en/device-dev/subsystems/figure/error-information.png new file mode 100644 index 0000000000000000000000000000000000000000..015c38ba5516395527bcf6715535238f02b2bad9 Binary files /dev/null and b/en/device-dev/subsystems/figure/error-information.png differ diff --git a/en/device-dev/subsystems/figure/operation-primitives-for-system-parameters.png b/en/device-dev/subsystems/figure/operation-primitives-for-system-parameters.png new file mode 100644 index 0000000000000000000000000000000000000000..54c15c441dbb8f305ff4d6031b45c2eb8cb28d6c Binary files /dev/null and b/en/device-dev/subsystems/figure/operation-primitives-for-system-parameters.png differ diff --git a/en/device-dev/subsystems/figure/rule-information.png b/en/device-dev/subsystems/figure/rule-information.png new file mode 100644 index 0000000000000000000000000000000000000000..152ef05469dc22252a9bbcf4107276a1d9f5e8b8 Binary files /dev/null and b/en/device-dev/subsystems/figure/rule-information.png differ diff --git a/en/device-dev/subsystems/figure/startup-subsystem.png b/en/device-dev/subsystems/figure/startup-subsystem.png new file mode 100644 index 0000000000000000000000000000000000000000..10619e78af9ac158497eea260dfdc623788fd810 Binary files /dev/null and b/en/device-dev/subsystems/figure/startup-subsystem.png differ diff --git a/en/device-dev/subsystems/subsys-boot-bootstrap.md b/en/device-dev/subsystems/subsys-boot-bootstrap.md index 0c0ad994d77972916c8abd3a9ef50a9528dcce7e..0be8c6643abc6256611547697a175bbb72a04a58 100644 --- a/en/device-dev/subsystems/subsys-boot-bootstrap.md +++ b/en/device-dev/subsystems/subsys-boot-bootstrap.md @@ -7,7 +7,7 @@ This module implements automatic service initialization. That is, the initializa For details about how to include the **zInit** code segment, see the Hi3861 linker script in **vendor/hisi/hi3861/hi3861/build/link/link.ld.S**. -For details about the macros used by the bootstrap module to implement automatic service initialization, see [API document](https://device.harmonyos.com/en/docs/develop/apiref/init-0000001054598113) the startup subsystem. +For details about the macros used by the bootstrap module to implement automatic service initialization, see [API document](https://device.harmonyos.com/en/docs/develop/apiref/init-0000001054598113) the Startup subsystem. ## Available APIs diff --git a/en/device-dev/subsystems/subsys-boot-faqs.md b/en/device-dev/subsystems/subsys-boot-faqs.md index 25aa1270b4fb1352445d1e41a4569eb255c95cf1..883c42b66f5597bfe4b4c43d6ce4b31cd709916b 100644 --- a/en/device-dev/subsystems/subsys-boot-faqs.md +++ b/en/device-dev/subsystems/subsys-boot-faqs.md @@ -10,7 +10,8 @@ During system startup, the error message "\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format." is displayed, and the startup is interrupted, as shown in the following figure. -![](figure/en-us_image_0000001063839940.png) +**Figure 1** Error information +![](figure/error-information.png "error-information") **Cause** diff --git a/en/device-dev/subsystems/subsys-boot-init.md b/en/device-dev/subsystems/subsys-boot-init.md index b3539771ce539b63ddced96ffc17bb30ceb3f60b..455700485b9cf1c301fe628054e664d4d55d61b6 100644 --- a/en/device-dev/subsystems/subsys-boot-init.md +++ b/en/device-dev/subsystems/subsys-boot-init.md @@ -4,7 +4,7 @@ - [How to Develop](#section15371931131117) - [How to Use](#section173413113565) -The init module starts key service processes during system startup. If you want to enable some system services to automatically start upon system startup, include the service information in the configuration file **init.cfg**. +The init module starts key service processes during system startup. If you would like to add a system service that automatically starts upon system startup, you can add the service to the **init.cfg** file. ## Configuration File diff --git a/en/device-dev/subsystems/subsys-boot-overview.md b/en/device-dev/subsystems/subsys-boot-overview.md index 77400377f93c5cbb3df8b79958bb6db53446ae72..0f33270e686ae27a5218f174960dd9069d35c285 100644 --- a/en/device-dev/subsystems/subsys-boot-overview.md +++ b/en/device-dev/subsystems/subsys-boot-overview.md @@ -1,20 +1,41 @@ # Startup +- [Context Structure](#section167378304212) - [Limitations and Constraints](#section2029921310472) -The startup subsystem provides the functions of starting key system processes after the kernel is started and before applications are started, and restoring the system to factory settings. The subsystem consists of the following modules: +## Context Structure + +The following figure shows the context structure of the Startup subsystem. + +![](figure/startup-subsystem.png) + +Upon completion of system power-on and kernel loading, system services and applications are started as follows: + +1. The kernel loads the init process. During kernel loading, bootloader usually sets the position of the init process by setting **cmdline** of the kernel. +2. After the init process is started, **tmpfs** and **procfs** are mounted and basic **dev** nodes are created to establish a basic root file system. +3. The init process starts the ueventd process to listen for device hot-swap events in the kernel and creates **dev** nodes for related devices as well as partitions for the block device. +4. After mounting partitions \(**system** and **vendor**\) of the block device, the init process scans for the init startup script of each system service and launches the respective service ability \(SA\). +5. Upon startup, an SA needs to register with the samgr process, which serves as the service registration center. The samgr process assigns each SA with an ID, which will be used by an application to access the desired SA. +6. The foundation process implements application lifecycle management. It is a special SA service process that provides the user program management framework and basic services. +7. For an application, loading of the JS running environment involves a great deal of preparations. To reduce the application startup time, the appspawn process directly spawns an application process once receiving an application startup request from the foundation process. + +The Startup subsystem consists of the following modules: - init module This module corresponds to the init process, which is the first user-space process started after the kernel is initialized. Upon startup, the init process reads and parses the configuration file **init.cfg**. Based on the parsing result, the init module executes the commands listed in Table 2 in [init Module](subsys-boot-init.md) and starts the key system service processes in sequence with corresponding permissions granted. +- ueventd module + + This module listens for **netlink** events about hot plug of kernel device drivers and dynamically manages the **dev** node of the corresponding device based on the event type. + - appspawn module This module spawns application processes upon receiving commands from the application framework, configures permissions for new processes, and calls the entry function of the application framework. - bootstrap module - This module provides entry identifiers for starting services and features. When the Samgr is started, the entry function identified by boostrap is called and system services are started. + This module provides entry identifiers for starting services and features. When samgr is started, the entry function identified by boostrap is called and system services are started. - syspara module @@ -23,9 +44,9 @@ The startup subsystem provides the functions of starting key system processes af ## Limitations and Constraints -The directories of startup subsystem are applicable to different platforms. +The directories of Startup subsystem are applicable to different platforms. -**Table 1** Directories and applicable platforms of the startup subsystem +**Table 1** Directories and applicable platforms of the Startup subsystem

Directory

@@ -58,9 +79,11 @@ The directories of startup subsystem are applicable to different platforms.
- init module - - After being burnt to the development board, the configuration file **init.cfg** changes to read-only. If you want to modify the file, you must repack and burn the rootfs image again. - - The configuration file **init.cfg** must be in JSON format. + - To start a system service, you first need to compile a startup script file **init.cfg**, in which you define the service name, path of executable files, permissions, etc. + - The startup script of each system service is installed in the **/system/etc/init** directory. The init process scans this directory for the startup script to execute. + +- When porting a new chip platform, you need to add the **/vendor/etc/init/init.\{hardware\}.cfg** file that contains the platform-level initialization configuration. This file is used to implement platform-level initialization, for example, installing the ko driver and configuring information on the related **/proc** nodes. + - The **init.cfg** file must be in JSON format. - bootstrap module: The zInit code needs to be configured in the link script. -- syspara module: The **SetParameter** and **GetParameter** APIs can only be called by applications whose UID is greater than 1000. diff --git a/en/device-dev/subsystems/subsys-boot-ref.md b/en/device-dev/subsystems/subsys-boot-ref.md index b7e51597d3a2182a68ef415435a44c03c4761f3b..0bc698346128d37dd998afcbef22480798942bca 100644 --- a/en/device-dev/subsystems/subsys-boot-ref.md +++ b/en/device-dev/subsystems/subsys-boot-ref.md @@ -4,7 +4,7 @@ ## Directory Structure -The following table describes the directory structure of the startup subsystem. +The following table describes the directory structure of the Startup subsystem. **Table 1** Directory Structure diff --git a/en/device-dev/subsystems/subsys-boot-syspara.md b/en/device-dev/subsystems/subsys-boot-syspara.md index 354d8b4f74af64ff245d0adf450c672ac773bff4..c0c51a6a8239d9ce6e5ff92c7c5fe42a50ac4e4e 100644 --- a/en/device-dev/subsystems/subsys-boot-syspara.md +++ b/en/device-dev/subsystems/subsys-boot-syspara.md @@ -1,15 +1,317 @@ # syspara Module -- [Available APIs](#section775916468231) +- [Introduction](#section381564832813) +- [System Parameter Definition Rules](#section431671411293) + - [System Parameter Value Definition File](#section885018321291) + - [System Parameter DAC Definition File](#section1333155762915) + - [Installation of the System Parameter Definition File](#section43801513193014) + - [Loading Sequence of the System Parameter Value Definition File](#section89971332173017) + +- [Usage of Shell Commands](#section2039119283111) +- [Available APIs](#section0137175692616) - [How to Use](#section118404913233) -This module provides the functions of obtaining and setting system attributes. +## Introduction + +This module provides an easy-to-use key-value pair access interface for system services to configure service functions based on their own system parameters. The following figure shows the basic primitives used to access and operate system parameters. + +**Figure 1** Operation primitives for system parameters +![](figure/operation-primitives-for-system-parameters.png "operation-primitives-for-system-parameters") + +**Table 1** Description of operation primitives + + + + + + + + + + + + + + + + + + + +

Primitive

+

Description

+

get

+

Obtains the value of a system parameter.

+

set

+

Sets the value of a system parameter.

+

wait

+

Waits for value change of a system parameter synchronously.

+

watch

+

Observes value change of a system parameter asynchronously.

+
+ +A system parameter name consists of multiple segments in dotted notation. Each segment consists of letters, digits, and underscores \(\_\). The total length cannot exceed 96 bytes. System parameter names are categorized into the following two types. + +**Table 2** Naming of system parameters + + + + + + + + + + + + + + + + + + + +

Type

+

Name

+

Example

+

Description

+

Parameter name

+

Parameter Name

+

const.product.name

+

Complete system parameter name. It does not end with a period (.).

+

Parameter directory

+

Parameter Directory

+

const.product.

+

Name of the directory storing system parameters with the same prefix. It ends with a period (.).

+
+ +System parameters are categorized into three types. + +**Table 3** System parameter types -It can be used on the Hi3861, Hi3516D V300 and Hi3518E V300 platforms powered by LiteOS Cortex-M and LiteOS Cortex-A. Supported system attributes consist of default, OEM-specified, and custom system attributes. OEM-specified system attributes provide only default values. The specific values need to be adjusted as required. + + + + + + + + + + + + + + + + + + + +

Type

+

Prefix

+

Description

+

Constant

+

const.

+

Constant parameter, which will not be changed once a value is assigned. The value can contain a maximum of 4,096 bytes (including the terminator).

+

Writable

+

Others

+

Writable parameter, which will be lost after system restart. The value can contain a maximum of 96 bytes (including the terminator).

+

Persistent

+

persist.

+

Writable and persistent parameter, which will not be lost after system restart. The value can contain a maximum of 96 bytes (including the terminator).

+
-## Available APIs +The naming format of system parameters is as follows: \[**const**|**persist**\].**$sub\_system**.**$desc**. -**Table 1** APIs for the syspara module +**$sub\_system** is the name of the subsystem or module. + +**$desc** indicates the description of a system parameter. The description can contain multiple segments in dotted notation. + +## System Parameter Definition Rules + +Each subsystem defines the system parameters of its own modules, including the system parameter name, default value, and access permission information. + +### System Parameter Value Definition File + +The system parameter value definition file ends with the **.para** extension. An example of the file format is as follows: + +``` +# This is comment +const.product.name=OHOS-PRODUCT +const.os.version.api=26 +const.telephony.enable=false|true + +const.test.withblank=My Value +``` + +Note: System parameter values do not support comments and line breaks. + +``` +# Not supported +const.test.withcomment=MyValue # This should be ommitted +# Not supported +const.test.multiline="This is a multiline parameter. +Line2 value. +Last line." +``` + +You must use a complete system parameter command when assigning a value for a system parameter. The following table describes the value assignment modes. + +**Table 4** Value assignment modes + + + + + + + + + + + + + + + + + + + + +

Type

+

Example

+

Description

+

String

+

const.product.name=OHOS-PRODUCT

+

Multi-line character strings and comments are not supported.

+

Number

+

const.os.version.api=26

+

Numbers do not need to be enclosed in quotation marks.

+

Boolean

+

const.telephony.enable=false

+

A Boolean value can be 0, 1, false, or true.

+
+ +### System Parameter DAC Definition File + +Currently, access permissions of system parameters are managed in Discretionary Access Control \(DAC\) mode. The access permission definition file ends with the **.para.dac** extension. The following is an example: + +``` +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 \(:\). + +The following figure shows the structure of the UGO rule information. + +**Figure 2** Rule information +![](figure/rule-information.png "rule-information") + +### Installation of the System Parameter Definition File + +The **.para** and **.para.dac** files are installed in the **/etc/param/** directory. An example of the GN script is as follows: + +``` +ohos_prebuilt_etc("ohos.para") { + source = "//base/startup/init_lite/services/etc/ohos.para" + part_name = "init" + module_install_dir = "etc/param" +} + +ohos_prebuilt_etc("ohos.para.dac") { + source = "//base/startup/init_lite/services/etc/ohos.para.dac" + part_name = "init" + module_install_dir = "etc/param" +} +``` + +### Loading Sequence of the System Parameter Value Definition File + +The following table provides the sequence of loading system parameter value definition files. + +**Table 5** Sequence of loading system parameter value definition files + + + + + + + + + + + + + + + + + + + + + + + + +

Type

+

Directory

+

Description

+

Kernel parameters

+

/proc/cmdline

+

In kernel parameters, ohospara.xxx=valXXX is converted to ohos.boot.xxx=valXXX.

+

OS constants

+

/system/etc/param/ohos_const/*.para

+

The definition file containing OS constants is preferentially loaded.

+

System parameters in the vendor directory

+

/vendor/etc/param/*.para

+

The definition file containing system parameters in the vendor directory is loaded with the secondary priority. It can overwrite the definition file containing system parrameters in the system directory.

+

System parameters in the system directory

+

/system/etc/param/*.para

+

The definition file containing system parameters in the system directory is last loaded. If a system parameter value already exists in the file, it will be ignored.

+
+ +## Usage of Shell Commands + +The following table describes the shell commands used to set system parameters. + +**Table 6** Description of shell commands + + + + + + + + + + + + + + + + + + + +

Command

+

Description

+

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 dump

+

Displays the statistics of system parameters.

+
+ +## Available APIs + +**Table 7** APIs for the syspara module - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +

API

@@ -28,126 +330,136 @@ It can be used on the Hi3861, Hi3516D V300 and Hi3518E V300 platforms powered by

Sets or updates a system parameter.

char* GetProductType(void)

+

const char* GetDeviceType(void)

Obtains the device type.

char* GetManufacture(void)

+

const char* GetManufacture(void)

Obtains the device manufacturer.

char* GetBrand(void)

+

const char* GetBrand(void)

Obtains the device brand.

char* GetMarketName(void)

+

const char* GetMarketName(void)

Obtains the device marketing name.

char* GetProductSeries(void)

+

const char* GetProductSeries(void)

Obtains the device series name.

char* GetProductModel(void)

+

const char* GetProductModel(void)

Obtains the device authentication model.

char* GetSoftwareModel(void)

+

const char* GetSoftwareModel(void)

Obtains the device software model.

char* GetHardwareModel(void)

+

const char* GetHardwareModel(void)

Obtains the device hardware model.

char* GetHardwareProfile(void)

+

const char* GetHardwareProfile(void)

Obtains the device hardware profile.

char* GetSerial(void)

+

const char* GetSerial(void)

Obtains the device serial number (SN).

char* GetOsName(void)

+

const char* GetOSFullName(void)

Obtains the operating system name.

char* GetDisplayVersion(void)

+

const char* GetDisplayVersion(void)

Obtains the software version visible to users.

char* GetBootloaderVersion(void)

+

const char* GetBootloaderVersion(void)

Obtains the bootloader version of this device.

char* GetSecurityPatchTag(void)

+

const char* GetSecurityPatchTag(void)

Obtains the security patch tag.

char* GetAbiList(void)

+

const char* GetAbiList(void)

Obtains the list of application binary interfaces (ABIs) supported on this device.

char* GetSdkApiLevel(void)

+

int GetSdkApiVersion(void)

Obtains the SDK API level that matches the current system software.

+

Obtains the SDK API version that matches the current system software.

char* GetFirstApiLevel(void)

+

int GetFirstApiVersion(void)

Obtains the first SDK API level of the system software.

+

Obtains the first SDK API version of the system software.

char* GetIncrementalVersion(void)

+

const char* GetIncrementalVersion(void)

Obtains the incremental version.

char* GetVersionId(void)

+

const char* GetVersionId(void)

Obtains the version ID.

char* GetBuildType(void)

+

const char* GetBuildType(void)

Obtains the build type.

char* GetBuildUser(void)

+

const char* GetBuildUser(void)

Obtains the build account user name.

char* GetBuildHost(void)

+

const char* GetBuildHost(void)

Obtains the build host name.

char* GetBuildTime(void)

+

const char* GetBuildTime(void)

Obtains the build time.

char* GetBuildRootHash(void)

+

const char* GetBuildRootHash(void)

Obtains the buildroot hash value of this version.

const char* GetOsReleaseType(void)

+

Obtains the system release type.

+

int GetDevUdid(char *udid, int size)

+

Obtains the device identifier (UDID).

+
@@ -164,7 +476,7 @@ char valueGet1[128] = {0}; ret = GetParameter(key1, "version=10.1.0", valueGet1, 128); // get sysparm -char* value1 = GetProductType(); +char* value1 = GetDeviceType(); printf("Product type =%s\n", value1); free(value1); char* value2 = GetManufacture(); @@ -194,7 +506,7 @@ free(value9); char* value10 = GetSerial(); printf("Serial =%s\n", value10); free(value10); -char* value11 = GetOsName(); +char* value11 = GetOSFullName(); printf("OS name =%s\n", value11); free(value11); char* value12 = GetDisplayVersion(); @@ -209,29 +521,39 @@ free(value14); char* value15 = GetAbiList(); printf("abi list =%s\n", value15); free(value15); -char* value16 = GetFirstApiLevel(); -printf("first api level =%s\n", value16); +int value16 = GetFirstApiVersion(); +printf("first api level =%d\n", value16); free(value16); char* value17 = GetIncrementalVersion(); printf("Incremental version = %s\n", value17); free(value17); -char* value187 = GetVersionId(); -printf("formal id =%s\n", value187); -free(value187); -char* value18 = GetBuildType(); -printf("build type =%s\n", value18); +char* value18 = GetVersionId(); +printf("formal id =%s\n", value18); free(value18); -char* value19 = GetBuildUser(); -printf("build user =%s\n", value19); +char* value19 = GetBuildType(); +printf("build type =%s\n", value19); free(value19); -char* value20 = GetBuildHost(); -printf("Build host = %s\n", value20); +char* value20 = GetBuildUser(); +printf("build user =%s\n", value20); free(value20); -char* value21 = GetBuildTime(); -printf("build time =%s\n", value21); +char* value21 = GetBuildHost(); +printf("Build host = %s\n", value21); free(value21); -char* value22 = GetBuildRootHash(); -printf("build root later..., %s\n", value22); +char* value22 = GetBuildTime(); +printf("build time =%s\n", value22); free(value22); +char* value23 = GetBuildRootHash(); +printf("build root later..., %s\n", value23); +free(value23); +char* value24 = GetOsReleaseType(); +printf("OS release type =%s\n", value24); +free(value24); +char* value25 = GetOsReleaseType(); +printf("OS release type =%s\n", value25); +free(value25); +char value26[65] = {0}; +GetDevUdid(value26, 65); +printf("device udid =%s\n", value26); +free(value26); ``` diff --git a/zh-cn/device-dev/quick-start/figure/3518_bootloader.png b/zh-cn/device-dev/quick-start/figure/3518_bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..2d67376af75fa7693ed16299de75255c08178c14 Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/3518_bootloader.png differ diff --git a/zh-cn/device-dev/quick-start/figure/3518_monitor.png b/zh-cn/device-dev/quick-start/figure/3518_monitor.png new file mode 100644 index 0000000000000000000000000000000000000000..d287df0c64ca5e2ffc27aa1acd820cdf0e6b40c6 Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/3518_monitor.png differ diff --git a/zh-cn/device-dev/quick-start/figure/3518_reboot_success.png b/zh-cn/device-dev/quick-start/figure/3518_reboot_success.png new file mode 100644 index 0000000000000000000000000000000000000000..7a063003ded7d94e8b2a030a3df855f6915c933c Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/3518_reboot_success.png differ diff --git a/zh-cn/device-dev/quick-start/figure/3518_reset_success.png b/zh-cn/device-dev/quick-start/figure/3518_reset_success.png new file mode 100644 index 0000000000000000000000000000000000000000..8e3d4e7d2a36e2b880f592ec88b01b6c4bef07cc Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/3518_reset_success.png differ diff --git a/zh-cn/device-dev/quick-start/figure/bootloader.png b/zh-cn/device-dev/quick-start/figure/bootloader.png new file mode 100644 index 0000000000000000000000000000000000000000..e674bafb0adaa4c0ff8efaf297ee52bab3165212 Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/bootloader.png differ diff --git a/zh-cn/device-dev/quick-start/figure/monitor.png b/zh-cn/device-dev/quick-start/figure/monitor.png new file mode 100644 index 0000000000000000000000000000000000000000..bc935a8970e39629d2c93f6b92f96c5fa7d1a49b Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/monitor.png differ diff --git a/zh-cn/device-dev/quick-start/figure/reboot_success.png b/zh-cn/device-dev/quick-start/figure/reboot_success.png new file mode 100644 index 0000000000000000000000000000000000000000..7a063003ded7d94e8b2a030a3df855f6915c933c Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/reboot_success.png differ diff --git a/zh-cn/device-dev/quick-start/figure/reset_success.png b/zh-cn/device-dev/quick-start/figure/reset_success.png new file mode 100644 index 0000000000000000000000000000000000000000..67e50038e79cf0f7c2a6bd79b48c63b7557179a4 Binary files /dev/null and b/zh-cn/device-dev/quick-start/figure/reset_success.png differ diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md index 1da7d05a07028c354d5601884dd1e1e6b2eb29d1..8842f826e8c0fa7c575e64928e9e97164a0ef060 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md @@ -203,63 +203,28 @@ Hi3516DV300开发板使用网口烧录方式,支持Windows和Linux系统。 ## 镜像运行 -1. 连接串口。 - - >![](../public_sys-resources/icon-notice.gif) **须知:** - >若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3516-faqs.md)进行排查。 - - **图 2** 连接串口图 - ![](figure/连接串口图.png "连接串口图") - - 1. 单击**Monitor**打开串口。 - 2. 连续输入回车直到串口显示"hisilicon"。 - 3. 单板初次启动或修改启动参数,请进入[步骤2](#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](#ld26f18828aa44c36bfa36be150e60e49)。 - -2. (单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。 - - >![](../public_sys-resources/icon-notice.gif) **须知:** - >U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisilicon",通过**reset**命令可再次启动系统。 - - **表 1** U-boot修改命令 - - - - - - - - - - - - - - - - - - - -

执行命令

-

命令解释

-

setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";

-

读取FLASH起始地址为0x800(单位为512B,即1MB),大小为0x4800(单位为512B,即9MB)的内容到0x80000000的内存地址,该大小(9MB)与IDE中所填写OHOS_Image.bin文件大小必须相同

-

setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=20M rw";

-

表示设置启动参数,输出模式为串口输出,波特率为115200,数据位8,rootfs挂载于emmc器件,文件系统类型为vfat,

-

“rootaddr=10M rootsize=20M rw”处对应填入rootfs.img的烧写起始位置与长度,此处与IDE中新增rootfs.img文件时所填大小必须相同

-

saveenv

-

表示保存当前配置。

-

reset

-

表示复位单板。

-
- - >![](../public_sys-resources/icon-notice.gif) **须知:** - >**“go 0x80000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。 - -3. 输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。 - - **图 3** 系统启动图 - ![](figure/系统启动图.png "系统启动图") +在完成Hi3516DV300的烧录后,还需要设置BootLoader引导程序,才能运行OpenHarmony系统。 + +1. 在Hi3516DV300任务中,点击**Configure bootloader(Boot OS)**进行配置即可。 + + > ![](../public_sys-resources/icon-note.gif) **说明:** + > DevEco Device Tool针对Hi3516DV300开发板的BootLoader设置进行了适配,无需开发者手动修改。 + + ![](D:/IDP%E5%8F%91%E5%B8%83%E4%BB%B6/220/For%20OpenHarmony2.0/zh/quick-start/figures/bootloader.png) + +2. 提示如下图中的重启开发板的提示信息时,重启开发板,然后在控制台输出“SUCCESS”表示设置成功。 + + ![](figure/reset_success.png) + +3. 在任务栏点击**Monitor**按钮,启动串口工具。 + + ![](figure/monitor.png) + +4. 然后根据界面提示进行操作,直到在界面打印**OHOS \#**信息,表示系统启动成功。 + + ![](figure/reboot_success.png) + + ## 执行应用程序 diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md index ed816962b259bc89132653a59e68606717fcb2f6..14820047e7bf3b8bcb8c92cc4f84299126c5fcc6 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md @@ -203,64 +203,28 @@ Hi3518EV300开发板的代码烧录支持USB烧录和串口烧录两种方式, ## 镜像运行 -1. 连接串口。 - - >![](../public_sys-resources/icon-notice.gif) **须知:** - >若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3518-faqs.md#zh-cn_topic_0000001053466255_section14871149155911)进行排查。 - - **图 2** 连接串口图 - ![](figure/连接串口图-14.png "连接串口图-14") - - 1. 单击**Monitor**打开串口。 - 2. 连续输入回车直到串口显示"hisilicon"。 - 3. 单板初次启动或修改启动参数,请进入[步骤2](#li9441185382314),否则进入[步骤3](#li6442853122312)。 - -2. (初次烧写必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,可保存执行结果,但U-boot重新烧入,则需要再次执行下述步骤。 - - **表 1** U-boot修改命令 - - - - - - - - - - - - - - - - - - - - - - -

执行命令

-

命令解释

-

setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";

-

设置bootcmd内容,选择FLASH器件0,读取FLASH起始地址为0x100000,大小为0x600000字节的内容到0x40000000的内存地址,此处0x600000为6MB,与IDE中填写OHOS_Image.bin的文件大小必须相同

-

setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7M rootsize=8M";

-

表示设置bootargs参数为串口输出,波特率为115200,数据位8,rootfs挂载于FLASH上,文件系统类型为jffs2 rw,以支持可读写JFFS2文件系统。“rootaddr=7M rootsize=8M”处对应填入实际rootfs.img的烧写起始位置与长度,与IDE内所填大小必须相同

-

saveenv

-

表示保存当前配置。

-

reset

-

表示复位单板。

-

pri

-

表示查看显示参数。

-
- - >![](../public_sys-resources/icon-notice.gif) **须知:** - >**“go 0x40000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。 - -3. 若启动时显示**"hisilicon \#**字样,请输入**“reset”**指令,等待系统自启动进入系统,系统启动后,显示**“OHOS”**字样,输入**”./bin/helloworld”**并回车,显示成功结果如下图所示。 - - **图 3** 启动成功并执行应用程序图 - ![](figure/启动成功并执行应用程序图.png "启动成功并执行应用程序图") +在完成Hi3518EV300的烧录后,还需要设置BootLoader引导程序,才能运行OpenHarmony系统。 + +1. 在Hi3518EV300任务中,点击**Configure bootloader(Boot OS)**进行配置即可。 + + > ![](../public_sys-resources/icon-note.gif) **说明:** + > DevEco Device Tool针对Hi3518EV300开发板的BootLoader设置进行了适配,无需开发者手动修改。 + + ![](figure/3518_bootloader.png) + +2. 提示如下图中的重启开发板的提示信息时,重启开发板,然后在控制台输出“SUCCESS”表示设置成功。 + + ![](figure/3518_reset_success.png) + +3. 在任务栏点击**Monitor**按钮,启动串口工具。 + + ![](figure/3518_monitor.png) + +4. 然后根据界面提示进行操作,直到在界面打印OHOS \#信息,表示系统启动成功。 + + ![](figure/3518_reboot_success.png) + + ## 下一步学习 diff --git "a/zh-cn/device-dev/subsystems/figure/UGO\350\247\204\345\210\231\344\277\241\346\201\257.png" "b/zh-cn/device-dev/subsystems/figure/UGO\350\247\204\345\210\231\344\277\241\346\201\257.png" new file mode 100644 index 0000000000000000000000000000000000000000..152ef05469dc22252a9bbcf4107276a1d9f5e8b8 Binary files /dev/null and "b/zh-cn/device-dev/subsystems/figure/UGO\350\247\204\345\210\231\344\277\241\346\201\257.png" differ diff --git "a/zh-cn/device-dev/subsystems/figure/\345\220\257\345\212\250\345\255\220\347\263\273\347\273\237\344\270\212\344\270\213\346\226\207.png" "b/zh-cn/device-dev/subsystems/figure/\345\220\257\345\212\250\345\255\220\347\263\273\347\273\237\344\270\212\344\270\213\346\226\207.png" new file mode 100644 index 0000000000000000000000000000000000000000..e524495360609969011d8554d197ee04175e6b8f Binary files /dev/null and "b/zh-cn/device-dev/subsystems/figure/\345\220\257\345\212\250\345\255\220\347\263\273\347\273\237\344\270\212\344\270\213\346\226\207.png" differ diff --git "a/zh-cn/device-dev/subsystems/figure/\347\263\273\347\273\237\345\217\202\346\225\260\346\223\215\344\275\234\345\216\237\350\257\255.png" "b/zh-cn/device-dev/subsystems/figure/\347\263\273\347\273\237\345\217\202\346\225\260\346\223\215\344\275\234\345\216\237\350\257\255.png" new file mode 100644 index 0000000000000000000000000000000000000000..54c15c441dbb8f305ff4d6031b45c2eb8cb28d6c Binary files /dev/null and "b/zh-cn/device-dev/subsystems/figure/\347\263\273\347\273\237\345\217\202\346\225\260\346\223\215\344\275\234\345\216\237\350\257\255.png" differ diff --git "a/zh-cn/device-dev/subsystems/figure/\350\277\220\350\241\214\346\212\245\351\224\231\345\233\276.png" "b/zh-cn/device-dev/subsystems/figure/\350\277\220\350\241\214\346\212\245\351\224\231\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..015c38ba5516395527bcf6715535238f02b2bad9 Binary files /dev/null and "b/zh-cn/device-dev/subsystems/figure/\350\277\220\350\241\214\346\212\245\351\224\231\345\233\276.png" differ diff --git a/zh-cn/device-dev/subsystems/subsys-boot-faqs.md b/zh-cn/device-dev/subsystems/subsys-boot-faqs.md index 196a586630627ef713e6acedf249952fbe63ae5d..49e36b3f762940e507236c9220c84caf6fc52d47 100644 --- a/zh-cn/device-dev/subsystems/subsys-boot-faqs.md +++ b/zh-cn/device-dev/subsystems/subsys-boot-faqs.md @@ -10,7 +10,8 @@ 系统启动过程中,打印“\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format.”错误,启动过程停止,如下图所示: -![](figure/zh-cn_image_0000001063839940.png) +**图 1** 运行报错图 +![](figure/运行报错图.png "运行报错图") **可能原因** diff --git a/zh-cn/device-dev/subsystems/subsys-boot-init.md b/zh-cn/device-dev/subsystems/subsys-boot-init.md index 79f46357af089ba954b09c0f18f4e5fb6a7fb472..2c239f823ae762c618ad6a9b36ebc0e0ec97ff3f 100755 --- a/zh-cn/device-dev/subsystems/subsys-boot-init.md +++ b/zh-cn/device-dev/subsystems/subsys-boot-init.md @@ -4,7 +4,7 @@ - [开发指导](#section15371931131117) - [开发实例](#section173413113565) -init启动引导组件负责在系统启动阶段启动关键服务进程,若用户需要新增随开机自启动的系统服务,可将新增服务加入配置文件init.cfg中。 +init启动引导组件负责在系统启动阶段启动关键服务进程。 若用户需要新增随开机自启动的系统服务,可将新增服务加入配置文件init.cfg中。 ## init启动引导的配置文件 diff --git a/zh-cn/device-dev/subsystems/subsys-boot-overview.md b/zh-cn/device-dev/subsystems/subsys-boot-overview.md index ee24488c41a99af1472600ecfabe775a0e18e4c3..6e3379866f55012abe89428ae8ce74b6c1d1b68a 100644 --- a/zh-cn/device-dev/subsystems/subsys-boot-overview.md +++ b/zh-cn/device-dev/subsystems/subsys-boot-overview.md @@ -1,13 +1,34 @@ # 启动恢复子系统概述 +- [启动恢复子系统上下文](#section167378304212) - [约束与限制](#section2029921310472) -启动恢复子系统负责从内核启动之后到应用启动之前的系统关键服务进程的启动过程以及设备恢复出厂设置的功能。涉及以下组件: +## 启动恢复子系统上下文 + +下图是启动子系统上下文结构图: + +![](figure/启动子系统上下文.png) + +系统上电加载内核后,按照以下流程完成系统各个服务和应用的启动: + +1. 内核加载init进程,一般在bootloader启动内核时通过设置内核的cmdline来指定init的位置。 +2. init进程启动后,会挂载tmpfs,procfs,创建基本的dev设备节点,提供最基本的根文件系统。 +3. init也会启动ueventd监听内核热插拔设备事件,为这些设备创建dev设备节点;包括block设备各个分区设备都是通过此事件创建。 +4. init进程挂载block设备各个分区(system,vendor)后,开始扫描各个系统服务的init启动脚本,并拉起各个SA服务。 +5. samgr是各个SA的服务注册中心,每个SA启动时,都需要向samgr注册,每个SA会分配一个ID,应用可以通过该ID访问SA。 +6. foundation是一个特殊的SA服务进程,提供了用户程序管理框架及基础服务;由该进程负责应用的生命周期管理。 +7. 由于应用都需要加载JS的运行环境,涉及大量准备工作,因此appspawn作为应用的孵化器,在接收到foundation里的应用启动请求时,可以直接孵化出应用进程,减少应用启动时间。 + +启动子系统内部涉及以下组件: - init启动引导组件 init启动引导组件对应的进程为init进程,是内核完成初始化后启动的第一个用户态进程。init进程启动之后,读取init.cfg配置文件,根据解析结果,执行相应命令(见[第2章表2](subsys-boot-init.md#table122681439144112)描述)并依次启动各关键系统服务进程,在启动系统服务进程的同时设置其对应权限。 +- ueventd启动引导组件 + + ueventd负责监听内核设备驱动插拔的netlink事件,根据事件类型动态管理相应设备的dev节点。 + - appspawn应用孵化组件 负责接收**用户程序框架**的命令孵化应用进程,设置新进程的权限,并调用应用程序框架的入口函数。 @@ -58,9 +79,11 @@ - init启动引导组件: - - 配置文件init.cfg烧写到单板之后变成只读模式,修改时必须重新打包和烧写rootfs镜像。 + - 每个系统服务启动时都需要编写各自的启动脚本文件init.cfg,定义各自的服务名、可执行文件路径、权限和其他信息。 + - 每个系统服务各自安装其启动脚本到/system/etc/init目录下,init进程统一扫码执行。 + +- 新芯片平台移植时,平台相关的初始化配置需要增加平台相关的初始化配置文件/vendor/etc/init/init.\{hardware\}.cfg;该文件完成平台相关的初始化设置,如安装ko驱动,设置平台相关的/proc节点信息。 - 配置文件init.cfg仅支持json格式。 - bootstrap服务启动组件:需要在链接脚本中配置zInit代码段。 -- syspara系统属性组件:SetParameter/GetParameter仅支持uid大于1000的应用调用。 diff --git a/zh-cn/device-dev/subsystems/subsys-boot-syspara.md b/zh-cn/device-dev/subsystems/subsys-boot-syspara.md index cb666e2a0ae43479d1246081b811eab4192823ea..62d799ef526a02b4d17aad57d40cf60e67e70f38 100755 --- a/zh-cn/device-dev/subsystems/subsys-boot-syspara.md +++ b/zh-cn/device-dev/subsystems/subsys-boot-syspara.md @@ -1,15 +1,317 @@ # syspara系统属性组件 -- [syspara系统接口说明](#section775916468231) +- [系统参数简介](#section381564832813) +- [系统参数定义规则](#section431671411293) + - [系统参数值定义文件](#section885018321291) + - [系统参数DAC访问控制定义文件](#section1333155762915) + - [系统参数定义文件安装方法](#section43801513193014) + - [系统参数值定义文件的加载顺序](#section89971332173017) + +- [shell命令使用说明](#section2039119283111) +- [syspara系统接口说明](#section0137175692616) - [开发实例](#section118404913233) -负责提供获取与设置操作系统相关的系统属性。 +## 系统参数简介 + +syspara系统为各系统服务提供简单易用的键值对访问接口,使得各个系统服务可以通过各自的系统参数来进行业务功能的配置。系统参数的访问和操作有以下几个基本原语 + +**图 1** 系统参数操作原语 +![](figure/系统参数操作原语.png "系统参数操作原语") + +**表 1** 系统参数操作原语说明 + + + + + + + + + + + + + + + + + + + +

功能

+

说明

+

get

+

获取系统参数的值

+

set

+

设置系统参数的值

+

wait

+

同步等待系统参数的值变更

+

watch

+

异步观察系统参数的值变更

+
+ +系统参数名称采用点分格式由多段组成,每一段由字母、数字、下划线组成,总长度不超过96字节;系统参数名称分为两类: + +**表 2** 系统参数名称 + + + + + + + + + + + + + + + + + + + +

类别

+

名称

+

示例

+

说明

+

参数名称

+

Parameter Name

+

const.product.name

+

完整的系统参数名称,末尾不是"."。

+

参数目录

+

Parameter Directory

+

const.product.

+

以"."结尾,标识相同前缀的所有系统参数集合。

+
+ +系统参数一共分为三大类: + +**表 3** 系统参数分类 -LiteOS-M内核和LiteOS-A内核的平台,包括:Hi3861平台,Hi3516DV300平台,Hi3518EV300平台。支持的系统属性包括:默认系统属性、OEM厂商系统属性和自定义系统属性。OEM厂商部分仅提供默认值,具体值需OEM产品方按需进行调整。 + + + + + + + + + + + + + + + + + + + +

类别

+

前缀

+

说明

+

常量

+

const.

+

常量参数,一旦赋值后续不会再变更;值最大长度为4096字节(包括结束符)。

+

可写

+

其它

+

可写参数,重启后丢失,值最大长度96字节(包括结束符)。

+

可持久化

+

persist.

+

可写并可持久化保存参数,重启后不会丢失,值最大长度96字节(包括结束符)。

+
-## syspara系统接口说明 +每个系统参数名称总体格式如下:\[**const**|**persist**\].**$sub\_system**.**$desc**。 -**表 1** 系统属性接口说明 +$sub\_system为子系统或模块的名称。 + +$desc为子系统或模块下参数的描述字符,可以为点分格式进行分级描述。 + +## 系统参数定义规则 + +每个子系统定义各自模块的系统参数,包括系统参数名称、默认值以及系统参数的权限访问信息。 + +### 系统参数值定义文件 + +系统参数值定义文件后缀名为**".para"**,其格式示例如下: + +``` +# This is comment +const.product.name=OHOS-PRODUCT +const.os.version.api=26 +const.telephony.enable=false|true + +const.test.withblank=My Value +``` + +注意:系统参数值不支持注释及换行。 + +``` +# 不支持 +const.test.withcomment=MyValue # This should be ommitted +# 不支持 +const.test.multiline="This is a multiline parameter. +Line2 value. +Last line." +``` + +系统参数必须通过完整的系统参数命令来赋值,赋值方式分为三大类: + +**表 4** 系统参数赋值方式 + + + + + + + + + + + + + + + + + + + + +

类别

+

示例

+

说明

+

字符串

+

const.product.name=OHOS-PRODUCT

+

不支持多行字符串,不支持注释。

+

数字

+

const.os.version.api=26

+

数字不需要引号。

+

布尔

+

const.telephony.enable=false

+

布尔型的可以为0,1,false,true。

+
+ +### 系统参数DAC访问控制定义文件 + +当前系统参数的访问权限控制通过自主访问控制(**Discretionary Access Control**)方式管理,访问权限定义文件后缀名为**".para.dac"**,示例如下: + +``` +const.product.="root:root:660" +``` + +如上所示,可以通过**参数路径**为相同前缀的所有系统参数定义一类访问权限信息;DAC信息通过":"分三段来描述,分别为参数的user,group以及UGO规则信息。 + +UGO规则信息每一位的定义如下: + +**图 2** UGO规则信息 +![](figure/UGO规则信息.png "UGO规则信息") + +### 系统参数定义文件安装方法 + +.para和.para.dac文件都安装到/etc/param/目录下,GN脚本示例如下: + +``` +ohos_prebuilt_etc("ohos.para") { + source = "//base/startup/init_lite/services/etc/ohos.para" + part_name = "init" + module_install_dir = "etc/param" +} + +ohos_prebuilt_etc("ohos.para.dac") { + source = "//base/startup/init_lite/services/etc/ohos.para.dac" + part_name = "init" + module_install_dir = "etc/param" +} +``` + +### 系统参数值定义文件的加载顺序 + +系统参数值的加载顺序如下: + +**表 5** 系统参数加载顺序 + + + + + + + + + + + + + + + + + + + + + + + + +

类别

+

路径

+

说明

+

内核参数

+

/proc/cmdline

+

内核参数中ohospara.xxx=valXXX类型的参数都转换成ohos.boot.xxx=valXXX系统参数

+

OS固定值

+

/system/etc/param/ohos_const/*.para

+

OS固定系统参数值参数优先加载。

+

vendor参数值

+

/vendor/etc/param/*.para

+

厂商参数值定义文件次优先级加载,可以覆盖system参数值定义。

+

system参数值

+

/system/etc/param/*.para

+

最后加载system参数值定义文件,文件中的系统参数值如果已经存在,则忽略掉。

+
+ +## shell命令使用说明 + +通过shell命令中可直接操作系统参数: + +**表 6** 系统参数shell命令说明 + + + + + + + + + + + + + + + + + + + +

功能

+

说明

+

param get [key]

+

获取指定key名称的系统参数值;如果不指定任何name,则返回所有系统参数值。

+

param set key value

+

设置指定key名称的参数值为value

+

param wait key value

+

同步等待指定key名称的系统参数值与value匹配。value可支持模糊匹配,如"*"表示任何值,"val*"表示只匹配前三个val字符。

+

param dump

+

显示系统参数的统计信息。

+
+ +## syspara系统接口说明 + +**表 7** 系统属性接口说明 - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +

接口名

@@ -28,126 +330,136 @@ LiteOS-M内核和LiteOS-A内核的平台,包括:Hi3861平台,Hi3516DV300

设置/更新系统参数。

char* GetProductType(void)

+

const char* GetDeviceType(void)

返回当前设备类型。

char* GetManufacture(void)

+

const char* GetManufacture(void)

返回当前设备生产厂家信息。

char* GetBrand(void)

+

const char* GetBrand(void)

返回当前设备品牌信息。

char* GetMarketName(void)

+

const char* GetMarketName(void)

返回当前设备传播名。

char* GetProductSeries(void)

+

const char* GetProductSeries(void)

返回当前设备产品系列名。

char* GetProductModel(void)

+

const char* GetProductModel(void)

返回当前设备认证型号。

char* GetSoftwareModel(void)

+

const char* GetSoftwareModel(void)

返回当前设备内部软件子型号。

char* GetHardwareModel(void)

+

const char* GetHardwareModel(void)

返回当前设备硬件版本号。

char* GetHardwareProfile(void)

+

const char* GetHardwareProfile(void)

返回当前设备硬件profile。

char* GetSerial(void)

+

const char* GetSerial(void)

返回当前设备序列号(SN号)。

char* GetOsName(void)

+

const char* GetOSFullName(void)

返回操作系统名。

char* GetDisplayVersion(void)

+

const char* GetDisplayVersion(void)

返回当前设备用户可见的软件版本号。

char* GetBootloaderVersion(void)

+

const char* GetBootloaderVersion(void)

返回当前设备Bootloader版本号。

char* GetSecurityPatchTag(void)

+

const char* GetSecurityPatchTag(void)

返回安全补丁标签。

char* GetAbiList(void)

+

const char* GetAbiList(void)

返回当前设备支持的指令集(Abi)列表。

char* GetSdkApiLevel(void)

+

int GetSdkApiVersion(void)

返回与当前系统软件匹配的SDK API level。

+

返回与当前系统软件匹配的SDK API 版本号。

char* GetFirstApiLevel(void)

+

int GetFirstApiVersion(void)

返回系统软件首版本SDK API level。

+

返回系统软件首版本SDK API 版本号。

char* GetIncrementalVersion(void)

+

const char* GetIncrementalVersion(void)

返回差异版本号。

char* GetVersionId(void)

+

const char* GetVersionId(void)

返回版本id。

char* GetBuildType(void)

+

const char* GetBuildType(void)

返回构建类型。

char* GetBuildUser(void)

+

const char* GetBuildUser(void)

返回构建账户用户名。

char* GetBuildHost(void)

+

const char* GetBuildHost(void)

返回构建主机名。

char* GetBuildTime(void)

+

const char* GetBuildTime(void)

返回构建时间。

char* GetBuildRootHash(void)

+

const char* GetBuildRootHash(void)

返回当前版本hash。

const char* GetOsReleaseType(void)

+

返回系统发布类型

+

int GetDevUdid(char *udid, int size)

+

获取设备udid

+
@@ -164,7 +476,7 @@ char valueGet1[128] = {0}; ret = GetParameter(key1, "version=10.1.0", valueGet1, 128); // get sysparm -char* value1 = GetProductType(); +char* value1 = GetDeviceType(); printf("Product type =%s\n", value1); free(value1); char* value2 = GetManufacture(); @@ -194,7 +506,7 @@ free(value9); char* value10 = GetSerial(); printf("Serial =%s\n", value10); free(value10); -char* value11 = GetOsName(); +char* value11 = GetOSFullName(); printf("OS name =%s\n", value11); free(value11); char* value12 = GetDisplayVersion(); @@ -209,29 +521,39 @@ free(value14); char* value15 = GetAbiList(); printf("abi list =%s\n", value15); free(value15); -char* value16 = GetFirstApiLevel(); -printf("first api level =%s\n", value16); +int value16 = GetFirstApiVersion(); +printf("first api level =%d\n", value16); free(value16); char* value17 = GetIncrementalVersion(); printf("Incremental version = %s\n", value17); free(value17); -char* value187 = GetVersionId(); -printf("formal id =%s\n", value187); -free(value187); -char* value18 = GetBuildType(); -printf("build type =%s\n", value18); +char* value18 = GetVersionId(); +printf("formal id =%s\n", value18); free(value18); -char* value19 = GetBuildUser(); -printf("build user =%s\n", value19); +char* value19 = GetBuildType(); +printf("build type =%s\n", value19); free(value19); -char* value20 = GetBuildHost(); -printf("Build host = %s\n", value20); +char* value20 = GetBuildUser(); +printf("build user =%s\n", value20); free(value20); -char* value21 = GetBuildTime(); -printf("build time =%s\n", value21); +char* value21 = GetBuildHost(); +printf("Build host = %s\n", value21); free(value21); -char* value22 = GetBuildRootHash(); -printf("build root later..., %s\n", value22); +char* value22 = GetBuildTime(); +printf("build time =%s\n", value22); free(value22); +char* value23 = GetBuildRootHash(); +printf("build root later..., %s\n", value23); +free(value23); +char* value24 = GetOsReleaseType(); +printf("OS release type =%s\n", value24); +free(value24); +char* value25 = GetOsReleaseType(); +printf("OS release type =%s\n", value25); +free(value25); +char value26[65] = {0}; +GetDevUdid(value26, 65); +printf("device udid =%s\n", value26); +free(value26); ```