提交 967f9a98 编写于 作者: D duangavin123

update 导入OpenHarmony工程

Signed-off-by: Nduangavin123 <duanxichao@huawei.com>
上级 033eed0b
...@@ -203,63 +203,26 @@ To program flash memory through the network port in the Windows or Linux environ ...@@ -203,63 +203,26 @@ To program flash memory through the network port in the Windows or Linux environ
## Running an Image<a name="section24721014162010"></a> ## Running an Image<a name="section24721014162010"></a>
1. Connect to a serial port. After programming is completed, you need to configure the bootloader to run the OpenHarmony system.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** 1. In the Hi3516D V300 task, click **Configure bootloader \(Boot OS\)** to configure the bootloader.
>If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3516-faqs.md).
> ![](../public_sys-resources/icon-note.gif) **NOTE:**
**Figure 2** Serial port connection<a name="fig139171488431"></a> > The bootloader configuration in DevEco Device Tool has been adapted to Hi3516D V300. Therefore, no manual modification is needed.
![](figure/serial-port-connection.png "serial-port-connection")
![](figure/bootloader.png)
1. Click **Monitor** to enable the serial port.
2. Press **Enter** repeatedly until **hisilicon** displays. 2. When the message shown below is displayed, restart the development board. If **SUCCESS** is displayed, it indicates that the configuration is successful.
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.
![](figure/reset_success.png)
2. <a name="l5b42e79a33ea4d35982b78a22913b0b1"></a>\(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.
3. Click **Monitor** on the taskbar to start the serial port tool.
>![](../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. ![](figure/monitor.png)
**Table 1** Parameters of the U-Boot 4. Follow the onscreen instructions until **OHOS \#** is displayed, indicating that the system is started successfully.
<a name="table1323441103813"></a> 1. ![](figure/reboot_success.png)
<table><thead align="left"><tr id="row1423410183818"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p623461163818"><a name="p623461163818"></a><a name="p623461163818"></a>Command</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p42341014388"><a name="p42341014388"></a><a name="p42341014388"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1623471113817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p102341719385"><a name="p102341719385"></a><a name="p102341719385"></a>setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p92347120389"><a name="p92347120389"></a><a name="p92347120389"></a>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 <strong id="b9140538191313"><a name="b9140538191313"></a><a name="b9140538191313"></a>OHOS_Image.bin</strong> file in the IDE.</p>
</td>
</tr>
<tr id="row12234912381"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p172306219392"><a name="p172306219392"></a><a name="p172306219392"></a>setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=20M rw";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p13489329396"><a name="p13489329396"></a><a name="p13489329396"></a>Run this command to set the output mode to serial port output, baud rate to <strong id="b1378372812210"><a name="b1378372812210"></a><a name="b1378372812210"></a>115200</strong>, data bit to <strong id="b27871628822"><a name="b27871628822"></a><a name="b27871628822"></a>8</strong>, <strong id="b678811281528"><a name="b678811281528"></a><a name="b678811281528"></a>rootfs</strong> to be mounted to the <strong id="b978813281220"><a name="b978813281220"></a><a name="b978813281220"></a>emmc</strong> component, and file system type to <strong id="b12788132814217"><a name="b12788132814217"></a><a name="b12788132814217"></a>vfat</strong>.</p>
<p id="p12481832163913"><a name="p12481832163913"></a><a name="p12481832163913"></a><strong id="b965011165313"><a name="b965011165313"></a><a name="b965011165313"></a>rootaddr=10M rootsize=20M rw</strong> indicates the start address and size of the <strong id="b1538675832018"><a name="b1538675832018"></a><a name="b1538675832018"></a>rootfs.img</strong> file to be burnt, respectively. The file size <strong id="b0633135515546"><a name="b0633135515546"></a><a name="b0633135515546"></a>must be the same</strong> as that of the <strong id="b69061726113015"><a name="b69061726113015"></a><a name="b69061726113015"></a>rootfs.img</strong> file in the IDE.</p>
</td>
</tr>
<tr id="row18234161153820"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p823417118386"><a name="p823417118386"></a><a name="p823417118386"></a>saveenv</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p32341616389"><a name="p32341616389"></a><a name="p32341616389"></a><strong id="b16238195319315"><a name="b16238195319315"></a><a name="b16238195319315"></a>saveenv</strong> means to save the current configuration.</p>
</td>
</tr>
<tr id="row192345113811"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p7235111183819"><a name="p7235111183819"></a><a name="p7235111183819"></a>reset</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p123781411114016"><a name="p123781411114016"></a><a name="p123781411114016"></a><strong id="b32719232420"><a name="b32719232420"></a><a name="b32719232420"></a>reset</strong> means to reset the board.</p>
</td>
</tr>
</tbody>
</table>
>![](../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. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>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<a name="fig784813366444"></a>
![](figure/system-startup.png "system-startup")
## Running a Program<a name="section5276734182615"></a> ## Running a Program<a name="section5276734182615"></a>
......
...@@ -203,64 +203,26 @@ The following uses the USB port burning as an example. ...@@ -203,64 +203,26 @@ The following uses the USB port burning as an example.
## Running an Image<a name="section17612105814480"></a> ## Running an Image<a name="section17612105814480"></a>
1. Connect to a serial port. After programming is completed, you need to configure the bootloader to run the OpenHarmony system.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:** 1. In the Hi3518E V300 task, click **Configure bootloader \(Boot OS\)** to configure the bootloader.
>If the connection fails, rectify the fault by referring to [FAQs](quickstart-lite-steps-hi3518-faqs.md#en-us_topic_0000001053466255_section14871149155911).
> ![](../public_sys-resources/icon-note.gif) **NOTE:**
**Figure 2** Serial port connection<a name="fig049019841616"></a> > The bootloader configuration in DevEco Device Tool has been adapted to Hi3518E V300. Therefore, no manual modification is needed.
![](figure/serial-port-connection-15.png "serial-port-connection-15")
![](D:/IDP%E5%8F%91%E5%B8%83%E4%BB%B6/220/For%20OpenHarmony2.0/en/quick-start/figures/3518_bootloader.png)
1. Click **Monitor** to enable the serial port. The **TERMINAL** window is displayed.
2. Press **Enter** repeatedly until **hisilicon** displays. 2. When the message shown below is displayed, restart the development board. If **SUCCESS** is displayed, it indicates that the configuration is successful.
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.
![](figure/3518_reset_success.png)
2. <a name="li9441185382314"></a>\(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.
3. Click **Monitor** on the taskbar to start the serial port tool.
**Table 1** Parameters of the U-Boot
![](figure/3518_monitor.png)
<a name="table1336762011222"></a>
<table><thead align="left"><tr id="row193681920182219"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p3368202016229"><a name="p3368202016229"></a><a name="p3368202016229"></a>Command</p> 4. Follow the onscreen instructions until **OHOS \#** is displayed, indicating that the system is started successfully.
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p936812052217"><a name="p936812052217"></a><a name="p936812052217"></a>Description</p> ![](figure/3518_reboot_success.png)
</th>
</tr>
</thead>
<tbody><tr id="row10368142032210"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1636882092214"><a name="p1636882092214"></a><a name="p1636882092214"></a>setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17368202082213"><a name="p17368202082213"></a><a name="p17368202082213"></a>Run this command to set the content of <strong id="b209671361282"><a name="b209671361282"></a><a name="b209671361282"></a>bootcmd</strong>. 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 <strong id="b12634352103017"><a name="b12634352103017"></a><a name="b12634352103017"></a>OHOS_Image.bin</strong> file in the IDE.</p>
</td>
</tr>
<tr id="row136814209227"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p234414019231"><a name="p234414019231"></a><a name="p234414019231"></a>setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7M rootsize=8M";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10368102010223"><a name="p10368102010223"></a><a name="p10368102010223"></a>In this command, <strong id="b1475793912349"><a name="b1475793912349"></a><a name="b1475793912349"></a>bootargs</strong> is set to the serial port output, the baud rate is <strong id="b1310782917185"><a name="b1310782917185"></a><a name="b1310782917185"></a>115200</strong>, the data bit is <strong id="b149010367189"><a name="b149010367189"></a><a name="b149010367189"></a>8</strong>, and the <strong id="b19757173918344"><a name="b19757173918344"></a><a name="b19757173918344"></a>rootfs</strong> is mounted to the flash memory. The file system type is set to <strong id="b875763919342"><a name="b875763919342"></a><a name="b875763919342"></a>jffs2 rw</strong>, which provides the read-write attribute for the JFFS2 file system. <strong id="b186911414141517"><a name="b186911414141517"></a><a name="b186911414141517"></a>rootaddr=7M rootsize=8M</strong> indicates the actual start address and length of the <strong id="b841582383217"><a name="b841582383217"></a><a name="b841582383217"></a>rootfs.img</strong> file to be burnt, respectively. The file size must be the same as that of the <strong id="b51690521108"><a name="b51690521108"></a><a name="b51690521108"></a>rootfs.img</strong> file in the IDE.</p>
</td>
</tr>
<tr id="row2368120112219"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p20368142072217"><a name="p20368142072217"></a><a name="p20368142072217"></a>saveenv</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p19368102020220"><a name="p19368102020220"></a><a name="p19368102020220"></a><strong id="b12547103053713"><a name="b12547103053713"></a><a name="b12547103053713"></a>saveenv</strong> means to save the current configuration.</p>
</td>
</tr>
<tr id="row63689205220"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p3368162015223"><a name="p3368162015223"></a><a name="p3368162015223"></a>reset</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p23681820182217"><a name="p23681820182217"></a><a name="p23681820182217"></a><strong id="b29195356377"><a name="b29195356377"></a><a name="b29195356377"></a>reset</strong> means to reset the board.</p>
</td>
</tr>
<tr id="row346253519253"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p16462113512251"><a name="p16462113512251"></a><a name="p16462113512251"></a>pri</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p3462335152514"><a name="p3462335152514"></a><a name="p3462335152514"></a><strong id="b18592103953712"><a name="b18592103953712"></a><a name="b18592103953712"></a>pri</strong> means to view the displayed parameters.</p>
</td>
</tr>
</tbody>
</table>
>![](../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. <a name="li6442853122312"></a>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<a name="fig2103121215172"></a>
![](figure/successful-system-startup-and-program-execution-16.png "successful-system-startup-and-program-execution-16")
## Follow-up Learning<a name="section9712145420182"></a> ## Follow-up Learning<a name="section9712145420182"></a>
......
...@@ -45,4 +45,4 @@ After the image burning is complete, perform the following steps to run the syst ...@@ -45,4 +45,4 @@ After the image burning is complete, perform the following steps to run the syst
## Next ## 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).
...@@ -7,7 +7,7 @@ This module implements automatic service initialization. That is, the initializa ...@@ -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 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<a name="section1633115419401"></a> ## Available APIs<a name="section1633115419401"></a>
......
...@@ -10,7 +10,8 @@ ...@@ -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. 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<a name="fig15217111545118"></a>
![](figure/error-information.png "error-information")
**Cause** **Cause**
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- [How to Develop](#section15371931131117) - [How to Develop](#section15371931131117)
- [How to Use](#section173413113565) - [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<a name="section56901555917"></a> ## Configuration File<a name="section56901555917"></a>
......
# Startup<a name="EN-US_TOPIC_0000001063402122"></a> # Startup<a name="EN-US_TOPIC_0000001063402122"></a>
- [Context Structure](#section167378304212)
- [Limitations and Constraints](#section2029921310472) - [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<a name="section167378304212"></a>
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 - 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. 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 - 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. 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 - 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 - syspara module
...@@ -23,9 +44,9 @@ The startup subsystem provides the functions of starting key system processes af ...@@ -23,9 +44,9 @@ The startup subsystem provides the functions of starting key system processes af
## Limitations and Constraints<a name="section2029921310472"></a> ## Limitations and Constraints<a name="section2029921310472"></a>
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
<a name="table2144134816420"></a> <a name="table2144134816420"></a>
<table><thead align="left"><tr id="row11143184819429"><th class="cellrowborder" valign="top" width="32%" id="mcps1.2.3.1.1"><p id="p014334816421"><a name="p014334816421"></a><a name="p014334816421"></a>Directory</p> <table><thead align="left"><tr id="row11143184819429"><th class="cellrowborder" valign="top" width="32%" id="mcps1.2.3.1.1"><p id="p014334816421"><a name="p014334816421"></a><a name="p014334816421"></a>Directory</p>
...@@ -58,9 +79,11 @@ The directories of startup subsystem are applicable to different platforms. ...@@ -58,9 +79,11 @@ The directories of startup subsystem are applicable to different platforms.
</table> </table>
- init module - 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. - 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 configuration file **init.cfg** must be in JSON format. - 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. - 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.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
## Directory Structure<a name="section3523121414020"></a> ## Directory Structure<a name="section3523121414020"></a>
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 **Table 1** Directory Structure
......
...@@ -203,63 +203,28 @@ Hi3516DV300开发板使用网口烧录方式,支持Windows和Linux系统。 ...@@ -203,63 +203,28 @@ Hi3516DV300开发板使用网口烧录方式,支持Windows和Linux系统。
## 镜像运行<a name="section24721014162010"></a> ## 镜像运行<a name="section24721014162010"></a>
1. 连接串口。 在完成Hi3516DV300的烧录后,还需要设置BootLoader引导程序,才能运行OpenHarmony系统。
>![](../public_sys-resources/icon-notice.gif) **须知:** 1. 在Hi3516DV300任务中,点击**Configure bootloader(Boot OS)**进行配置即可。
>若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3516-faqs.md)进行排查。
> ![](../public_sys-resources/icon-note.gif) **说明:**
**图 2** 连接串口图<a name="fig139171488431"></a> > DevEco Device Tool针对Hi3516DV300开发板的BootLoader设置进行了适配,无需开发者手动修改。
![](figure/连接串口图.png "连接串口图")
![](D:/IDP%E5%8F%91%E5%B8%83%E4%BB%B6/220/For%20OpenHarmony2.0/zh/quick-start/figures/bootloader.png)
1. 单击**Monitor**打开串口。
2. 连续输入回车直到串口显示"hisilicon"。 2. 提示如下图中的重启开发板的提示信息时,重启开发板,然后在控制台输出“SUCCESS”表示设置成功。
3. 单板初次启动或修改启动参数,请进入[步骤2](#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](#ld26f18828aa44c36bfa36be150e60e49)。
![](figure/reset_success.png)
2. <a name="l5b42e79a33ea4d35982b78a22913b0b1"></a>(单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。
3. 在任务栏点击**Monitor**按钮,启动串口工具。
>![](../public_sys-resources/icon-notice.gif) **须知:**
>U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisilicon",通过**reset**命令可再次启动系统。 ![](figure/monitor.png)
**表 1** U-boot修改命令 4. 然后根据界面提示进行操作,直到在界面打印**OHOS \#**信息,表示系统启动成功。
<a name="table1323441103813"></a> ![](figure/reboot_success.png)
<table><thead align="left"><tr id="row1423410183818"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p623461163818"><a name="p623461163818"></a><a name="p623461163818"></a>执行命令</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p42341014388"><a name="p42341014388"></a><a name="p42341014388"></a>命令解释</p>
</th>
</tr>
</thead>
<tbody><tr id="row1623471113817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p102341719385"><a name="p102341719385"></a><a name="p102341719385"></a>setenv bootcmd "mmc read 0x0 0x80000000 0x800 0x4800; go 0x80000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p92347120389"><a name="p92347120389"></a><a name="p92347120389"></a>读取FLASH起始地址为0x800(单位为512B,即1MB),大小为0x4800(单位为512B,即9MB)的内容到0x80000000的内存地址,该大小(9MB)与IDE中所填写OHOS_Image.bin文件大小<strong id="b15685648113111"><a name="b15685648113111"></a><a name="b15685648113111"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row12234912381"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p172306219392"><a name="p172306219392"></a><a name="p172306219392"></a>setenv bootargs "console=ttyAMA0,115200n8 root=emmc fstype=vfat rootaddr=10M rootsize=20M rw";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p13489329396"><a name="p13489329396"></a><a name="p13489329396"></a>表示设置启动参数,输出模式为串口输出,波特率为115200,数据位8,rootfs挂载于emmc器件,文件系统类型为vfat,</p>
<p id="p12481832163913"><a name="p12481832163913"></a><a name="p12481832163913"></a>“rootaddr=10M rootsize=20M rw”处对应填入rootfs.img的烧写起始位置与长度,此处与IDE中新增rootfs.img文件时所填大小<strong id="b24816327398"><a name="b24816327398"></a><a name="b24816327398"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row18234161153820"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p823417118386"><a name="p823417118386"></a><a name="p823417118386"></a>saveenv</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p32341616389"><a name="p32341616389"></a><a name="p32341616389"></a>表示保存当前配置。</p>
</td>
</tr>
<tr id="row192345113811"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p7235111183819"><a name="p7235111183819"></a><a name="p7235111183819"></a>reset</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p123781411114016"><a name="p123781411114016"></a><a name="p123781411114016"></a>表示复位单板。</p>
</td>
</tr>
</tbody>
</table>
>![](../public_sys-resources/icon-notice.gif) **须知:**
>**“go 0x80000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。
3. <a name="ld26f18828aa44c36bfa36be150e60e49"></a>输入**“reset”**指令并回车,重启单板,启动成功如下图,输入回车串口显示OHOS字样。
**图 3** 系统启动图<a name="fig784813366444"></a>
![](figure/系统启动图.png "系统启动图")
## 执行应用程序<a name="section5276734182615"></a> ## 执行应用程序<a name="section5276734182615"></a>
......
...@@ -203,64 +203,28 @@ Hi3518EV300开发板的代码烧录支持USB烧录和串口烧录两种方式, ...@@ -203,64 +203,28 @@ Hi3518EV300开发板的代码烧录支持USB烧录和串口烧录两种方式,
## 镜像运行<a name="section17612105814480"></a> ## 镜像运行<a name="section17612105814480"></a>
1. 连接串口。 在完成Hi3518EV300的烧录后,还需要设置BootLoader引导程序,才能运行OpenHarmony系统。
>![](../public_sys-resources/icon-notice.gif) **须知:** 1. 在Hi3518EV300任务中,点击**Configure bootloader(Boot OS)**进行配置即可。
>若无法连接串口,请参考[常见问题](quickstart-lite-steps-hi3518-faqs.md#zh-cn_topic_0000001053466255_section14871149155911)进行排查。
> ![](../public_sys-resources/icon-note.gif) **说明:**
**图 2** 连接串口图<a name="fig049019841616"></a> > DevEco Device Tool针对Hi3518EV300开发板的BootLoader设置进行了适配,无需开发者手动修改。
![](figure/连接串口图-14.png "连接串口图-14")
![](figure/3518_bootloader.png)
1. 单击**Monitor**打开串口。
2. 连续输入回车直到串口显示"hisilicon"。 2. 提示如下图中的重启开发板的提示信息时,重启开发板,然后在控制台输出“SUCCESS”表示设置成功。
3. 单板初次启动或修改启动参数,请进入[步骤2](#li9441185382314),否则进入[步骤3](#li6442853122312)。
![](figure/3518_reset_success.png)
2. <a name="li9441185382314"></a>(初次烧写必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,可保存执行结果,但U-boot重新烧入,则需要再次执行下述步骤。
3. 在任务栏点击**Monitor**按钮,启动串口工具。
**表 1** U-boot修改命令
![](figure/3518_monitor.png)
<a name="table1336762011222"></a>
<table><thead align="left"><tr id="row193681920182219"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p3368202016229"><a name="p3368202016229"></a><a name="p3368202016229"></a>执行命令</p> 4. 然后根据界面提示进行操作,直到在界面打印OHOS \#信息,表示系统启动成功。
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.2"><p id="p936812052217"><a name="p936812052217"></a><a name="p936812052217"></a>命令解释</p> ![](figure/3518_reboot_success.png)
</th>
</tr>
</thead>
<tbody><tr id="row10368142032210"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p1636882092214"><a name="p1636882092214"></a><a name="p1636882092214"></a>setenv bootcmd "sf probe 0;sf read 0x40000000 0x100000 0x600000;go 0x40000000";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p17368202082213"><a name="p17368202082213"></a><a name="p17368202082213"></a>设置bootcmd内容,选择FLASH器件0,读取FLASH起始地址为0x100000,大小为0x600000字节的内容到0x40000000的内存地址,此处0x600000为6MB,与IDE中填写OHOS_Image.bin的文件大小<strong id="b1355784283916"><a name="b1355784283916"></a><a name="b1355784283916"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row136814209227"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p234414019231"><a name="p234414019231"></a><a name="p234414019231"></a>setenv bootargs "console=ttyAMA0,115200n8 root=flash fstype=jffs2 rw rootaddr=7M rootsize=8M";</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p10368102010223"><a name="p10368102010223"></a><a name="p10368102010223"></a>表示设置bootargs参数为串口输出,波特率为115200,数据位8,rootfs挂载于FLASH上,文件系统类型为jffs2 rw,以支持可读写JFFS2文件系统。“rootaddr=7M rootsize=8M”处对应填入实际rootfs.img的烧写起始位置与长度,与IDE内所填大小<strong id="b1461083410403"><a name="b1461083410403"></a><a name="b1461083410403"></a>必须相同</strong>。</p>
</td>
</tr>
<tr id="row2368120112219"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p20368142072217"><a name="p20368142072217"></a><a name="p20368142072217"></a>saveenv</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p19368102020220"><a name="p19368102020220"></a><a name="p19368102020220"></a>表示保存当前配置。</p>
</td>
</tr>
<tr id="row63689205220"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p3368162015223"><a name="p3368162015223"></a><a name="p3368162015223"></a>reset</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p23681820182217"><a name="p23681820182217"></a><a name="p23681820182217"></a>表示复位单板。</p>
</td>
</tr>
<tr id="row346253519253"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.1 "><p id="p16462113512251"><a name="p16462113512251"></a><a name="p16462113512251"></a>pri</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.2.3.1.2 "><p id="p3462335152514"><a name="p3462335152514"></a><a name="p3462335152514"></a>表示查看显示参数。</p>
</td>
</tr>
</tbody>
</table>
>![](../public_sys-resources/icon-notice.gif) **须知:**
>**“go 0x40000000”**为可选指令,默认配置已将该指令固化在启动参数中,单板复位后可自动启动。若想切换为手动启动,可在U-boot启动倒数阶段使用"回车"打断自动启动。
3. <a name="li6442853122312"></a>若启动时显示**"hisilicon \#**字样,请输入**“reset”**指令,等待系统自启动进入系统,系统启动后,显示**“OHOS”**字样,输入**”./bin/helloworld”**并回车,显示成功结果如下图所示。
**图 3** 启动成功并执行应用程序图<a name="fig2103121215172"></a>
![](figure/启动成功并执行应用程序图.png "启动成功并执行应用程序图")
## 下一步学习<a name="section9712145420182"></a> ## 下一步学习<a name="section9712145420182"></a>
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
系统启动过程中,打印“\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format.”错误,启动过程停止,如下图所示: 系统启动过程中,打印“\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format.”错误,启动过程停止,如下图所示:
![](figure/zh-cn_image_0000001063839940.png) **图 1** 运行报错图<a name="fig15217111545118"></a>
![](figure/运行报错图.png "运行报错图")
**可能原因** **可能原因**
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- [开发指导](#section15371931131117) - [开发指导](#section15371931131117)
- [开发实例](#section173413113565) - [开发实例](#section173413113565)
init启动引导组件负责在系统启动阶段启动关键服务进程若用户需要新增随开机自启动的系统服务,可将新增服务加入配置文件init.cfg中。 init启动引导组件负责在系统启动阶段启动关键服务进程若用户需要新增随开机自启动的系统服务,可将新增服务加入配置文件init.cfg中。
## init启动引导的配置文件<a name="section56901555917"></a> ## init启动引导的配置文件<a name="section56901555917"></a>
......
# 启动恢复子系统概述<a name="ZH-CN_TOPIC_0000001063402122"></a> # 启动恢复子系统概述<a name="ZH-CN_TOPIC_0000001063402122"></a>
- [启动恢复子系统上下文](#section167378304212)
- [约束与限制](#section2029921310472) - [约束与限制](#section2029921310472)
启动恢复子系统负责从内核启动之后到应用启动之前的系统关键服务进程的启动过程以及设备恢复出厂设置的功能。涉及以下组件: ## 启动恢复子系统上下文<a name="section167378304212"></a>
下图是启动子系统上下文结构图:
![](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进程启动之后,读取init.cfg配置文件,根据解析结果,执行相应命令(见[第2章表2](subsys-boot-init.md#table122681439144112)描述)并依次启动各关键系统服务进程,在启动系统服务进程的同时设置其对应权限。 init启动引导组件对应的进程为init进程,是内核完成初始化后启动的第一个用户态进程。init进程启动之后,读取init.cfg配置文件,根据解析结果,执行相应命令(见[第2章表2](subsys-boot-init.md#table122681439144112)描述)并依次启动各关键系统服务进程,在启动系统服务进程的同时设置其对应权限。
- ueventd启动引导组件
ueventd负责监听内核设备驱动插拔的netlink事件,根据事件类型动态管理相应设备的dev节点。
- appspawn应用孵化组件 - appspawn应用孵化组件
负责接收**用户程序框架**的命令孵化应用进程,设置新进程的权限,并调用应用程序框架的入口函数。 负责接收**用户程序框架**的命令孵化应用进程,设置新进程的权限,并调用应用程序框架的入口函数。
...@@ -58,9 +79,11 @@ ...@@ -58,9 +79,11 @@
</table> </table>
- init启动引导组件: - init启动引导组件:
- 配置文件init.cfg烧写到单板之后变成只读模式,修改时必须重新打包和烧写rootfs镜像。 - 每个系统服务启动时都需要编写各自的启动脚本文件init.cfg,定义各自的服务名、可执行文件路径、权限和其他信息。
- 每个系统服务各自安装其启动脚本到/system/etc/init目录下,init进程统一扫码执行。
- 新芯片平台移植时,平台相关的初始化配置需要增加平台相关的初始化配置文件/vendor/etc/init/init.\{hardware\}.cfg;该文件完成平台相关的初始化设置,如安装ko驱动,设置平台相关的/proc节点信息。
- 配置文件init.cfg仅支持json格式。 - 配置文件init.cfg仅支持json格式。
- bootstrap服务启动组件:需要在链接脚本中配置zInit代码段。 - bootstrap服务启动组件:需要在链接脚本中配置zInit代码段。
- syspara系统属性组件:SetParameter/GetParameter仅支持uid大于1000的应用调用。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册